Connect to db on bot start. Remove message map.
This commit is contained in:
+7
-11
@@ -1,16 +1,16 @@
|
||||
"""
|
||||
main file for pvm-highscores bot
|
||||
main file for highscores bot
|
||||
"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
from nextcord.ext import commands
|
||||
import mysql.connector
|
||||
import nextcord
|
||||
from nextcord.ext import commands
|
||||
|
||||
import config
|
||||
from classes.highscores_data import HighscoresData
|
||||
from classes.submission import SubmissionMap
|
||||
|
||||
logger = logging.getLogger("nextcord")
|
||||
@@ -19,14 +19,10 @@ handler = logging.FileHandler(filename="nextcord.log", encoding="utf-8", mode="w
|
||||
handler.setFormatter(logging.Formatter("%(asctime)s:%(levelname)s:%(name)s: %(message)s"))
|
||||
logger.addHandler(handler)
|
||||
|
||||
|
||||
highscores_data: HighscoresData = HighscoresData()
|
||||
highscores_message_map = {}
|
||||
|
||||
for guild in highscores_data.guilds:
|
||||
highscores_message_map[guild.guild_id] = {}
|
||||
for table in guild.tables:
|
||||
highscores_message_map[guild.guild_id][table.message_id] = table.name
|
||||
highscores_db = mysql.connector.connect(
|
||||
host=config.SQL_HOST, user=config.SQL_USER, password=config.SQL_PASS, database=config.SQL_DB
|
||||
)
|
||||
highscores_cursor = highscores_db.cursor()
|
||||
|
||||
submission_objects: SubmissionMap = SubmissionMap()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user