mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 10:34:19 +01:00
Added RFE #859119, configurable karma response.
This commit is contained in:
parent
54102ae5f7
commit
2ba68353dd
@ -39,6 +39,7 @@ import os
|
||||
import sets
|
||||
from itertools import imap
|
||||
|
||||
import conf
|
||||
import utils
|
||||
import plugins
|
||||
import privmsgs
|
||||
@ -67,7 +68,10 @@ class Karma(callbacks.PrivmsgCommandAndRegexp,
|
||||
[('simple-output', configurable.BoolType, False,
|
||||
"""Determines whether the bot will output shorter versions of the
|
||||
karma output when requesting a single thing's karma. (example: 'foo:
|
||||
1')""")]
|
||||
1')"""),
|
||||
('karma-response', configurable.BoolType, False,
|
||||
"""Determines whether the bot will reply with a success message when
|
||||
something's karma is increased or decreased."""),]
|
||||
)
|
||||
def __init__(self):
|
||||
callbacks.PrivmsgCommandAndRegexp.__init__(self)
|
||||
@ -219,6 +223,8 @@ class Karma(callbacks.PrivmsgCommandAndRegexp,
|
||||
cursor.execute("""UPDATE karma
|
||||
SET added=added+1
|
||||
WHERE normalized=%s""", normalized)
|
||||
if self.configurables.get('karma-response', msg.args[0]):
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
|
||||
def decreaseKarma(self, irc, msg, match):
|
||||
r"^(\S+)--(|\s+)$"
|
||||
@ -231,6 +237,8 @@ class Karma(callbacks.PrivmsgCommandAndRegexp,
|
||||
cursor.execute("""UPDATE karma
|
||||
SET subtracted=subtracted+1
|
||||
WHERE normalized=%s""", normalized)
|
||||
if self.configurables.get('karma-response', msg.args[0]):
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
|
||||
|
||||
Class = Karma
|
||||
|
@ -96,6 +96,11 @@ if sqlite is not None:
|
||||
self.assertNoResponse('bar--', 2)
|
||||
self.assertResponse('karma bar', 'bar: -1')
|
||||
|
||||
def testKarmaOutputConfigurable(self):
|
||||
self.assertNoResponse('foo++', 2)
|
||||
self.assertNotError('karma config karma-response on')
|
||||
self.assertNotError('foo++')
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user