Removing Old Stuff and Blocked bad words
This commit is contained in:
parent
6593c0fa94
commit
c400e1842b
@ -1 +1 @@
|
|||||||
slurList = ("fag", "faggot", "niga", "nigga", "nigger", "retard", "tard", "rtard", "coon")
|
slurList = ("fag", "faggot", "niga", "nigga", "nigger", "retard", "tard", "rtard", "coon", "dghdtrhrsy65eu665")
|
||||||
@ -18,9 +18,6 @@ class Twitch_Module():
|
|||||||
self.twitchCredential: credentials.Twitch_Credential
|
self.twitchCredential: credentials.Twitch_Credential
|
||||||
self.chat: twitch.Chat
|
self.chat: twitch.Chat
|
||||||
|
|
||||||
self.tts_enabled: bool = False
|
|
||||||
self.block_tts_url: bool = False
|
|
||||||
self.tts_whitelist_enabled: bool = False
|
|
||||||
self.block_chat_url: bool = True
|
self.block_chat_url: bool = True
|
||||||
self.whitelisted_users: list = ["thecuriousnerd"]
|
self.whitelisted_users: list = ["thecuriousnerd"]
|
||||||
# don't freak out, this is *merely* a regex for matching urls that will hit just about everything
|
# don't freak out, this is *merely* a regex for matching urls that will hit just about everything
|
||||||
@ -60,6 +57,9 @@ class Twitch_Module():
|
|||||||
def send_message(self, message):
|
def send_message(self, message):
|
||||||
isBlocked = self.isChannel_inConfigList(self.chat.channel, config.block_TwitchChannelsMessaging)
|
isBlocked = self.isChannel_inConfigList(self.chat.channel, config.block_TwitchChannelsMessaging)
|
||||||
# print("isBlocked: " + str(isBlocked) + " for: " + self.chat.channel)
|
# print("isBlocked: " + str(isBlocked) + " for: " + self.chat.channel)
|
||||||
|
#if self.
|
||||||
|
if self.contains_slur(message): isBlocked = True
|
||||||
|
|
||||||
if self.cooldownModule.isCooldownActive(
|
if self.cooldownModule.isCooldownActive(
|
||||||
"twitchChat") == False and not isBlocked and not config.blockAll_TwitchChatChannelsMessaging:
|
"twitchChat") == False and not isBlocked and not config.blockAll_TwitchChatChannelsMessaging:
|
||||||
self.chat.send(message)
|
self.chat.send(message)
|
||||||
@ -125,27 +125,10 @@ class Twitch_Module():
|
|||||||
if is_actionable:
|
if is_actionable:
|
||||||
self.exec_command(command, rest)
|
self.exec_command(command, rest)
|
||||||
|
|
||||||
# todo send get request
|
|
||||||
|
|
||||||
def contains_url(self, message: twitch.chat.Message):
|
|
||||||
containsURL = re.search(self._urlMatcher, message.text.lower()) is not None
|
|
||||||
if containsURL:
|
|
||||||
print("<{ link detected! }> " + " [#" + message.channel + "](" + message.sender + ") sent a link in chat")
|
|
||||||
return containsURL
|
|
||||||
|
|
||||||
# Checks if Sender is bot.
|
|
||||||
def isSenderBot(self, message: twitch.chat.Message):
|
|
||||||
isBot = False
|
|
||||||
for bot in config.botList:
|
|
||||||
if message.sender.lower() == bot.lower():
|
|
||||||
isBot = True
|
|
||||||
print("<{ bot detected! }> " + " [#" + message.channel + "](" + message.sender + ") is a bot")
|
|
||||||
return isBot
|
|
||||||
|
|
||||||
# Checks for basic slurs.
|
# Checks for basic slurs.
|
||||||
def contains_slur(self, message: twitch.chat.Message):
|
def contains_slur(self, message):
|
||||||
containsSlur: bool = False
|
containsSlur: bool = False
|
||||||
parsedMessage = message.text.split(" ")
|
parsedMessage = message.split(" ")
|
||||||
for word in parsedMessage:
|
for word in parsedMessage:
|
||||||
for slur in config.slurList:
|
for slur in config.slurList:
|
||||||
if word.lower() == slur:
|
if word.lower() == slur:
|
||||||
@ -154,17 +137,8 @@ class Twitch_Module():
|
|||||||
if containsSlur:
|
if containsSlur:
|
||||||
break
|
break
|
||||||
|
|
||||||
if containsSlur:
|
|
||||||
print("<{ slur detected! }> " + " [#" + message.channel + "](" + message.sender + ") used a slur in chat")
|
|
||||||
return containsSlur
|
return containsSlur
|
||||||
|
|
||||||
def isTTS_URL_Enabled(self, message: twitch.chat.Message):
|
|
||||||
is_ttsEnabled = False
|
|
||||||
if not config.blockAll_TTS_URL_Twitch or not self.block_tts_url:
|
|
||||||
if not self.contains_url(message):
|
|
||||||
is_ttsEnabled = True
|
|
||||||
return is_ttsEnabled
|
|
||||||
|
|
||||||
def isChannel_inConfigList(self, selectedChannel, selectedList):
|
def isChannel_inConfigList(self, selectedChannel, selectedList):
|
||||||
# print(channel)
|
# print(channel)
|
||||||
# print(selectedList)
|
# print(selectedList)
|
||||||
@ -185,7 +159,7 @@ if __name__ == "__main__":
|
|||||||
credentials_manager = credentials.Credentials_Module()
|
credentials_manager = credentials.Credentials_Module()
|
||||||
credentials_manager.load_credentials()
|
credentials_manager.load_credentials()
|
||||||
testModule.twitchCredential = credentials_manager.find_Twitch_Credential(config.credentialsNickname)
|
testModule.twitchCredential = credentials_manager.find_Twitch_Credential(config.credentialsNickname)
|
||||||
testModule.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname)
|
#testModule.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname)
|
||||||
|
|
||||||
for twitchChannel in config.autoJoin_TwitchChannels:
|
for twitchChannel in config.autoJoin_TwitchChannels:
|
||||||
testModule.join_channel(None, twitchChannel)
|
testModule.join_channel(None, twitchChannel)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user