Compare commits

..

3 Commits

Author SHA1 Message Date
c19125894f Edit contributing.md 2025-10-16 16:17:39 -06:00
b328d325f6 Edit the self_callouts interaction.followup 2025-10-16 16:13:19 -06:00
c563d745d1 Update try/except/else interaction responses 2025-10-16 16:11:24 -06:00
2 changed files with 6 additions and 9 deletions

View File

@@ -7,7 +7,7 @@ This is primarily open-source so that others can implement the code that we've w
Currently, we use GitHub actions to test the database portion of the codebase. It's a bit harder to test the Discord-centric commands otherwise.
## Submitting changes
Please send a [new GitHub Pull Request](https://github.com/contrastellar/raid-callouts/compare) with a clear list of what's been done!
Please send a [new Pull Request](https://git.contrastellar.com/contrastellar/raid-callouts/pulls) with a clear list of what's been done!
When you send in a Pull Request (PR), we'll be super happy if you've made tests or otherwise commented your code clearly with what it does, and what libraries it uses in addition to our base libraries!
Please always write a clear commit message for your commits. One-line messages are fine for smaller changes, but bigger changes should be more details!

View File

@@ -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()
@@ -310,7 +306,8 @@ async def self_callouts(interaction: discord.Interaction, days: int = 365) -> No
await interaction.response.defer(thinking=True)
callouts: list = DATABASE_CONN.query_self_callouts(user_id=uid, days=days)
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()