From 4ffc52e2504ccf73eb5a29b1120fb0c7715c7db9 Mon Sep 17 00:00:00 2001 From: AllfatherHatt Date: Thu, 20 Feb 2025 19:38:49 +0100 Subject: [PATCH] Added function back to setting api key --- reginaldCog/reginald.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/reginaldCog/reginald.py b/reginaldCog/reginald.py index e8679e8..6f9bb8d 100644 --- a/reginaldCog/reginald.py +++ b/reginaldCog/reginald.py @@ -125,6 +125,15 @@ class ReginaldCog(commands.Cog): """✅ Removes a role's permission to use Reginald.""" await self.config.guild(ctx.guild).allowed_role.clear() await ctx.send("The role's permission to use the Reginald command has been revoked.") + + @commands.guild_only() + @commands.has_permissions(manage_guild=True) + @commands.command(help="Set the OpenAI API key") + async def setreginaldcogapi(self, ctx, api_key): + """Allows an admin to set the OpenAI API key for Reginald.""" + await self.config.guild(ctx.guild).openai_api_key.set(api_key) + await ctx.send("OpenAI API key set successfully.") + async def setup(bot): """✅ Correct async cog setup for Redbot"""