diff options
| author | Tradam <[email protected]> | 2020-05-12 00:17:23 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-05-12 00:17:23 -0400 |
| commit | c0f9d8c858e5e9763c686ae7f758981584696851 (patch) | |
| tree | 7729be3f29549917ccbdc38ae9ba78b9cbc88ce0 | |
| parent | 4a03fcf2ab289be2a68533b1e674269c55c81410 (diff) | |
| download | FelicityBot-c0f9d8c858e5e9763c686ae7f758981584696851.tar.gz FelicityBot-c0f9d8c858e5e9763c686ae7f758981584696851.zip | |
| -rw-r--r-- | FelicityBot.py | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/FelicityBot.py b/FelicityBot.py index b07f9a1..e039e94 100644 --- a/FelicityBot.py +++ b/FelicityBot.py @@ -238,20 +238,17 @@ async def on_message(message): #If it does then it will replace it, and resend the message on behalf of the user # while also deleting the original users message #To identify the original user who sent the message, it also @'s them - #To prevent the bot from unintentionally hijacking messages on others servers, set it - # to only work on your unique server - if str(message.guild.id) == str(UNIQUE_SERVER): - modifiedMessage = message.content - switchFlag = 0 #A flag that determines of a match was made, and if the users message should be replaced - for key in animatedEmoji: - matchCheck = re.search(re.escape(key), message.content, flags=re.I)#Check if the message has a replacable emoji - if (str(matchCheck) != "None"): - modifiedMessage = re.sub(re.escape(key), animatedEmoji[key], modifiedMessage, flags=re.I) - switchFlag = 1#sets a flag that a match was made, and should replace the message - if switchFlag == 1:#ONLY replace if a match was found - await message.channel.send('<@{}>:'.format(message.author.id)) - await message.delete() - await message.channel.send(modifiedMessage) + modifiedMessage = message.content + switchFlag = 0 #A flag that determines of a match was made, and if the users message should be replaced + for key in animatedEmoji: + matchCheck = re.search(re.escape(key), message.content, flags=re.I)#Check if the message has a replacable emoji + if (str(matchCheck) != "None"): + modifiedMessage = re.sub(re.escape(key), animatedEmoji[key], modifiedMessage, flags=re.I) + switchFlag = 1#sets a flag that a match was made, and should replace the message + if switchFlag == 1:#ONLY replace if a match was found + await message.channel.send('<@{}>:'.format(message.author.id)) + await message.delete() + await message.channel.send(modifiedMessage) |
