|
|
|
@@ -263,17 +263,13 @@ async def add_break(interaction: discord.Interaction, start_day: int, start_mont
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
DATABASE_CONN.add_break(user_id=uid, break_start=start_date, break_end=end_date)
|
|
|
|
DATABASE_CONN.add_break(user_id=uid, break_start=start_date, break_end=end_date)
|
|
|
|
except UNIQUEVIOLATION:
|
|
|
|
except UNIQUEVIOLATION:
|
|
|
|
await interaction.response.send_message(f'{user_char_name} -- you have already added a callout for {callout_date} with reason: {reason}')
|
|
|
|
await interaction.response.send_message(f'{user_char_name} -- you have already added a break for {start_date} through {end_date}!')
|
|
|
|
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!')
|
|
|
|
|
|
|
|
except helper.db_helper.DateTimeError:
|
|
|
|
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:
|
|
|
|
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}')
|
|
|
|
await interaction.response.send_message(f'{user_nick} -- an error has occured!\nNotifying <@{CONTRASTELLAR}> of this error. Error is as follows --\n{e}')
|
|
|
|
else:
|
|
|
|
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()
|
|
|
|
@client.tree.command()
|
|
|
|
@@ -310,7 +306,8 @@ async def self_callouts(interaction: discord.Interaction, days: int = 365) -> No
|
|
|
|
await interaction.response.defer(thinking=True)
|
|
|
|
await interaction.response.defer(thinking=True)
|
|
|
|
callouts: list = DATABASE_CONN.query_self_callouts(user_id=uid, days=days)
|
|
|
|
callouts: list = DATABASE_CONN.query_self_callouts(user_id=uid, days=days)
|
|
|
|
callouts: str = DATABASE_CONN.formatted_list_of_callouts(callouts)
|
|
|
|
callouts: str = DATABASE_CONN.formatted_list_of_callouts(callouts)
|
|
|
|
await interaction.followup.send(f'Callouts for the next **{days}** for user **{DATABASE_CONN.return_char_name(uid)}**:\n{callouts}')
|
|
|
|
character_name: str = DATABASE_CONN.return_char_name(uid)
|
|
|
|
|
|
|
|
await interaction.followup.send(f'Callouts for the next **{days}** for user **{character_name}**:\n{callouts}')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
args: argparse.Namespace = parser.parse_args()
|
|
|
|
args: argparse.Namespace = parser.parse_args()
|
|
|
|
|