Update try/except/else interaction responses
This commit is contained in:
@@ -263,17 +263,13 @@ async def add_break(interaction: discord.Interaction, start_day: int, start_mont
|
||||
try:
|
||||
DATABASE_CONN.add_break(user_id=uid, break_start=start_date, break_end=end_date)
|
||||
except UNIQUEVIOLATION:
|
||||
await interaction.response.send_message(f'{user_char_name} -- you have already added a callout for {callout_date} with reason: {reason}')
|
||||
except INVALIDDATETIMEFORMAT:
|
||||
await interaction.response.send_message(f'{user_char_name} -- please format the date as the following format: MM/DD/YYYY')
|
||||
except FOREIGNKEYVIOLATION:
|
||||
await interaction.response.send_message(f'{user_nick} -- please register with the bot using the following command!\n`/registercharacter`\n Please use your in-game name!')
|
||||
await interaction.response.send_message(f'{user_char_name} -- you have already added a break for {start_date} through {end_date}!')
|
||||
except helper.db_helper.DateTimeError:
|
||||
await interaction.response.send_message(f'{user_nick}, you\'re trying to submit a callout for a time in the past! Please verify that this is what you want to do!')
|
||||
await interaction.response.send_message(f'{user_nick}, you\'re trying to submit a break for a time in the past! Please verify that this is what you want to do!')
|
||||
except psycopg2.Error as e:
|
||||
await interaction.response.send_message(f'{user_nick} -- an error has occured!\nNotifying <@{CONTRASTELLAR}> of this error. Error is as follows --\n{e}')
|
||||
else:
|
||||
await interaction.response.send_message(f'{user_char_name} -- you added a callout for {callout_date} with reason: {reason}')
|
||||
await interaction.response.send_message(f'{user_char_name} -- you added a break for for {start_date} through {end_date}!')
|
||||
|
||||
|
||||
@client.tree.command()
|
||||
|
||||
Reference in New Issue
Block a user