1
0
Fork 0
mirror of https://code.lenaisten.de/Lenaisten/lenaverse-bot.git synced 2024-11-22 23:13:01 +00:00
lenaverse-bot/lenaverse_bot/core/bot.py

31 lines
716 B
Python
Raw Normal View History

2023-11-17 09:53:10 +00:00
import logging
import discord
2023-11-17 10:49:50 +00:00
2023-11-19 15:27:10 +00:00
from .commands import lsstuff
from .post import post
2023-11-17 09:53:10 +00:00
_logger = logging.getLogger(__name__)
2023-11-18 20:52:07 +00:00
class LenaverseBot(discord.Client):
2023-11-17 09:53:10 +00:00
def __init__(self) -> None:
intents = discord.Intents.default()
intents.message_content = True
2023-11-18 20:52:07 +00:00
super().__init__(intents=intents)
2023-11-17 09:53:10 +00:00
2023-11-18 20:52:07 +00:00
self.tree = discord.app_commands.CommandTree(self)
self.tree.add_command(post)
2023-11-18 21:27:30 +00:00
self.tree.add_command(lsstuff)
2023-11-18 20:52:07 +00:00
async def setup_hook(self):
await self.tree.sync()
_logger.info("Commands synced")
2023-11-17 10:49:50 +00:00
2023-11-17 09:53:10 +00:00
async def on_ready(self) -> None:
2023-11-18 20:52:07 +00:00
if self.user is None:
return
2023-11-17 09:53:10 +00:00
_logger.info(f"{self.user.name} has connected to Discord!")