Skip to content

Commit

Permalink
error collection
Browse files Browse the repository at this point in the history
  • Loading branch information
elouangrimm authored Oct 29, 2024
1 parent 5e2c23a commit c2d4742
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,17 @@ async def on_message(message):
elif response.status_code == 500:
reply_text = "The server seems to be having issues! Try again later. 🛠️"
print("AI: Server Issues, Code 500")
elif response.status_code == 503:
reply_text = "The server is busy right now. Please try again later. 😕"
print("AI: Server Busy, Code 503")
else:
reply_text = f"Unexpected error: {response.status_code}. 😕"
print(f"AI: Unexpected Error, Code {response.status_code}")
error_message = response.json() if response.headers.get('Content-Type') == 'application/json' else response.text
reply_text = f"Error: {response.status_code} - {error_message} 😕"
print(f"AI: Unexpected Error, Code {response.status_code}, Message: {error_message}")

await message.reply(reply_text)
await bot.process_commands(message)



# Add Ping Command
@bot.command()
async def addping(ctx, role: discord.Role, member: discord.Member = None):
Expand Down

0 comments on commit c2d4742

Please sign in to comment.