v2 Standalone Docker Update #40
@ -108,29 +108,11 @@ class Discord_Module(discord.Client):
|
||||
async def send_message(self, message: discord.Message, response):
|
||||
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 not await self.contains_slur(response):
|
||||
if not utility.contains_slur(response):
|
||||
await message.channel.send(response)
|
||||
|
||||
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.
|
||||
async def isSenderBot(self, message: discord.Message):
|
||||
isBot = False
|
||||
|
||||
Loading…
Reference in New Issue
Block a user