This commit is contained in:
Alex Orid 2021-04-21 17:49:58 -04:00
parent 7a4685da2c
commit 7bb733cb6d

View File

@ -108,29 +108,11 @@ class Discord_Module(discord.Client):
async def send_message(self, message: discord.Message, response): async def send_message(self, message: discord.Message, response):
isBlocked = await self.isChannel_inConfigList(str(message.channel.id), config.block_DiscordChannelsMessaging) isBlocked = await self.isChannel_inConfigList(str(message.channel.id), config.block_DiscordChannelsMessaging)
if self.cooldownModule.isCooldownActive("discordRateLimit") == False and not isBlocked and not config.blockAll_DiscordChannelsMessaging: if self.cooldownModule.isCooldownActive("discordRateLimit") == False and not isBlocked and not config.blockAll_DiscordChannelsMessaging:
if not await self.contains_slur(response): if not utility.contains_slur(response):
await message.channel.send(response) await message.channel.send(response)
self.cooldownModule.actionTrigger("discordRateLimit") self.cooldownModule.actionTrigger("discordRateLimit")
# Checks for basic slurs.
async def contains_slur(self, text):
containsSlur: bool = False
parsedMessage = text.split(" ")
for word in parsedMessage:
for slur in config.slurList:
if word.lower() == slur:
containsSlur = True
break # we want to immediately escape if we found a slur
if containsSlur:
break
if containsSlur:
print("<{ slur detected! }>")
#print("<{ slur detected! }> " + " [#" + message.channel + "](" + message.author.display_name + ") used a slur in chat")
return containsSlur
# Checks if Sender is bot. # Checks if Sender is bot.
async def isSenderBot(self, message: discord.Message): async def isSenderBot(self, message: discord.Message):
isBot = False isBot = False