fix: Ticket dm output for error checking
All checks were successful
Build Docker / Build Docker (push) Successful in 57s

This commit is contained in:
Nathan Woodburn 2024-02-20 12:11:39 +11:00
parent 9732bbcb47
commit b454139988
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
2 changed files with 6 additions and 3 deletions

7
bot.py
View File

@ -526,7 +526,10 @@ async def ticket(ctx):
await ctx.response.send_message("This server is not registered",ephemeral=True) await ctx.response.send_message("This server is not registered",ephemeral=True)
return return
await ctx.response.send_message("Creating ticket...",ephemeral=True) await ctx.response.send_message("Creating ticket...",ephemeral=True)
await support.create_ticket(str(ctx.user.id), str(ctx.guild.id)) output = await support.create_ticket(str(ctx.user.id), str(ctx.guild.id))
# Send user DM
user = await client.fetch_user(int(ctx.user.id))
await user.send(output)
@tree.command(name="ticketaddserver", description="Add a server to the ticket system") @tree.command(name="ticketaddserver", description="Add a server to the ticket system")
@ -630,7 +633,7 @@ async def check_reminders():
print("Reminder sent for "+str(reminder), flush=True) print("Reminder sent for "+str(reminder), flush=True)
reminders.remove(reminder) reminders.remove(reminder)
write_reminders(reminders) write_reminders(reminders)
# When the bot is ready # When the bot is ready

View File

@ -43,7 +43,7 @@ async def create_ticket(user_id, server:str):
return "Server not found" return "Server not found"
tickets = ticketsData['server'][server]['tickets'] tickets = ticketsData['server'][server]['tickets']
if user_id != "admin": if user_id != str(client.application.owner.id):
for ticket in tickets: for ticket in tickets:
if ticket['user_id'] == user_id and ticket['status'] == "open": if ticket['user_id'] == user_id and ticket['status'] == "open":
return "You already have an open ticket" return "You already have an open ticket"