From ad7350b4c17406fde2a6efc0c8c185ba56f55f03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Fri, 17 Nov 2023 11:49:50 +0100 Subject: [PATCH] dummy commands --- lenaverse_bot/core/bot.py | 10 ++++++++-- lenaverse_bot/core/commands.py | 11 +++++++++++ lenaverse_bot/main.py | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 lenaverse_bot/core/commands.py diff --git a/lenaverse_bot/core/bot.py b/lenaverse_bot/core/bot.py index 3145a41..c51fc4f 100644 --- a/lenaverse_bot/core/bot.py +++ b/lenaverse_bot/core/bot.py @@ -1,12 +1,14 @@ import logging import discord -from discord.ext import commands +from discord.ext.commands import Bot + +from .commands import foo, ping _logger = logging.getLogger(__name__) -class LenaverseBot(commands.Bot): +class LenaverseBot(Bot): def __init__(self) -> None: intents = discord.Intents.default() intents.message_content = True @@ -16,6 +18,10 @@ class LenaverseBot(commands.Bot): intents=intents, ) + self.add_command(ping) + self.add_command(foo) + async def on_ready(self) -> None: + _logger.info(self.guilds) assert self.user is not None _logger.info(f"{self.user.name} has connected to Discord!") diff --git a/lenaverse_bot/core/commands.py b/lenaverse_bot/core/commands.py new file mode 100644 index 0000000..66e5c4c --- /dev/null +++ b/lenaverse_bot/core/commands.py @@ -0,0 +1,11 @@ +from discord.ext import commands + + +@commands.hybrid_command() +async def ping(ctx: commands.Context): + await ctx.send("pong") + + +@commands.hybrid_command() +async def foo(ctx: commands.Context, arg: str): + await ctx.send(arg) diff --git a/lenaverse_bot/main.py b/lenaverse_bot/main.py index 02523ce..b76b672 100644 --- a/lenaverse_bot/main.py +++ b/lenaverse_bot/main.py @@ -4,7 +4,7 @@ from .core.bot import LenaverseBot def main() -> None: - TOKEN = os.getenv("TTSBOT_TOKEN") or "" + TOKEN = os.getenv("TTSBOT_TOKEN", "") bot = LenaverseBot() bot.run(