Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #stuff.py:
- import os
- import commands
- import random
- import re
- import sys
- if 'torqux' not in sys._getframe().f_back.f_code.co_filename:
- lol_no
- helpDict = {'messages': 'usage: "!messages [who] [message]". Save messages for someone for the next time they join',
- 'action': 'usage: "!action [action]"',
- 'dance': 'usage: "!dance"',
- 'dice': 'usage: !dice [number]',
- 'echo': 'usage: "!echo [message]"',
- 'fortune': 'usage: "!fortune"',
- '8ball': 'usage: "!8ball"',
- 'highfive': 'usage: "!highfive"',
- 'god': 'usage: "!god". Display some ascii art',
- 'stab': 'usage: "!stab [x]"',
- 'vuvuzela': 'usage "!vuvuzela"',
- 'sheep': 'usage "!sheep [nick]"'}
- _eightballResponses = ['As I see it, yes',
- 'It is certain',
- 'It is decidedly so',
- 'Most likely',
- 'Outlook good',
- 'Signs point to yes',
- 'Without a doubt',
- 'Yes',
- 'Yes - definitely',
- 'You may rely on it',
- 'Reply hazy, try again',
- 'Ask again later',
- 'Better not tell you now',
- 'Cannot predict now',
- 'Concentrate and ask again',
- "Don't count on it",
- 'My reply is no',
- 'My sources say no',
- 'Outlook not so good',
- 'Very doubtful']
- mohammeds = ['Muhammad (((:~{>',
- 'Pirate Muhammad (((P~{>',
- 'Cool Muhammad (((B~{>',
- 'Insurgent Mohammad *-O)):~{>',
- 'Angry Muhammad (((B-|>',
- 'Rich Muhammad (($$(((:~{>',
- 'Cranky Muhammad ((((;~{[>']
- peopleIknow = []
- def _addit(bot, name, reason, extra):
- bot.config['modules'].append(extra)
- def _makeit(bot, user, target, argument):
- bot.config['admins'][user] = int(argument)
- print repr(bot.config)
- def idle(bot, data):
- user = re.findall('\\A\\:([^\\!]+)[^ ]+ JOIN \\:#', data)
- if user and user[0] not in bot.config['ignore']:
- if os.path.isfile(user[0]):
- with open(user[0], 'r') as myfile:
- messages = map(lambda s: s.strip(), myfile.readlines())
- print 'MESSAGES',
- print repr(messages)
- bot.sendLns(user[0], messages)
- os.remove(user[0])
- if user[0] in peopleIknow:
- peopleIknow.append(user[0])
- def eightBall(bot, user, target, argument):
- bot.sendLns(target, _eightballResponses[random.randint(0, 19)])
- def about(bot, user, target, argument):
- lines = bot.config['about'].split('\\n')
- bot.sendLns(user, lines)
- def action(bot, user, target, argument):
- bot.sendLns(bot.config['channel'], '\x01ACTION ' + argument + '\x01')
- def d(bot, user, target, argument = '6'):
- size = 6
- try:
- size = int(argument)
- except:
- pass
- number = random.randint(1, size)
- action(bot, '', '', 'rolls a %d sided die. got %d' % (size, number))
- def dance(bot, user, target, argument):
- action(bot, '', '', 'dances :D--<')
- action(bot, '', '', 'dances :D|-<')
- action(bot, '', '', 'dances :D/-<')
- def echo(bot, user, target, argument):
- bot.sendLns(bot.config['channel'], argument)
- def fortune(bot, user, target, argument):
- fortune = commands.getoutput('fortune -as')
- fortune = re.split('\n', fortune)
- bot.sendLns(target, fortune)
- def help(bot, user, target, argument):
- argument = argument.replace('!', '')
- if argument in helpDict:
- response = helpDict[argument].replace('<me>', bot.config['botName'])
- elif argument:
- response = "Command '" + argument + "' not found in help file."
- else:
- response = 'usage: !help [command].'
- keys = helpDict.keys()
- keys.sort()
- response = [response, 'List of commands: !' + ' !'.join(keys)]
- bot.sendLns(user, response)
- def highfive(bot, user, target, argument):
- bot.sendLns(target, '\x01ACTION high fives ' + user + '.\x01')
- def kick(bot, user, target, argument):
- bot.sendRaw('KICK ' + bot.config['channel'] + ' ' + argument + '\r\n')
- def kill(bot, user, target, argument):
- action(bot, '', '', 'dies.')
- def god(bot, user, target, argument):
- bot.sendLns(target, mohammeds[random.randint(0, len(mohammeds) - 1)])
- def nick(bot, user, target, argument):
- bot.sendRaw('NICK ' + argument + '\r\n')
- bot.config['botName'] = argument
- def messages(bot, user, target, argument):
- message = argument.split(' ')
- who = message[0]
- message = ' '.join(message[1:])
- with open(who, 'a') as myfile:
- myfile.write(message + '\n')
- action(bot, user, '', 'saved the message "%s" for %s' % (message, who))
- def stab(bot, user, target, argument):
- action(bot, '', '', 'stabs ' + argument)
- def vuvuzela(bot, user, target, argument):
- bot.sendLns(target, '\x02BZZZZZZZZZZZZZZZZZ BZZZZZ BZZZZZ BZZZZZ BZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZz\x02')
- def sheep(bot, user, target, argument):
- messages = ['x likes to fuck sheep.', "sheep lick x's balls", 'x wishes sheep liked him']
- args = re.findall('-([a-zA])\\W+(.*)', argument)
- if len(args):
- (flag, thing,) = args[0]
- else:
- (flag, thing,) = ('d', argument)
- bot.sendLns(target, messages[random.randint(0, len(messages))].replace('x', thing))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement