mirror of
https://code.lenaisten.de/Lenaisten/lenaverse-bot.git
synced 2024-11-22 15:03:01 +00:00
Jörn-Michael Miehe
64cb7bd5a9
- _helpers.ev_command respects CONFIG.command_prefix - restrict public replies to channel ids
31 lines
624 B
Python
31 lines
624 B
Python
from pathlib import Path
|
|
|
|
import discord
|
|
from discord.app_commands import locale_str
|
|
from discord.utils import MISSING
|
|
|
|
from lenaverse_bot import __file__ as module_file
|
|
|
|
from .config import CONFIG
|
|
|
|
|
|
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
|
|
|
|
|
|
def ev_command(
|
|
name: str,
|
|
description: str | locale_str = MISSING,
|
|
):
|
|
return discord.app_commands.command(
|
|
name=CONFIG.command_prefix + name,
|
|
description=description,
|
|
)
|