mirror of
https://code.lenaisten.de/Lenaisten/lenaverse-bot.git
synced 2024-11-22 15:03:01 +00:00
Jörn-Michael Miehe
d3b7a445c5
- remove files directory - remove git lfs - use `aiohttp` to fetch files
106 lines
2.4 KiB
Python
106 lines
2.4 KiB
Python
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="info",
|
|
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,
|
|
ephemeral=reply_private(interaction, "info"),
|
|
)
|
|
|
|
|
|
@ev_command(
|
|
name="linktree",
|
|
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, "linktree"),
|
|
)
|
|
|
|
|
|
@ev_command(
|
|
name="join",
|
|
description=CONFIG.ev_info.join.description,
|
|
)
|
|
async def join(interaction: discord.Interaction) -> None:
|
|
"""
|
|
Wie und warum dem Verein beitreten
|
|
"""
|
|
|
|
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,
|
|
ephemeral=reply_private(interaction, "join"),
|
|
)
|
|
|
|
else:
|
|
await interaction.response.send_message(
|
|
content=CONFIG.command_failed,
|
|
ephemeral=True,
|
|
)
|
|
|
|
|
|
@ev_command(
|
|
name="fest",
|
|
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,
|
|
ephemeral=reply_private(interaction, "fest"),
|
|
)
|
|
|
|
|
|
@ev_command(
|
|
name="aktion",
|
|
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,
|
|
ephemeral=reply_private(interaction, "aktion"),
|
|
)
|
|
|
|
|
|
COMMANDS = [
|
|
info,
|
|
linktree,
|
|
join,
|
|
fest,
|
|
aktion,
|
|
]
|