Add remove_break command
This commit is contained in:
@@ -287,6 +287,24 @@ async def remove_callout(interaction: discord.Interaction, day: int, month: int,
|
|||||||
await interaction.response.send_message(f'{user_char_name} removed a callout for {callout_date}')
|
await interaction.response.send_message(f'{user_char_name} removed a callout for {callout_date}')
|
||||||
|
|
||||||
|
|
||||||
|
@client.tree.command()
|
||||||
|
async def remove_break(interaction: discord.Interaction, day: int, month: int, year: int) -> None:
|
||||||
|
delete_invalidate()
|
||||||
|
cleanup_invalidate()
|
||||||
|
user_id = interaction.user.id
|
||||||
|
user_char_name = DATABASE_CONN.return_char_name(user_id)
|
||||||
|
break_date: datetime.date = datetime.date(year=year, month=month, day=day)
|
||||||
|
|
||||||
|
try:
|
||||||
|
DATABASE_CONN.remove_break(user_id=user_id, break_date=break_date)
|
||||||
|
except psycopg2.Error:
|
||||||
|
await interaction.response.send_message(f'{user_char_name} -- no break was added for {break_date}')
|
||||||
|
else:
|
||||||
|
await interaction.response.send_message(f'{user_char_name} -- you removed the break starting on {break_date}')
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
@client.tree.command()
|
@client.tree.command()
|
||||||
async def schedule(interaction: discord.Interaction, days: int = DAYS_FOR_CALLOUTS) -> None:
|
async def schedule(interaction: discord.Interaction, days: int = DAYS_FOR_CALLOUTS) -> None:
|
||||||
delete_invalidate()
|
delete_invalidate()
|
||||||
|
|||||||
Reference in New Issue
Block a user