changed logging. its still not working somehow. ill try to fix it.
This commit is contained in:
parent
7972b083c8
commit
7447c301dd
1 changed files with 10 additions and 6 deletions
16
pybot-f.py
16
pybot-f.py
|
@ -8,25 +8,29 @@ import typing
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger('discord')
|
# Logging
|
||||||
logger.setLevel(logging.DEBUG)
|
loghandler = logging.FileHandler(filename='pybot-f.log', encoding='utf-8', mode='w')
|
||||||
handler = logging.FileHandler(filename='discord.log', encoding='utf-8', mode='w')
|
|
||||||
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
|
|
||||||
logger.addHandler(handler)
|
|
||||||
|
|
||||||
|
# The bots' description
|
||||||
description = '''Testing this bot stuff :)'''
|
description = '''Testing this bot stuff :)'''
|
||||||
|
|
||||||
|
|
||||||
|
# Intents
|
||||||
intents = discord.Intents.default()
|
intents = discord.Intents.default()
|
||||||
intents.members = True
|
intents.members = True
|
||||||
intents.message_content = True
|
intents.message_content = True
|
||||||
|
|
||||||
|
|
||||||
# Config loading
|
# Config loading
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read('bot.ini')
|
config.read('bot.ini')
|
||||||
|
|
||||||
bottoken = config['General']['bottoken']
|
bottoken = config['General']['bottoken']
|
||||||
|
loglevel = logging.getLevelName(config['General']['loglevel'])
|
||||||
|
|
||||||
|
|
||||||
bot = commands.Bot(command_prefix='.', description=description, intents=intents)
|
# Setting up commands.Bot
|
||||||
|
bot = commands.Bot(command_prefix='.', description=description, intents=intents, log_handler=loghandler, log_level=loglevel)
|
||||||
|
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
|
|
Loading…
Add table
Reference in a new issue