master updates #41

Manually merged
alex_orid merged 177 commits from master into github-master 2021-05-13 21:11:10 +00:00
Showing only changes of commit 7bb733cb6d - Show all commits

View File

@ -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