2024-03-23 10:45:48 +00:00
|
|
|
import os
|
|
|
|
import platform
|
|
|
|
|
2024-03-29 17:17:51 +00:00
|
|
|
import discord
|
2024-08-12 07:35:37 +00:00
|
|
|
from discord.ext import bridge
|
2024-07-17 12:01:12 +00:00
|
|
|
from loguru import logger
|
2024-03-23 10:45:48 +00:00
|
|
|
|
2024-07-19 19:42:19 +00:00
|
|
|
from lib.constants import CONST
|
2024-04-04 11:03:51 +00:00
|
|
|
|
2024-03-23 10:45:48 +00:00
|
|
|
|
2024-06-15 22:45:24 +00:00
|
|
|
class LumiBot(bridge.Bot):
|
2024-03-23 10:45:48 +00:00
|
|
|
async def on_ready(self):
|
2024-07-07 14:36:48 +00:00
|
|
|
"""
|
|
|
|
Called when the bot is ready.
|
|
|
|
|
|
|
|
Logs various information about the bot and the environment it is running on.
|
|
|
|
Note: This function isn't guaranteed to only be called once. The event is called when a RESUME request fails.
|
|
|
|
"""
|
2024-07-19 19:42:19 +00:00
|
|
|
logger.info(f"{CONST.TITLE} v{CONST.VERSION}")
|
2024-07-07 14:31:51 +00:00
|
|
|
logger.info(f"Logged in with ID {self.user.id if self.user else 'Unknown'}")
|
2024-06-20 18:57:45 +00:00
|
|
|
logger.info(f"discord.py API version: {discord.__version__}")
|
|
|
|
logger.info(f"Python version: {platform.python_version()}")
|
2024-06-21 20:00:31 +00:00
|
|
|
logger.info(f"Running on: {platform.system()} {platform.release()} ({os.name})")
|
2024-03-23 10:45:48 +00:00
|
|
|
|
2024-07-17 09:43:29 +00:00
|
|
|
if self.owner_ids:
|
|
|
|
for owner_id in self.owner_ids:
|
|
|
|
logger.info(f"Added bot admin: {owner_id}")
|
|
|
|
|
2024-07-07 14:36:48 +00:00
|
|
|
async def process_commands(self, message: discord.Message):
|
2024-03-23 10:45:48 +00:00
|
|
|
"""
|
2024-07-07 14:36:48 +00:00
|
|
|
Processes commands sent by users.
|
2024-03-23 10:45:48 +00:00
|
|
|
|
2024-07-07 14:36:48 +00:00
|
|
|
Args:
|
|
|
|
message (discord.Message): The message object containing the command.
|
|
|
|
"""
|
2024-03-28 19:53:14 +00:00
|
|
|
if message.author.bot:
|
|
|
|
return
|
|
|
|
|
|
|
|
ctx = await self.get_context(message)
|
|
|
|
|
2024-03-29 09:54:51 +00:00
|
|
|
if ctx.command:
|
2024-07-08 19:50:07 +00:00
|
|
|
# await ctx.trigger_typing()
|
2024-03-29 09:54:51 +00:00
|
|
|
await self.invoke(ctx)
|