Added Finish checks
This commit is contained in:
parent
d44a47df86
commit
f5a1db99fe
37
run.py
37
run.py
|
@ -89,27 +89,32 @@ async def on_ready():
|
||||||
print("Finished train!")
|
print("Finished train!")
|
||||||
else:
|
else:
|
||||||
chatbot = ChatBot(config["botname"])
|
chatbot = ChatBot(config["botname"])
|
||||||
|
global finished
|
||||||
|
finished = True
|
||||||
|
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
async def on_message(message):
|
async def on_message(message):
|
||||||
if message.author != bot.user:
|
if finished:
|
||||||
if message.channel.id in config["usechannels"]:
|
if message.author != bot.user:
|
||||||
if message.content.startswith(config["exclutionprefix"]):
|
if message.channel.id in config["usechannels"]:
|
||||||
return
|
if message.content.startswith(config["exclutionprefix"]):
|
||||||
else:
|
return
|
||||||
response = chatbot.get_response(message.content)
|
else:
|
||||||
response = response.__str__()
|
response = chatbot.get_response(message.content)
|
||||||
if config["filterpings"]:
|
response = response.__str__()
|
||||||
position = response.find("<@!")
|
if config["filterpings"]:
|
||||||
while position != -1:
|
|
||||||
response = remove_mention("l", response, position)
|
|
||||||
position = response.find("<@!")
|
position = response.find("<@!")
|
||||||
position = response.find("<@")
|
while position != -1:
|
||||||
while position != -1:
|
response = remove_mention("l", response, position)
|
||||||
response = remove_mention("s", response, position)
|
position = response.find("<@!")
|
||||||
position = response.find("<@")
|
position = response.find("<@")
|
||||||
await message.channel.send(response)
|
while position != -1:
|
||||||
print(f"Input was given: '{message.content}', this output was found: '{response}'")
|
response = remove_mention("s", response, position)
|
||||||
|
position = response.find("<@")
|
||||||
|
await message.channel.send(response)
|
||||||
|
print(f"Input was given: '{message.content}', this output was found: '{response}'")
|
||||||
|
else:
|
||||||
|
await message.channel.send("Sorry, the Bot is still performing some tasks.")
|
||||||
|
|
||||||
bot.run(config["token"])
|
bot.run(config["token"])
|
||||||
|
|
Loading…
Reference in a new issue