mirror of
https://github.com/Xevion/contest-assistant.git
synced 2025-12-06 07:14:36 -06:00
switch to bot commands extension style bot setup
This commit is contained in:
17
main.py
17
main.py
@@ -1,19 +1,26 @@
|
||||
import logging
|
||||
|
||||
from contest import client, constants
|
||||
from contest import constants
|
||||
from contest.bot import ContestBot
|
||||
|
||||
if __name__ == "__main__":
|
||||
bot = client.ContestClient()
|
||||
|
||||
logger = logging.getLogger(__file__)
|
||||
logger.setLevel(constants.LOGGING_LEVEL)
|
||||
|
||||
# noinspection PyArgumentList
|
||||
logging.basicConfig(format='[%(asctime)s] [%(levelname)s] [%(funcName)s] %(message)s',
|
||||
handlers=[
|
||||
logging.FileHandler(f"bot.log", encoding='utf-8'),
|
||||
logging.StreamHandler()
|
||||
])
|
||||
|
||||
logger.info('Starting bot.')
|
||||
initial_extensions = ['contest.cogs.contest']
|
||||
|
||||
bot = ContestBot(description='A assistant for the Photography Lounge\'s monday contests')
|
||||
|
||||
for extension in initial_extensions:
|
||||
bot.load_extension(extension)
|
||||
|
||||
logger.info('Starting bot...')
|
||||
with open('token.dat', 'r') as file:
|
||||
bot.run(file.read())
|
||||
bot.run(file.read(), bot=True, reconnect=True)
|
||||
|
||||
Reference in New Issue
Block a user