lenaverse-bot/lenaverse_bot/core/bot.py

30 lines
686 B
Python

import logging
import discord
from .commands import post
_logger = logging.getLogger(__name__)
class LenaverseBot(discord.Client):
def __init__(self) -> None:
intents = discord.Intents.default()
intents.message_content = True
super().__init__(intents=intents)
self.tree = discord.app_commands.CommandTree(self)
self.tree.add_command(post)
async def setup_hook(self):
await self.tree.sync()
_logger.info("Commands synced")
async def on_ready(self) -> None:
_logger.info(self.guilds)
if self.user is None:
return
_logger.info(f"{self.user.name} has connected to Discord!")