]> jfr.im git - erebus.git/commitdiff
Added extra parameter to callbacks, "realtarget"
authorzonidjan <redacted>
Wed, 18 Dec 2013 16:58:40 +0000 (10:58 -0600)
committerzonidjan <redacted>
Wed, 18 Dec 2013 16:58:40 +0000 (10:58 -0600)
Specifies the "actual" target of a PM (be it bot's nick or channel or ...)

Will be useful for a "JOINCHAN" command (as it will be able to work in PM,
    a la "if realtarget != chan: jointo = chan; else: jointo = args[0]"

bot.py
modules/eval.py

diff --git a/bot.py b/bot.py
index a57b0d439e4b69b67aa7d5223b0fe2d3668069cd..376495337b76a06654b39ae0f0c5e49a5df733f1 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -98,8 +98,9 @@ class Bot(object):
                        if chan is None and callback.needchan:
                                self.msg(user, "You need to specify a channel for that command.")
                                return
-                       if user.glevel >= callback.reqglevel: #TODO TODO TODO check reqclevel
-                               callback(self, user, chan, *pieces[1:])
+                       if user.glevel >= callback.reqglevel:
+                               #TODO TODO TODO check reqclevel
+                               callback(self, user, chan, target, *pieces[1:])
                                return
 
                self.msg(user, "No such command, or you don't have access.")
index 9ad387ca7ba37c8aaf6c1c8cc93e471345af3856..5ac60fd9814a534c8e077130ef5f43fda20af894 100644 (file)
@@ -20,7 +20,7 @@ import sys
 
 
 @lib.hook('eval', needchan=False, glevel=lib.MANAGER)
-def cmd_eval(bot, user, chan, *args):
+def cmd_eval(bot, user, chan, realtarget, *args):
        if chan is not None: replyto = chan
        else: replyto = user
 
@@ -30,7 +30,7 @@ def cmd_eval(bot, user, chan, *args):
 
 
 @lib.hook('exec', needchan=False, glevel=lib.MANAGER)
-def cmd_exec(bot, user, chan, *args):
+def cmd_exec(bot, user, chan, realtarget, *args):
        if chan is not None: replyto = chan
        else: replyto = user