def cmd(send, msg, args): """Microwaves something. Syntax: !microwave <level> <target> """ nick = args['nick'] channel = args['target'] if args['target'] != 'private' else args[ 'config']['core']['channel'] levels = { 1: 'Whirr...', 2: 'Vrrm...', 3: 'Zzzzhhhh...', 4: 'SHFRRRRM...', 5: 'GEEEEZZSH...', 6: 'PLAAAAIIID...', 7: 'KKKRRRAAKKKAAKRAKKGGARGHGIZZZZ...', 8: 'Nuke', 9: 'nneeeaaaooowwwwww..... BOOOOOSH BLAM KABOOM', 10: 'ssh [email protected] rm -rf ~%s' } if not msg: send('What to microwave?') return match = re.match('(-?[0-9]*) (.*)', msg) if not match: send('Power level?') else: level = int(match.group(1)) target = match.group(2) if level > 10: send('Aborting to prevent extinction of human race.') return if level < 1: send('Anti-matter not yet implemented.') return if level > 7: if not args['is_admin'](nick): send("I'm sorry. Nukes are a admin-only feature") return elif msg == args['botnick']: send( "Sorry, Self-Nuking is disabled pending aquisition of a Lead-Lined Fridge." ) elif target not in args['handler'].channels[channel].users(): send("I'm sorry. Anonymous Nuking is not allowed") return msg = levels[1] for i in range(2, level + 1): if i < 8: msg += ' ' + levels[i] send(msg) if level >= 8: do_nuke(args['handler'].connection, nick, target, channel) if level >= 9: send(levels[9]) if level == 10: send(levels[10] % target) send('Ding, your %s is ready.' % target)
def cmd(send, msg, args): """Microwaves something. Syntax: {command} <level> <target> """ nick = args['nick'] channel = args['target'] if args['target'] != 'private' else args['config']['core']['channel'] levels = {1: 'Whirr...', 2: 'Vrrm...', 3: 'Zzzzhhhh...', 4: 'SHFRRRRM...', 5: 'GEEEEZZSH...', 6: 'PLAAAAIIID...', 7: 'KKKRRRAAKKKAAKRAKKGGARGHGIZZZZ...', 8: 'Nuke', 9: 'nneeeaaaooowwwwww..... BOOOOOSH BLAM KABOOM', 10: 'ssh [email protected] rm -rf ~%s'} if not msg: send('What to microwave?') return match = re.match('(-?[0-9]*) (.*)', msg) if not match: send('Power level?') else: level = int(match.group(1)) target = match.group(2) if level > 10: send('Aborting to prevent extinction of human race.') return if level < 1: send('Anti-matter not yet implemented.') return if level > 7: if not args['is_admin'](nick): send("I'm sorry. Nukes are a admin-only feature") return elif msg == args['botnick']: send("Sorry, Self-Nuking is disabled pending aquisition of a Lead-Lined Fridge.") elif target not in args['handler'].channels[channel].users(): send("I'm sorry. Anonymous Nuking is not allowed") return msg = levels[1] for i in range(2, level + 1): if i < 8: msg += ' ' + levels[i] send(msg) if level >= 8: do_nuke(args['handler'].connection, nick, target, channel) if level >= 9: send(levels[9]) if level == 10: send(levels[10] % target) send('Ding, your %s is ready.' % target)
def cmd(send, msg, args): """Nukes somebody. Syntax: {command} <target> """ c, nick = args['handler'].connection, args['nick'] channel = args['target'] if args['target'] != 'private' else args['config']['core']['channel'] if not msg: send("Nuke who?") return if msg in args['handler'].channels[channel].users(): do_nuke(c, nick, msg, channel) elif msg == args['botnick']: send("Sorry, Self-Nuking is disabled pending aquisition of a Lead-Lined Fridge.") else: send("I'm sorry. Anonymous Nuking is not allowed")