Updated logging

This commit is contained in:
cameron committed 2024-05-10 16:08:06 -04:00
1 parent a190e523d4
commit f0fc5b643a
3 files changed
+25 -19

No files matched your search

+6 -4
View File
@@ -11,23 +11,25 @@ class DankBot(discord.ext.commands.Bot):
plugin_files = glob.glob(os.path.join(plugin_path, '**', 'plugin.py'), recursive=True)
for plugin_file in plugin_files:
plugin_name = os.path.basename(os.path.dirname(plugin_file))
print(f"Loading plugin {plugin_name}")
logger.info(f"Loading plugin {plugin_name}")
await self.load_extension(f'plugins.{plugin_name}.plugin')
async def on_ready(self):
print(f'Logged on as {self.user}!')
logger.info(f'Logged on as {self.user}!')
await self.load_plugins()
await self.change_presence(activity=discord.Game("with the bots"))
async def on_message(self, message):
print(f'Message from {message.author}: {message.content}')
logger.info(f'Message from {message.author}: {message.content}')
await self.process_commands(message)
async def main():
intents = discord.Intents.default()
intents.message_content = True
intents.members = True
logging.basicConfig(level=logging.INFO)
discord.utils.setup_logging(level=logging.INFO, root=True)
global logger
logger = logging.getLogger("bot.main")
with open(".token") as token_file:
token = token_file.read()