Fixed finish checks so the bot doesnt react in wrong channels

This commit is contained in:
blackfur 2021-01-22 16:16:33 +01:00
parent 11feee7e66
commit a601800229

21
run.py
View file

@ -24,9 +24,9 @@ def printversion():
def remove_mention(m, s, i): def remove_mention(m, s, i):
if m == "s": if m == "s":
return s[0:i] + s[i+21:] return s[0:i] + s[i + 21:]
elif m == "l": elif m == "l":
return s[:i] + s[i+22:] return s[:i] + s[i + 22:]
async def download(): async def download():
@ -96,12 +96,12 @@ async def on_ready():
@bot.event @bot.event
async def on_message(message): async def on_message(message):
if finished: if message.author != bot.user:
if message.author != bot.user: if message.channel.id in config["usechannels"]:
if message.channel.id in config["usechannels"]: if message.content.startswith(config["excludeprefix"]):
if message.content.startswith(config["excludeprefix"]): return
return else:
else: if finished:
response = chatbot.get_response(message.content) response = chatbot.get_response(message.content)
response = response.__str__() response = response.__str__()
if config["filterpings"]: if config["filterpings"]:
@ -115,7 +115,8 @@ async def on_message(message):
position = response.find("<@") position = response.find("<@")
await message.channel.send(response) await message.channel.send(response)
print(f"Input was given: '{message.content}', this output was found: '{response}'") print(f"Input was given: '{message.content}', this output was found: '{response}'")
else: else:
await message.channel.send("Sorry, the Bot is still performing some tasks.") await message.channel.send("Sorry, the Bot is still performing some tasks.")
bot.run(config["token"]) bot.run(config["token"])