def cmd(send, msg, args): """Quiets a user, then unquiets them after the specified period of time. Syntax: !timeout timespec nickname timespec is in the format: {number}{unit}, where unit is s, m, h, or d. """ nickregex = args['config']['core']['nickregex'] setmode = args['handler'].connection.mode channel = args['target'] ops = list(args['handler'].channels[channel].opers()) if not args['is_admin'](args['nick']): send("Ops only") return if args['botnick'] not in ops: send("Bot must be an op.") return time, user = msg.split(maxsplit=1) if user == args['botnick']: send("I won't put myself in timeout!") return if not re.match(nickregex, user): send("%s is an invalid nick." % user) return defer_args = [channel, " -q %s!*@*" % user] time = parse_time(time) if time is None: send("Invalid unit.") else: setmode(channel, " +q %s!*@*" % user) ident = args['handler'].workers.defer(time, True, setmode, *defer_args) send("%s has been put in timeout, ident: %d" % (user, ident))
def cmd(send, msg, args): """Quiets a user, then unquiets them after the specified period of time. Syntax: !timeout <timespec> <nickname> timespec is in the format: {number}{unit}, where unit is s, m, h, or d. """ nickregex = args['config']['core']['nickregex'] setmode = args['handler'].connection.mode channel = args['target'] ops = list(args['handler'].channels[channel].opers()) if args['botnick'] not in ops: send("Bot must be an op.") return time, user = msg.split(maxsplit=1) if user == args['botnick']: send("I won't put myself in timeout!") return if not re.match(nickregex, user): send("%s is an invalid nick." % user) return defer_args = [channel, " -q %s!*@*" % user] time = parse_time(time) if time is None: send("Invalid unit.") else: setmode(channel, " +q %s!*@*" % user) ident = args['handler'].workers.defer(time, True, setmode, *defer_args) send("%s has been put in timeout, ident: %d" % (user, ident))
def cmd(send, msg, args): """Says something at a later time. Syntax: !defersay <delay> <msg> """ msg = msg.split(maxsplit=1) if len(msg) != 2: send("Not enough arguments") return t = parse_time(msg[0]) if t is None: send("Invalid unit.") elif t < 0: send("Time travel not yet implemented, sorry.") else: ident = args['handler'].workers.defer(t, False, send, msg[1]) send("Message deferred, ident: %s" % ident)
def cmd(send, msg, args): """Says something at a later time. Syntax: {command} <delay> <msg> """ msg = msg.split(maxsplit=1) if len(msg) != 2: send("Not enough arguments") return t = parse_time(msg[0]) if t is None: send("Invalid unit.") elif t < 0: send("Time travel not yet implemented, sorry.") else: ident = args['handler'].workers.defer(t, False, send, msg[1]) send("Message deferred, ident: %s" % ident)
def cmd(send, msg, args): """Says something at a later time. Syntax: !defersay <delay> <msg> """ if not args['is_admin'](args['nick']): send("Admins only") return msg = msg.split(maxsplit=1) if len(msg) != 2: send("Not enough arguments") return t = parse_time(msg[0]) if t is None: send("Invalid unit.") elif t < 0: send("Time travel not yet implemented, sorry.") else: ident = defer(t, send, msg[1]) send("Message deferred, ident: %s" % ident)
def cmd(send, msg, args): """Quiets a user, then unquiets them after the specified period of time. Syntax: !timeout timespec nickname timespec is in the format: {number}{unit}, where unit is m, h, or d. """ setmode = args['handler'].connection.mode channel = args['target'] ops = list(args['handler'].channels[channel].opers()) if not args['is_admin'](args['nick']): send("Ops only") return if args['botnick'] not in ops: send("Bot must be an op.") return time, user = msg.split(maxsplit=1) defer_args = [channel, " -q %s!*@*" % user] time = parse_time(time) if time is None: send("Invalid unit.") else: setmode(channel, " +q %s!*@*" % user) ident = defer(time, setmode, *defer_args) send("%s has been put in timeout, ident: %d" % (user, ident))