mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 20:59:27 +01:00
Karma: make onlyNicks a config option
Conflicts: plugins/Karma/plugin.py
This commit is contained in:
parent
4729213898
commit
bc7430cce4
@ -66,5 +66,8 @@ conf.registerChannelValue(Karma, 'allowSelfRating',
|
||||
conf.registerChannelValue(Karma, 'allowUnaddressedKarma',
|
||||
registry.Boolean(True, _("""Determines whether the bot will
|
||||
increase/decrease karma without being addressed.""")))
|
||||
conf.registerChannelValue(Karma, 'onlyNicks',
|
||||
registry.Boolean(False, _("""Determines whether the bot will
|
||||
only increase/decrease karma for nicks in the current channel.""")))
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
||||
|
@ -246,12 +246,13 @@ class Karma(callbacks.Plugin):
|
||||
def _doKarma(self, irc, msg, channel, thing):
|
||||
inc = self.registryValue('incrementChars', channel)
|
||||
dec = self.registryValue('decrementChars', channel)
|
||||
onlynicks = self.registryValue('onlyNicks', channel)
|
||||
karma = ''
|
||||
for s in inc:
|
||||
if thing.endswith(s):
|
||||
thing = thing[:-len(s)]
|
||||
# Don't reply if the target isn't a nick
|
||||
if thing.lower() not in map(ircutils.toLower,
|
||||
if onlynicks and thing.lower() not in map(ircutils.toLower,
|
||||
irc.state.channels[channel].users):
|
||||
return
|
||||
if ircutils.strEqual(thing, msg.nick) and \
|
||||
@ -263,7 +264,7 @@ class Karma(callbacks.Plugin):
|
||||
for s in dec:
|
||||
if thing.endswith(s):
|
||||
thing = thing[:-len(s)]
|
||||
if thing.lower() not in map(ircutils.toLower,
|
||||
if onlynicks and thing.lower() not in map(ircutils.toLower,
|
||||
irc.state.channels[channel].users):
|
||||
return
|
||||
if ircutils.strEqual(thing, msg.nick) and \
|
||||
|
Loading…
Reference in New Issue
Block a user