46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
import logging
|
|
from pathlib import Path
|
|
|
|
import discord
|
|
|
|
from lenaverse_bot import __file__ as module_file
|
|
|
|
from .config import CONFIG
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
def get_files_path() -> Path:
|
|
module_path = Path(module_file)
|
|
|
|
if module_path.is_file():
|
|
module_path = module_path.parent
|
|
|
|
result = module_path / "files"
|
|
assert result.is_dir()
|
|
|
|
return result
|
|
|
|
|
|
@discord.app_commands.command()
|
|
async def ev_linktree(interaction: discord.Interaction) -> None:
|
|
_logger.debug(f"User {interaction.user.name}({interaction.user.id}) used /linktree")
|
|
await interaction.response.send_message(
|
|
content=CONFIG.ev_info.linktree.strip(),
|
|
suppress_embeds=True,
|
|
)
|
|
|
|
|
|
@discord.app_commands.command()
|
|
async def ev_join(interaction: discord.Interaction) -> None:
|
|
_logger.debug(f"User {interaction.user.name}({interaction.user.id}) used /join")
|
|
await interaction.response.send_message(
|
|
content=CONFIG.ev_info.join_message.strip(),
|
|
file=discord.File(get_files_path() / CONFIG.ev_info.join_file),
|
|
)
|
|
|
|
|
|
COMMANDS = [
|
|
ev_linktree,
|
|
ev_join,
|
|
]
|