]> jfr.im git - erebus.git/commitdiff
add config option nofakelag
authorzonidjan <redacted>
Wed, 11 Oct 2017 23:11:07 +0000 (18:11 -0500)
committerzonidjan <redacted>
Wed, 11 Oct 2017 23:11:07 +0000 (18:11 -0500)
bot.py
modules/help.py

diff --git a/bot.py b/bot.py
index fc9557e2ce507a5753c0b134d0a2d33a87a1193b..8c8f4b540fd44e03cc4c3a7aaeba3dd2617c2884 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -340,6 +340,7 @@ class Bot(object):
                        __import__('traceback').print_stack()
 
        def msg(self, target, msg):
+               if self.parent.cfg.getboolean('erebus', 'nofakelag'): return self.fastmsg(target, msg)
                cmd = self._formatmsg(target, msg)
                if self.conn.exceeded or self.conn.bytessent+len(cmd) >= self.conn.recvq:
                        self.msgqueue.append(cmd)
@@ -348,6 +349,7 @@ class Bot(object):
                self.conn.exceeded = True
 
        def slowmsg(self, target, msg):
+               if self.parent.cfg.getboolean('erebus', 'nofakelag'): return self.fastmsg(target, msg)
                cmd = self._formatmsg(target, msg)
                if self.conn.exceeded or self.conn.bytessent+len(cmd) >= self.conn.recvq:
                        self.slowmsgqueue.append(cmd)
index 49c3aa61875d763fd8872ac8fdf00850d8d083fd..97dd1de0d1b3be8c9b04fecdb4d37c45fcf52ce4 100644 (file)
@@ -14,7 +14,12 @@ modinfo = {
 # preamble
 import modlib
 lib = modlib.modlib(__name__)
-modstart = lib.modstart
+def modstart(parent, *args, **kwargs):
+       if parent.cfg.getboolean('erebus', 'nofakelag'):
+               lib.hook(needchan=False)(lib.help('[@<module>|<command>]', 'lists commands or describes a command', 'with @<module>, lists all commands in <module>')(help_nolag))
+       else:
+               lib.hook(needchan=False)(lib.help("<command>", "describes a command")(help))
+       return lib.modstart(parent, *args, **kwargs)
 modstop = lib.modstop
 
 # module code
@@ -133,8 +138,8 @@ def genhelp(bot, user, chan, realtarget, *args):
                return
        bot.msg(user, "Help written.")
 
-@lib.hook(needchan=False)
-@lib.help("<command>", "describes a command")
+#@lib.hook(needchan=False)
+#@lib.help("<command>", "describes a command")
 @lib.argsGE(1)
 def help(bot, user, chan, realtarget, *args):
        cmd = str(' '.join(args)).lower()
@@ -169,10 +174,9 @@ def showcommands(bot, user, chan, realtarget, *args):
        else:
                bot.msg(user, "I don't know where help is. Sorry. Contact my owner.")
 
-"""#DISABLED
-@lib.hook(needchan=False)
-@lib.help('[@<module>|<command>]', 'lists commands or describes a command', 'with @<module>, lists all commands in <module>')
-def help(bot, user, chan, realtarget, *args):
+#@lib.hook(needchan=False)
+#@lib.help('[@<module>|<command>]', 'lists commands or describes a command', 'with @<module>, lists all commands in <module>')
+def help_nolag(bot, user, chan, realtarget, *args):
        if len(args) == 0: # list commands
                lines = []
                for func in helps.itervalues():
@@ -202,5 +206,3 @@ def help(bot, user, chan, realtarget, *args):
                                bot.slowmsg(user, "  Aliases: %s" % (' '.join(func.cmd[1:])))
                else:
                        bot.slowmsg(user, "No help found for %s" % (cmd))
-"""
-pass