import logging import discord from ._helpers import ev_command from .config import CONFIG _logger = logging.getLogger(__name__) def reply_private(interaction: discord.Interaction, name: str) -> bool: _logger.debug(f"User {interaction.user.name}({interaction.user.id}) used /{name}") return interaction.channel_id not in CONFIG.ev_info.channels @ev_command( name=CONFIG.ev_info.info.name, description=CONFIG.ev_info.info.description, ) async def info(interaction: discord.Interaction) -> None: """ Allgemeine Infos zum Verein """ await interaction.response.send_message( content=CONFIG.ev_info.info.content, suppress_embeds=True, ephemeral=reply_private(interaction, CONFIG.ev_info.info.name), ) @ev_command( name=CONFIG.ev_info.vorstand.name, description=CONFIG.ev_info.vorstand.description, ) async def vorstand(interaction: discord.Interaction) -> None: """ Wer ist im Vereinsvorstand? """ await interaction.response.send_message( content=CONFIG.ev_info.vorstand.content, silent=True, suppress_embeds=True, ephemeral=reply_private(interaction, CONFIG.ev_info.vorstand.name), ) @ev_command( name=CONFIG.ev_info.linktree.name, description=CONFIG.ev_info.linktree.description, ) async def linktree(interaction: discord.Interaction) -> None: """ Links rund um den Verein """ await interaction.response.send_message( content=CONFIG.ev_info.linktree.content, suppress_embeds=True, ephemeral=reply_private(interaction, CONFIG.ev_info.linktree.name), ) @ev_command( name=CONFIG.ev_info.beitreten.name, description=CONFIG.ev_info.beitreten.description, ) async def beitreten(interaction: discord.Interaction) -> None: """ Wie und warum dem Verein beitreten """ if (file := await CONFIG.ev_info.beitreten.as_discord_file) is not None: await interaction.response.send_message( content=CONFIG.ev_info.beitreten.content, file=file, suppress_embeds=True, ephemeral=reply_private(interaction, CONFIG.ev_info.beitreten.name), ) else: await interaction.response.send_message( content=CONFIG.command_failed, ephemeral=True, ) @ev_command( name=CONFIG.ev_info.fest.name, description=CONFIG.ev_info.fest.description, ) async def fest(interaction: discord.Interaction) -> None: """ Infos zum nächsten Vereinsfest """ await interaction.response.send_message( content=CONFIG.ev_info.fest.content, suppress_embeds=True, ephemeral=reply_private(interaction, CONFIG.ev_info.fest.name), ) @ev_command( name=CONFIG.ev_info.aktion.name, description=CONFIG.ev_info.aktion.description, ) async def aktion(interaction: discord.Interaction) -> None: """ Infos zu aktuellen Aktionen """ await interaction.response.send_message( content=CONFIG.ev_info.aktion.content, suppress_embeds=True, ephemeral=reply_private(interaction, CONFIG.ev_info.aktion.name), ) COMMANDS = [ info, vorstand, linktree, beitreten, fest, aktion, ]