mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-04-25 09:17:55 +02: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',
|
conf.registerChannelValue(Karma, 'allowUnaddressedKarma',
|
||||||
registry.Boolean(True, _("""Determines whether the bot will
|
registry.Boolean(True, _("""Determines whether the bot will
|
||||||
increase/decrease karma without being addressed.""")))
|
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:
|
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
||||||
|
@ -246,12 +246,13 @@ class Karma(callbacks.Plugin):
|
|||||||
def _doKarma(self, irc, msg, channel, thing):
|
def _doKarma(self, irc, msg, channel, thing):
|
||||||
inc = self.registryValue('incrementChars', channel)
|
inc = self.registryValue('incrementChars', channel)
|
||||||
dec = self.registryValue('decrementChars', channel)
|
dec = self.registryValue('decrementChars', channel)
|
||||||
|
onlynicks = self.registryValue('onlyNicks', channel)
|
||||||
karma = ''
|
karma = ''
|
||||||
for s in inc:
|
for s in inc:
|
||||||
if thing.endswith(s):
|
if thing.endswith(s):
|
||||||
thing = thing[:-len(s)]
|
thing = thing[:-len(s)]
|
||||||
# Don't reply if the target isn't a nick
|
# 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):
|
irc.state.channels[channel].users):
|
||||||
return
|
return
|
||||||
if ircutils.strEqual(thing, msg.nick) and \
|
if ircutils.strEqual(thing, msg.nick) and \
|
||||||
@ -263,7 +264,7 @@ class Karma(callbacks.Plugin):
|
|||||||
for s in dec:
|
for s in dec:
|
||||||
if thing.endswith(s):
|
if thing.endswith(s):
|
||||||
thing = thing[:-len(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):
|
irc.state.channels[channel].users):
|
||||||
return
|
return
|
||||||
if ircutils.strEqual(thing, msg.nick) and \
|
if ircutils.strEqual(thing, msg.nick) and \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user