From 3786a1434a673ddde6d1bd2fac4ed197fc56078d Mon Sep 17 00:00:00 2001 From: phixxy Date: Sat, 16 Mar 2024 00:35:18 -0700 Subject: [PATCH] allow admin to increase dalle budget with commands --- cogs/chatgpt.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cogs/chatgpt.py b/cogs/chatgpt.py index 40e3c96..a1b8da2 100644 --- a/cogs/chatgpt.py +++ b/cogs/chatgpt.py @@ -122,6 +122,21 @@ class ChatGPT(commands.Cog): categories = response_data['results'][0]['categories'] category_scores = response_data['results'][0]['category_scores'] return (flagged, categories, category_scores) + + @commands.command() + async def budget(self, ctx, command: str, budget: int): + if ctx.author.id == self.admin_id: + if command == "add": + self.dalle_budget += budget + await ctx.send(f"Budget increased by {budget}") + elif command == "remove": + self.dalle_budget -= budget + await ctx.send(f"Budget decreased by {budget}") + elif command == "set": + self.dalle_budget = budget + await ctx.send(f"Budget set to {budget}") + else: + await ctx.send(f"The current budget is {self.dalle_budget}") @commands.command(