Changed Config to a extern file based system

This commit is contained in:
blackfur 2021-01-17 18:58:50 +01:00
parent 8510ff5f6a
commit 1719185eef
2 changed files with 6 additions and 14 deletions

4
.gitignore vendored
View file

@ -4,8 +4,8 @@
# Exclude VENV
venv/
# Exclude ChatLogs, DataBases and the API Token
# Exclude ChatLogs, DataBases and the Config
chatlogs/
db.sqlite3
token
config.yml

16
run.py
View file

@ -1,4 +1,3 @@
# DO NOT CHANGE THIS
import os
import sys
import yaml
@ -6,16 +5,8 @@ import discord
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer, ListTrainer
# Change this to set the settings
config = {"botname": "Sheepy",
"filterpings": True,
"usechannels": [717758904527880253, 772839872557088769, 773980809471197235],
"trainchannels": [[492412566430154783, 1000], [761462125696385047, 1000]],
"corpus": ["chatterbot.corpus.english"]}
# DO NOT CHANGE THIS
with open("token", "r") as tokenfile:
token = tokenfile.read()
with open("config.yml", "r") as file:
config = yaml.load(file)
bot = discord.Client()
@ -89,6 +80,7 @@ async def on_ready():
await train()
print("Finished train!")
else:
global chatbot
chatbot = ChatBot(config["botname"])
bot.run(token)
bot.run(config["token"])