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

33 lines
789 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-12-02 22:56:11 +00:00
from ..commands import COMMANDS
2023-11-26 19:34:50 +00:00
from .config import CONFIG
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:
2023-11-26 19:34:50 +00:00
super().__init__(
intents=discord.Intents.default(),
activity=discord.CustomActivity(name=CONFIG.status),
)
2023-11-17 09:53:10 +00:00
2023-11-18 20:52:07 +00:00
self.tree = discord.app_commands.CommandTree(self)
2023-12-02 22:56:11 +00:00
for command in COMMANDS:
2023-11-19 23:43:50 +00:00
self.tree.add_command(command)
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-26 19:34:50 +00:00
await self.wait_until_ready()
if self.user is None:
return None
2023-11-17 09:53:10 +00:00
_logger.info(f"{self.user.name} has connected to Discord!")