rate limits

This commit is contained in:
Atridad Lahiji 2023-06-17 17:06:23 -06:00
parent e71fe908c5
commit 7587029471
No known key found for this signature in database
2 changed files with 9 additions and 3 deletions

View file

@ -1,5 +1,5 @@
import { ApplyOptions } from '@sapphire/decorators';
import { Args, Command } from '@sapphire/framework';
import { Args, BucketScope, Command } from '@sapphire/framework';
import { Message } from 'discord.js';
import { Configuration, OpenAIApi } from 'openai';
@ -11,9 +11,12 @@ const openai = new OpenAIApi(configuration);
@ApplyOptions<Command.Options>({
description: 'Make a picture!',
options: ['prompt'],
// 10mins
cooldownDelay: 600_000,
cooldownLimit: 1,
cooldownFilteredUsers: ['himbothyswaggins']
// Yes... I did hardcode myself.
cooldownFilteredUsers: ['himbothyswaggins'],
cooldownScope: BucketScope.User
})
export class UserCommand extends Command {
// Register Chat Input and Context Menu command

View file

@ -20,10 +20,13 @@ const client = new SapphireClient({
intents: [GatewayIntentBits.DirectMessages, GatewayIntentBits.GuildMessages, GatewayIntentBits.Guilds, GatewayIntentBits.MessageContent],
loadMessageCommandListeners: true,
defaultCooldown: {
// 10s
delay: 10_000,
filteredCommands: ['ping', 'wryna'],
limit: 2,
scope: BucketScope.Guild
// Yes... I did hardcode myself.
filteredUsers: ['himbothyswaggins'],
scope: BucketScope.User
}
});