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(