From 75870294712ed5489563169b38fc8067cacbbcd4 Mon Sep 17 00:00:00 2001 From: Atridad Lahiji <88056492+atridadl@users.noreply.github.com> Date: Sat, 17 Jun 2023 17:06:23 -0600 Subject: [PATCH] rate limits --- src/commands/pic.ts | 7 +++++-- src/index.ts | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/commands/pic.ts b/src/commands/pic.ts index 5d712fd..7bf4d24 100644 --- a/src/commands/pic.ts +++ b/src/commands/pic.ts @@ -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({ 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 diff --git a/src/index.ts b/src/index.ts index 2fb70ea..54e5ac8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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 } });