Added fix so bot wont rerun tasks on connection loss + Added a fix so bot will show correct status after connection loss + Added notification when the tasks start
This commit is contained in:
parent
89ee8e1187
commit
a5708359dd
18
run.py
18
run.py
|
@ -25,7 +25,7 @@ def printhelp():
|
||||||
|
|
||||||
|
|
||||||
def printversion():
|
def printversion():
|
||||||
print("SheepBotFrame Beta 1.43")
|
print("SheepBotFrame Beta 1.44")
|
||||||
|
|
||||||
|
|
||||||
def remove_mention(m, s, i):
|
def remove_mention(m, s, i):
|
||||||
|
@ -36,6 +36,7 @@ def remove_mention(m, s, i):
|
||||||
|
|
||||||
|
|
||||||
async def download():
|
async def download():
|
||||||
|
print("Starting download...")
|
||||||
await bot.change_presence(activity=discord.Game(name=" downloading Message History"))
|
await bot.change_presence(activity=discord.Game(name=" downloading Message History"))
|
||||||
os.system("rm chatlogs/*.tmp.yml")
|
os.system("rm chatlogs/*.tmp.yml")
|
||||||
for trainchannel in config["trainchannels"]:
|
for trainchannel in config["trainchannels"]:
|
||||||
|
@ -51,6 +52,7 @@ async def download():
|
||||||
|
|
||||||
|
|
||||||
async def train():
|
async def train():
|
||||||
|
print("Starting training...")
|
||||||
await bot.change_presence(activity=discord.Game(name=" training, training and training..."))
|
await bot.change_presence(activity=discord.Game(name=" training, training and training..."))
|
||||||
corpustrainer = ChatterBotCorpusTrainer(chatbot)
|
corpustrainer = ChatterBotCorpusTrainer(chatbot)
|
||||||
listtrainer = ListTrainer(chatbot)
|
listtrainer = ListTrainer(chatbot)
|
||||||
|
@ -62,11 +64,8 @@ async def train():
|
||||||
listtrainer.train(log)
|
listtrainer.train(log)
|
||||||
|
|
||||||
|
|
||||||
@bot.event
|
async def startup():
|
||||||
async def on_ready():
|
|
||||||
await bot.change_presence(activity=discord.Game(name=" listening for messages!"))
|
|
||||||
global chatbot
|
global chatbot
|
||||||
print("Logged in!")
|
|
||||||
args = sys.argv
|
args = sys.argv
|
||||||
args.pop(0)
|
args.pop(0)
|
||||||
for arg in args:
|
for arg in args:
|
||||||
|
@ -100,6 +99,15 @@ async def on_ready():
|
||||||
global finished
|
global finished
|
||||||
finished = True
|
finished = True
|
||||||
print("Starting to listen to messages...")
|
print("Starting to listen to messages...")
|
||||||
|
await bot.change_presence(activity=discord.Game(name=" listening for messages!"))
|
||||||
|
|
||||||
|
|
||||||
|
@bot.event
|
||||||
|
async def on_ready():
|
||||||
|
await bot.change_presence(activity=discord.Game(name=" listening for messages!"))
|
||||||
|
print("Logged in!")
|
||||||
|
if not finished:
|
||||||
|
await startup()
|
||||||
|
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
|
|
Loading…
Reference in a new issue