mirror of
https://gitlab.com/chicken-riders/RcGcDb.git
synced 2025-02-23 00:54:09 +00:00
whatever, i'm just testing
This commit is contained in:
parent
ac2abdefec
commit
dafc849321
10
src/bot.py
10
src/bot.py
|
@ -1,12 +1,20 @@
|
|||
import logging.config
|
||||
from src.config import settings
|
||||
import sqlite3
|
||||
from src.wiki import Wiki
|
||||
|
||||
logging.config.dictConfig(settings["logging"])
|
||||
logger = logging.getLogger("rcgcdb.bot")
|
||||
logger.debug("Current settings: {settings}".format(settings=settings))
|
||||
|
||||
# Fetch basic information about all of the wikis in the database
|
||||
conn = sqlite3.connect('rcgcdb.db')
|
||||
c = conn.cursor()
|
||||
|
||||
# Fetch basic information about all of the wikis in the database
|
||||
all_wikis = {}
|
||||
|
||||
for wiki in c.execute('SELECT * FROM wikis'):
|
||||
all_wikis[wiki[0]] = Wiki() # assign cached information
|
||||
|
||||
|
||||
# Start queueing logic
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import json, sys, logging
|
||||
|
||||
try: # load settings
|
||||
with open("settings.json") as sfile:
|
||||
with open("../settings.json") as sfile:
|
||||
settings = json.load(sfile)
|
||||
if "user-agent" in settings["header"]:
|
||||
settings["header"]["user-agent"] = settings["header"]["user-agent"].format(version="1.11") # set the version in the useragent
|
||||
settings["header"]["user-agent"] = settings["header"]["user-agent"].format(version="1.0") # set the version in the useragent
|
||||
except FileNotFoundError:
|
||||
logging.critical("No config file could be found. Please make sure settings.json is in the directory.")
|
||||
sys.exit(1)
|
|
@ -1,33 +0,0 @@
|
|||
{
|
||||
"header": {
|
||||
"user-agent": "RcGcDb/{version}"
|
||||
},
|
||||
"logging": {
|
||||
"version": 1,
|
||||
"disable_existing_loggers": false,
|
||||
"formatters": {
|
||||
"standard": {
|
||||
"format": "%(name)s - %(levelname)s: %(message)s"
|
||||
}
|
||||
},
|
||||
"handlers": {
|
||||
"default": {
|
||||
"formatter": "standard",
|
||||
"class": "logging.StreamHandler",
|
||||
"stream": "ext://sys.stdout"
|
||||
}
|
||||
},
|
||||
"loggers": {
|
||||
"": {
|
||||
"level": 0,
|
||||
"handlers": [
|
||||
"default"
|
||||
]
|
||||
},
|
||||
"rcgcdb": {},
|
||||
"rcgcdb.bot": {},
|
||||
"rcgcdb.config": {},
|
||||
"rcgcdb.discord": {}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +1,5 @@
|
|||
from dataclasses import dataclass
|
||||
|
||||
@dataclass
|
||||
class Wiki:
|
||||
fail_times: int = 0 # corresponding to amount of times connection with wiki failed for client reasons (400-499)
|
||||
|
|
Loading…
Reference in a new issue