diff --git a/badwords.py b/badwords.py index b5b2eaf..3f8194f 100644 --- a/badwords.py +++ b/badwords.py @@ -1 +1 @@ -slurList = ("fag", "faggot", "niga", "nigga", "nigger", "retard", "tard", "rtard", "coon") \ No newline at end of file +slurList = ("fag", "faggot", "niga", "nigga", "nigger", "retard", "tard", "rtard", "coon", "dghdtrhrsy65eu665") \ No newline at end of file diff --git a/twitch_script_standalone.py b/twitch_script_standalone.py index 921248d..f01f9ba 100644 --- a/twitch_script_standalone.py +++ b/twitch_script_standalone.py @@ -18,9 +18,6 @@ class Twitch_Module(): self.twitchCredential: credentials.Twitch_Credential 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.whitelisted_users: list = ["thecuriousnerd"] # 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): isBlocked = self.isChannel_inConfigList(self.chat.channel, config.block_TwitchChannelsMessaging) # print("isBlocked: " + str(isBlocked) + " for: " + self.chat.channel) + #if self. + if self.contains_slur(message): isBlocked = True + if self.cooldownModule.isCooldownActive( "twitchChat") == False and not isBlocked and not config.blockAll_TwitchChatChannelsMessaging: self.chat.send(message) @@ -125,27 +125,10 @@ class Twitch_Module(): if is_actionable: 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. - def contains_slur(self, message: twitch.chat.Message): + def contains_slur(self, message): containsSlur: bool = False - parsedMessage = message.text.split(" ") + parsedMessage = message.split(" ") for word in parsedMessage: for slur in config.slurList: if word.lower() == slur: @@ -154,17 +137,8 @@ class Twitch_Module(): if containsSlur: break - if containsSlur: - print("<{ slur detected! }> " + " [#" + message.channel + "](" + message.sender + ") used a slur in chat") 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): # print(channel) # print(selectedList) @@ -185,7 +159,7 @@ if __name__ == "__main__": credentials_manager = credentials.Credentials_Module() credentials_manager.load_credentials() 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: testModule.join_channel(None, twitchChannel)