Defaults for all config options

master
Thor 3 years ago
parent 6ebf952dd8
commit 464350079c
  1. 19
      config.example.toml
  2. 12
      cringebot.py

@ -1,23 +1,24 @@
name = "cringebot" # Log name
#name = "cringebot"
# Enable OCR support for image attachments
#ocr = false
[defaults] [defaults]
# Name of the application as listed in the account settings on the server # Name of the application as listed in the account settings on the server
app_name = "Cringebot" #app_name = "Cringebot"
# Minimum seconds between requests to the server # Minimum seconds between requests to the server
rate_limit = 3 #rate_limit = 3
# Seconds between retrying failed requests to the server # Seconds between retrying failed requests to the server
retry_rate = 60 #retry_rate = 60
# Seconds between polling the server for updates # Seconds between polling the server for updates
poll_interval = 15 #poll_interval = 15
# Minutes until cringe statuses are deleted # Minutes until cringe statuses are deleted
max_age = 600 #max_age = 600
# Enable OCR support for image attachments
#ocr = false
[clients] [clients]
# The client name (in quotes below) is displayed in log messages, and is # The client name (in quotes below) is displayed in log messages, and is

@ -12,9 +12,12 @@ import html2text
import urllib import urllib
config_path = os.path.join(os.path.dirname(sys.argv[0]), "config.toml") config_path = os.path.join(os.path.dirname(sys.argv[0]), "config.toml")
loaded_config = toml.load(config_path) loaded_config = {
"name": "cringebot",
"ocr": False,
**toml.load(config_path)}
OCR = loaded_config.get("ocr", False) OCR = loaded_config["ocr"]
if OCR: if OCR:
from PIL import Image from PIL import Image
@ -40,6 +43,11 @@ TIME_OF_DAY = {
class CringeBotClient(BotClient): class CringeBotClient(BotClient):
def __init__(self, bot, config): def __init__(self, bot, config):
config = { config = {
"app_name": "Cringebot",
"rate_limit": 3,
"retry_rate": 60,
"poll_interval": 15,
"max_age": 600,
"db_dir": ".", "db_dir": ".",
"cringe_dir": "data/cringe", "cringe_dir": "data/cringe",
"based_dir": "data/based", "based_dir": "data/based",

Loading…
Cancel
Save