]> jfr.im git - erebus.git/commitdiff
move INJECT command from control to eval
authorJohn Runyon <redacted>
Thu, 15 Jun 2023 04:08:42 +0000 (22:08 -0600)
committerJohn Runyon <redacted>
Thu, 15 Jun 2023 04:08:42 +0000 (22:08 -0600)
modules/control.py
modules/eval.py

index aac0257b06907af5ba2e0b1e154aa3fc8b39f6cf..929fc25db9739c785a32d97ecafb72d8cc7b9c7f 100644 (file)
@@ -154,19 +154,3 @@ def qclear(bot, user, chan, realtarget, *args):
                        bot.fastmsg(user, "Syntax: QCLEAR [regular|slow]")
                        return #short-circuit
                bot.fastmsg(user, "Cleared that msgqueue.")
-
-@lib.hook(needchan=False, wantchan=True, glevel=lib.ADMIN)
-@lib.help("<nick> <message>", "inject a line as though it came from <nick>", "note that this injects lines, not commands", "ex: INJECT DimeCadmium !WHOAMI")
-def inject(bot, user, chan, realtarget, *args):
-       targetuser = bot.parent.user(args[0], create=False)
-       if targetuser is None:
-               bot.msg(user, "User is unknown.")
-               return
-       if targetuser.glevel > user.glevel:
-               bot.msg(user, "That user has a higher access level than you.")
-               return
-
-       if chan is not None:
-               bot.parsemsg(bot.parent.user(args[0], create=False), str(chan), ' '.join(args[1:]))
-       else:
-               bot.parsemsg(bot.parent.user(args[0], create=False), str(bot), ' '.join(args[1:]))
index 00f37ebd71e592fbe07faf4f35bd7ded5a2b8ed9..77f6a1adcb12a332c08e00a8f420990fe734337b 100644 (file)
@@ -53,3 +53,19 @@ def cmd_exec(bot, user, chan, realtarget, *args):
 @lib.help(None, "cause an exception")
 def cmd_exception(*args, **kwargs):
        raise Exception()
+
+@lib.hook(needchan=False, wantchan=True, glevel=lib.ADMIN)
+@lib.help("<nick> <message>", "inject a line as though it came from <nick>", "note that this injects lines, not commands", "ex: INJECT DimeCadmium !WHOAMI")
+def inject(bot, user, chan, realtarget, *args):
+       targetuser = bot.parent.user(args[0], create=False)
+       if targetuser is None:
+               bot.msg(user, "User is unknown.")
+               return
+       if targetuser.glevel > user.glevel:
+               bot.msg(user, "That user has a higher access level than you.")
+               return
+
+       if chan is not None:
+               bot.parsemsg(bot.parent.user(args[0], create=False), str(chan), ' '.join(args[1:]))
+       else:
+               bot.parsemsg(bot.parent.user(args[0], create=False), str(bot), ' '.join(args[1:]))