mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 01:06:19 +00:00
Update code.py
This commit is contained in:
@@ -38,6 +38,11 @@ async def setup(ctx, channel: discord.TextChannel, api_key):
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user