Add ability to exclude channel from self censoring (#1508)

This commit is contained in:
SamStrongTalks 2022-06-17 10:44:12 -04:00 committed by GitHub
parent 6379a9d43a
commit d04e8161d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View File

@ -113,6 +113,9 @@ conf.registerGlobalValue(BadWords, 'stripFormatting',
filtering. If it's True, however, it will interact poorly with other
plugins that do coloring or bolding of text.""")))
conf.registerChannelValue(BadWords, 'selfCensor',
registry.Boolean(True, _("""Determines whether the bot will filter its own
messages.""")))
conf.registerChannelValue(BadWords, 'kick',
registry.Boolean(False, _("""Determines whether the bot will kick people with
a warning when they use bad words.""")))

View File

@ -81,18 +81,24 @@ msgstr ""
#: config.py:117
msgid ""
"Determines whether the bot will filter its own\n"
" messages."
msgstr ""
#: config.py:120
msgid ""
"Determines whether the bot will kick people with\n"
" a warning when they use bad words."
msgstr ""
#: config.py:120
#: config.py:123
msgid ""
"You have been kicked for using a word\n"
" prohibited in the presence of this bot. Please use more appropriate\n"
" language in the future."
msgstr ""
#: config.py:122
#: config.py:125
msgid ""
"Determines the kick message used by the\n"
" bot when kicking users for saying bad words."

View File

@ -104,9 +104,10 @@ class BadWords(callbacks.Privmsg):
self.lastModified = time.time()
def outFilter(self, irc, msg):
channel = msg.channel
if self.filtering and msg.command == 'PRIVMSG' \
and (self.words() or self.phrases()):
channel = msg.channel
and (self.words() or self.phrases()) \
and self.registryValue('selfCensor', channel, irc.network):
self.updateRegexp(channel, irc.network)
s = msg.args[1]
if self.registryValue('stripFormatting'):