try/except in budget and allow adding floats
This commit is contained in:
parent
3786a1434a
commit
f0dccd2233
1 changed files with 19 additions and 13 deletions
|
|
@ -124,7 +124,8 @@ class ChatGPT(commands.Cog):
|
|||
return (flagged, categories, category_scores)
|
||||
|
||||
@commands.command()
|
||||
async def budget(self, ctx, command: str, budget: int):
|
||||
async def budget(self, ctx, command: str, budget: float):
|
||||
try:
|
||||
if ctx.author.id == self.admin_id:
|
||||
if command == "add":
|
||||
self.dalle_budget += budget
|
||||
|
|
@ -137,6 +138,11 @@ class ChatGPT(commands.Cog):
|
|||
await ctx.send(f"Budget set to {budget}")
|
||||
else:
|
||||
await ctx.send(f"The current budget is {self.dalle_budget}")
|
||||
else:
|
||||
await ctx.send(f"The current budget is {self.dalle_budget}")
|
||||
except Exception as e:
|
||||
self.logger.exception(f"Budget command failed: {e}")
|
||||
await ctx.send(f"Budget command failed")
|
||||
|
||||
|
||||
@commands.command(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue