Skip to content
This repository has been archived by the owner on Mar 27, 2020. It is now read-only.

Commit

Permalink
fixed error on closing when user disabled DMs
Browse files Browse the repository at this point in the history
  • Loading branch information
LiBa001 authored Dec 15, 2017
1 parent 7a6a535 commit 7e2903d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,8 @@ async def on_message(message):
content = splited[0]
else:
closemsg = ""

errormsg = ""

ticket = sqlib.tickets.get(content)

Expand Down Expand Up @@ -417,10 +419,13 @@ async def on_message(message):
ticket[0],
closemsg)
ticketauthor = await client.get_user_info(ticket[1])
await client.send_message(ticketauthor, msg_to_user)
try:
await client.send_message(ticketauthor, msg_to_user)
except discord.Forbidden:
errormsg = ", but user disabled direct messages"

sqlib.tickets.update(content, {'closed': 1})
await client.send_message(message.channel, "Ticket closed.")
await client.send_message(message.channel, f"Ticket closed{errormsg}.")

channel_id = str(sqlib.servers.get(sqlib.tickets.get(content, 'server')[0], 'channel')[0])
channel = client.get_channel(channel_id)
Expand Down

0 comments on commit 7e2903d

Please sign in to comment.