Jörn-Michael Miehe
876d8fe20a
- _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,
|
|
)
|