rate limits
This commit is contained in:
parent
e71fe908c5
commit
7587029471
2 changed files with 9 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
import { ApplyOptions } from '@sapphire/decorators';
|
import { ApplyOptions } from '@sapphire/decorators';
|
||||||
import { Args, Command } from '@sapphire/framework';
|
import { Args, BucketScope, Command } from '@sapphire/framework';
|
||||||
import { Message } from 'discord.js';
|
import { Message } from 'discord.js';
|
||||||
import { Configuration, OpenAIApi } from 'openai';
|
import { Configuration, OpenAIApi } from 'openai';
|
||||||
|
|
||||||
|
@ -11,9 +11,12 @@ const openai = new OpenAIApi(configuration);
|
||||||
@ApplyOptions<Command.Options>({
|
@ApplyOptions<Command.Options>({
|
||||||
description: 'Make a picture!',
|
description: 'Make a picture!',
|
||||||
options: ['prompt'],
|
options: ['prompt'],
|
||||||
|
// 10mins
|
||||||
cooldownDelay: 600_000,
|
cooldownDelay: 600_000,
|
||||||
cooldownLimit: 1,
|
cooldownLimit: 1,
|
||||||
cooldownFilteredUsers: ['himbothyswaggins']
|
// Yes... I did hardcode myself.
|
||||||
|
cooldownFilteredUsers: ['himbothyswaggins'],
|
||||||
|
cooldownScope: BucketScope.User
|
||||||
})
|
})
|
||||||
export class UserCommand extends Command {
|
export class UserCommand extends Command {
|
||||||
// Register Chat Input and Context Menu command
|
// Register Chat Input and Context Menu command
|
||||||
|
|
|
@ -20,10 +20,13 @@ const client = new SapphireClient({
|
||||||
intents: [GatewayIntentBits.DirectMessages, GatewayIntentBits.GuildMessages, GatewayIntentBits.Guilds, GatewayIntentBits.MessageContent],
|
intents: [GatewayIntentBits.DirectMessages, GatewayIntentBits.GuildMessages, GatewayIntentBits.Guilds, GatewayIntentBits.MessageContent],
|
||||||
loadMessageCommandListeners: true,
|
loadMessageCommandListeners: true,
|
||||||
defaultCooldown: {
|
defaultCooldown: {
|
||||||
|
// 10s
|
||||||
delay: 10_000,
|
delay: 10_000,
|
||||||
filteredCommands: ['ping', 'wryna'],
|
filteredCommands: ['ping', 'wryna'],
|
||||||
limit: 2,
|
limit: 2,
|
||||||
scope: BucketScope.Guild
|
// Yes... I did hardcode myself.
|
||||||
|
filteredUsers: ['himbothyswaggins'],
|
||||||
|
scope: BucketScope.User
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue