mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-07 19:49:23 +01:00
Added new lart/praise functionality. Now accepts a reason for larting/praising something
This commit is contained in:
parent
38f801fc9f
commit
aa9f8a997e
@ -389,13 +389,18 @@ class FunDB(callbacks.Privmsg):
|
|||||||
irc.reply(msg, reply)
|
irc.reply(msg, reply)
|
||||||
|
|
||||||
def lart(self, irc, msg, args):
|
def lart(self, irc, msg, args):
|
||||||
"""[<channel>] <nick>
|
"""[<channel>] <text>
|
||||||
|
|
||||||
The <channel> argument is only necessary if the message isn't being
|
The <channel> argument is only necessary if the message isn't being
|
||||||
sent in the channel itself. Uses a lart on <nick>.
|
sent in the channel itself. Uses a lart on <text>.
|
||||||
"""
|
"""
|
||||||
channel = privmsgs.getChannel(msg, args)
|
channel = privmsgs.getChannel(msg, args)
|
||||||
nick = privmsgs.getArgs(args)
|
nick = privmsgs.getArgs(args)
|
||||||
|
try:
|
||||||
|
(nick, reason) = map(' '.join, itersplit(nick.split(' '), 'for'.__eq__))
|
||||||
|
except ValueError:
|
||||||
|
nick = ' '.join(args)
|
||||||
|
reason = ""
|
||||||
cursor = self.db.cursor()
|
cursor = self.db.cursor()
|
||||||
cursor.execute("""SELECT id, lart FROM larts
|
cursor.execute("""SELECT id, lart FROM larts
|
||||||
WHERE lart NOTNULL
|
WHERE lart NOTNULL
|
||||||
@ -413,17 +418,26 @@ class FunDB(callbacks.Privmsg):
|
|||||||
else:
|
else:
|
||||||
lartee = nick
|
lartee = nick
|
||||||
lart = lart.replace("$who", lartee)
|
lart = lart.replace("$who", lartee)
|
||||||
|
if len(reason) > 0:
|
||||||
|
irc.queueMsg(ircmsgs.action(channel, '%s for %s (#%s)' %\
|
||||||
|
(lart, reason, id)))
|
||||||
|
else:
|
||||||
irc.queueMsg(ircmsgs.action(channel, '%s (#%s)' % (lart, id)))
|
irc.queueMsg(ircmsgs.action(channel, '%s (#%s)' % (lart, id)))
|
||||||
raise callbacks.CannotNest
|
raise callbacks.CannotNest
|
||||||
|
|
||||||
def praise(self, irc, msg, args):
|
def praise(self, irc, msg, args):
|
||||||
"""[<channel>] <nick>
|
"""[<channel>] <text>
|
||||||
|
|
||||||
The <channel> argument is only necessary if the message isn't being
|
The <channel> argument is only necessary if the message isn't being
|
||||||
sent in the channel itself. Uses a praise on <nick>.
|
sent in the channel itself. Uses a praise on <text>.
|
||||||
"""
|
"""
|
||||||
channel = privmsgs.getChannel(msg, args)
|
channel = privmsgs.getChannel(msg, args)
|
||||||
nick = privmsgs.getArgs(args)
|
nick = privmsgs.getArgs(args)
|
||||||
|
try:
|
||||||
|
(nick, reason) = map(' '.join, itersplit(nick.split(' '), 'for'.__eq__))
|
||||||
|
except ValueError:
|
||||||
|
nick = ' '.join(args)
|
||||||
|
reason = ""
|
||||||
cursor = self.db.cursor()
|
cursor = self.db.cursor()
|
||||||
cursor.execute("""SELECT id, praise FROM praises
|
cursor.execute("""SELECT id, praise FROM praises
|
||||||
WHERE praise NOTNULL
|
WHERE praise NOTNULL
|
||||||
@ -442,6 +456,10 @@ class FunDB(callbacks.Privmsg):
|
|||||||
else:
|
else:
|
||||||
praisee = nick
|
praisee = nick
|
||||||
praise = praise.replace("$who", praisee)
|
praise = praise.replace("$who", praisee)
|
||||||
|
if len(reason) > 0:
|
||||||
|
irc.queueMsg(ircmsgs.action(channel, '%s for %s (#%s)' %\
|
||||||
|
(praise, reason, id)))
|
||||||
|
else:
|
||||||
irc.queueMsg(ircmsgs.action(channel, '%s (#%s)' % (praise, id)))
|
irc.queueMsg(ircmsgs.action(channel, '%s (#%s)' % (praise, id)))
|
||||||
raise callbacks.CannotNest
|
raise callbacks.CannotNest
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user