Fixed global declaration of "chatbot" var

This commit is contained in:
blackfur 2021-01-17 19:20:33 +01:00
parent d3e004deaa
commit 67c473d7f0
2 changed files with 1 additions and 3 deletions

View file

@ -1 +0,0 @@
["Hello", "Hi"]

3
run.py
View file

@ -49,6 +49,7 @@ async def train():
@bot.event @bot.event
async def on_ready(): async def on_ready():
global chatbot
print("Logged in!") print("Logged in!")
args = sys.argv args = sys.argv
args.pop(0) args.pop(0)
@ -75,12 +76,10 @@ async def on_ready():
print("Finished download!") print("Finished download!")
if tasks[1]: if tasks[1]:
os.system("rm db.sqlite3") os.system("rm db.sqlite3")
global chatbot
chatbot = ChatBot(config["botname"]) chatbot = ChatBot(config["botname"])
await train() await train()
print("Finished train!") print("Finished train!")
else: else:
global chatbot
chatbot = ChatBot(config["botname"]) chatbot = ChatBot(config["botname"])
bot.run(config["token"]) bot.run(config["token"])