From 5a630aff264e90a86fdff5a812c5b09f85b46257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Fri, 17 Nov 2023 10:53:10 +0100 Subject: [PATCH] empty discord bot --- lenaverse_bot/__init__.py | 3 +++ lenaverse_bot/core/bot.py | 21 +++++++++++++++++++++ lenaverse_bot/main.py | 13 ++++++++++++- 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 lenaverse_bot/__init__.py create mode 100644 lenaverse_bot/core/bot.py diff --git a/lenaverse_bot/__init__.py b/lenaverse_bot/__init__.py new file mode 100644 index 0000000..47e8cfc --- /dev/null +++ b/lenaverse_bot/__init__.py @@ -0,0 +1,3 @@ +import discord + +discord.utils.setup_logging() diff --git a/lenaverse_bot/core/bot.py b/lenaverse_bot/core/bot.py new file mode 100644 index 0000000..3145a41 --- /dev/null +++ b/lenaverse_bot/core/bot.py @@ -0,0 +1,21 @@ +import logging + +import discord +from discord.ext import commands + +_logger = logging.getLogger(__name__) + + +class LenaverseBot(commands.Bot): + def __init__(self) -> None: + intents = discord.Intents.default() + intents.message_content = True + + super().__init__( + command_prefix="!", + intents=intents, + ) + + async def on_ready(self) -> None: + assert self.user is not None + _logger.info(f"{self.user.name} has connected to Discord!") diff --git a/lenaverse_bot/main.py b/lenaverse_bot/main.py index 002a34a..02523ce 100644 --- a/lenaverse_bot/main.py +++ b/lenaverse_bot/main.py @@ -1,5 +1,16 @@ +import os + +from .core.bot import LenaverseBot + + def main() -> None: - print("Hello World") + TOKEN = os.getenv("TTSBOT_TOKEN") or "" + + bot = LenaverseBot() + bot.run( + token=TOKEN, + log_handler=None, + ) if __name__ == "__main__":