2023-11-19 23:26:23 +00:00
|
|
|
import logging
|
|
|
|
|
|
|
|
import discord
|
|
|
|
|
2023-11-20 13:29:39 +00:00
|
|
|
from ._helpers import ev_command
|
2023-11-19 23:26:23 +00:00
|
|
|
from .config import CONFIG
|
|
|
|
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
2023-11-20 12:37:36 +00:00
|
|
|
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
|
2023-11-19 23:26:23 +00:00
|
|
|
|
|
|
|
|
2023-11-20 12:55:20 +00:00
|
|
|
@ev_command(
|
2023-11-20 13:32:00 +00:00
|
|
|
name=CONFIG.ev_info.info.description,
|
2023-11-20 12:55:20 +00:00
|
|
|
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,
|
2023-11-20 13:32:00 +00:00
|
|
|
ephemeral=reply_private(interaction, CONFIG.ev_info.info.description),
|
2023-11-20 12:55:20 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-11-20 12:37:36 +00:00
|
|
|
@ev_command(
|
2023-11-20 13:32:00 +00:00
|
|
|
name=CONFIG.ev_info.linktree.description,
|
2023-11-20 12:37:36 +00:00
|
|
|
description=CONFIG.ev_info.linktree.description,
|
|
|
|
)
|
|
|
|
async def linktree(interaction: discord.Interaction) -> None:
|
|
|
|
"""
|
|
|
|
Links rund um den Verein
|
|
|
|
"""
|
2023-11-19 23:26:23 +00:00
|
|
|
|
|
|
|
await interaction.response.send_message(
|
2023-11-20 12:37:36 +00:00
|
|
|
content=CONFIG.ev_info.linktree.content,
|
2023-11-19 23:26:23 +00:00
|
|
|
suppress_embeds=True,
|
2023-11-20 13:32:00 +00:00
|
|
|
ephemeral=reply_private(interaction, CONFIG.ev_info.linktree.description),
|
2023-11-19 23:26:23 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-11-20 12:37:36 +00:00
|
|
|
@ev_command(
|
2023-11-20 13:32:00 +00:00
|
|
|
name=CONFIG.ev_info.join.description,
|
2023-11-20 12:37:36 +00:00
|
|
|
description=CONFIG.ev_info.join.description,
|
|
|
|
)
|
|
|
|
async def join(interaction: discord.Interaction) -> None:
|
|
|
|
"""
|
|
|
|
Wie und warum dem Verein beitreten
|
|
|
|
"""
|
|
|
|
|
2023-11-20 13:29:39 +00:00
|
|
|
if (file := await CONFIG.ev_info.join.as_discord_file) is not None:
|
|
|
|
await interaction.response.send_message(
|
|
|
|
content=CONFIG.ev_info.join.content,
|
|
|
|
file=file,
|
2023-11-20 13:32:00 +00:00
|
|
|
ephemeral=reply_private(interaction, CONFIG.ev_info.join.description),
|
2023-11-20 13:29:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
else:
|
|
|
|
await interaction.response.send_message(
|
|
|
|
content=CONFIG.command_failed,
|
|
|
|
ephemeral=True,
|
|
|
|
)
|
2023-11-19 23:43:50 +00:00
|
|
|
|
|
|
|
|
2023-11-20 12:55:20 +00:00
|
|
|
@ev_command(
|
2023-11-20 13:32:00 +00:00
|
|
|
name=CONFIG.ev_info.fest.description,
|
2023-11-20 12:55:20 +00:00
|
|
|
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,
|
2023-11-20 13:32:00 +00:00
|
|
|
ephemeral=reply_private(interaction, CONFIG.ev_info.fest.description),
|
2023-11-20 12:55:20 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@ev_command(
|
2023-11-20 13:32:00 +00:00
|
|
|
name=CONFIG.ev_info.aktion.description,
|
2023-11-20 12:55:20 +00:00
|
|
|
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,
|
2023-11-20 13:32:00 +00:00
|
|
|
ephemeral=reply_private(interaction, CONFIG.ev_info.aktion.description),
|
2023-11-20 12:55:20 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-11-19 23:43:50 +00:00
|
|
|
COMMANDS = [
|
2023-11-20 12:55:20 +00:00
|
|
|
info,
|
2023-11-20 12:37:36 +00:00
|
|
|
linktree,
|
|
|
|
join,
|
2023-11-20 12:55:20 +00:00
|
|
|
fest,
|
|
|
|
aktion,
|
2023-11-19 23:43:50 +00:00
|
|
|
]
|