From c0aa51170ce03c3fe0abaec177590b109ae55c50 Mon Sep 17 00:00:00 2001 From: Paillat Date: Tue, 6 Dec 2022 16:17:17 +0100 Subject: [PATCH] Update code.py --- code/code.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/code/code.py b/code/code.py index 3deb8ff..f3ab5ad 100644 --- a/code/code.py +++ b/code/code.py @@ -32,17 +32,6 @@ bot = discord.Bot(intents=Intents.all()) async def setup(ctx, channel: discord.TextChannel, api_key): #check if the api key is valid debug(f"The user {ctx.author} ran the setup command in the channel {ctx.channel} of the guild {ctx.guild}, named {ctx.guild.name}") - openai.api_key = api_key - try: - openai.Completion.create(engine="davinci", prompt="Hello world", max_tokens=1) - except: - await ctx.respond("Invalid api key", ephemeral=True) - return - #if there is not enough tokens remaining, send a message to the user - if openai.Completion.create(engine="davinci", prompt="Hello world", max_tokens=1).headers["X-RateLimit-Remaining"] == 0: - await ctx.respond("Not enough tokens remaining", ephemeral=True) - debug("Not enough tokens remaining") - return #check if the channel is valid if channel is None: await ctx.respond("Invalid channel id", ephemeral=True)