Finish up smells in the commands directory.
Add a discord max message length constant. Move boolean argument to not be positional.
This commit is contained in:
+8
-16
@@ -1,6 +1,4 @@
|
||||
"""
|
||||
Contains commands and views for set commands.
|
||||
"""
|
||||
"""Contains commands and views for set commands."""
|
||||
|
||||
from datetime import UTC, datetime
|
||||
|
||||
@@ -14,21 +12,15 @@ from database_setup.sql_data_classes import UserBirthday, engine
|
||||
from main import birthday_list
|
||||
|
||||
|
||||
class setCog(commands.Cog, name="Set Commands"):
|
||||
"""
|
||||
Class holds set commands.
|
||||
"""
|
||||
class SetCog(commands.Cog, name="Set Commands"):
|
||||
"""Class holds set commands."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""
|
||||
Default constructor for SetCog class. Does nothing.
|
||||
"""
|
||||
"""Default constructor for SetCog class. Does nothing."""
|
||||
|
||||
@nextcord.slash_command()
|
||||
async def set(self, interaction: nextcord.Interaction):
|
||||
"""
|
||||
Parent slash command for set. Never called.
|
||||
"""
|
||||
async def set(self, interaction: nextcord.Interaction) -> None:
|
||||
"""Parent slash command for set. Never called."""
|
||||
|
||||
@set.subcommand(description="Sets your birth month and day for the Birthday Fun. Use 0/0 to remove yourself.")
|
||||
async def birthday(
|
||||
@@ -36,7 +28,7 @@ class setCog(commands.Cog, name="Set Commands"):
|
||||
interaction: nextcord.Interaction,
|
||||
month: int = nextcord.SlashOption(required=True, min_value=0, max_value=12, description="Your birth month."),
|
||||
day: int = nextcord.SlashOption(required=True, min_value=0, max_value=31, description="Your birth day."),
|
||||
):
|
||||
) -> None:
|
||||
"""
|
||||
Sets a user's birthday in the database. Removes on input 0/0. If birthday is today, adds to the birthday_list.
|
||||
|
||||
@@ -59,7 +51,7 @@ class setCog(commands.Cog, name="Set Commands"):
|
||||
# check if valid day
|
||||
today = datetime.now(tz=UTC).date()
|
||||
try:
|
||||
birthday = datetime(today.year, month, day)
|
||||
birthday = datetime(today.year, month, day, tzinfo=UTC)
|
||||
except ValueError:
|
||||
await interaction.followup.send(f"Invalid date: {month}/{day}.", ephemeral=True)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user