"""Contains commands for time commands.""" from datetime import UTC, datetime import nextcord from nextcord.ext import commands from utils import GUILDS class TimeCog(commands.Cog, name="Time Commands"): """Class holds time commands.""" @nextcord.slash_command(guild_ids=GUILDS) async def time(self, interaction: nextcord.Interaction) -> None: """Parent slash command. Never called.""" @time.subcommand(description="1") async def at(self, interaction: nextcord.Interaction) -> None: pass @time.subcommand(description="1") async def at_gametime(self, interaction: nextcord.Interaction) -> None: pass @time.subcommand(description="Get the current time in game.") async def gametime( self, interaction: nextcord.Interaction, ephemeral: bool = nextcord.SlashOption( # noqa: FBT001 required=False, default=True, description="Whether the replying message will be public or not." ), ) -> None: """ Replies with the current time in game. Args: interaction (nextcord.Interaction): Interaction with the command. ephemeral: (bool): Whether the response is ephemeral or not. """ gametime = datetime.now(tz=UTC) await interaction.response.send_message(content=f"{gametime.hour}:{gametime.minute}", ephemeral=ephemeral)