"http://bite-prod.s3.amazonaws.com/wp-content/uploads/2012/05/scotch.gif", "http://farm1.static.flickr.com/223/511011836_56ae92ec1a_o.gif", "http://cdn.nextround.net/wp-content/uploads/2010/03/gob-bluth-gif-6.gif", "http://farm1.static.flickr.com/206/510999823_23796e531c_o.gif", "http://farm1.static.flickr.com/209/510999843_8243c5d8c2_o.gif", "http://farm1.static.flickr.com/200/511028609_77e4eb3619_o.gif", "http://farm1.static.flickr.com/224/511001748_881f933034_o.gif", "http://farm1.static.flickr.com/209/511032209_4675bf163e_o.gif", "http://farm1.static.flickr.com/212/511032213_65f7cd9f12_o.gif", "http://25.media.tumblr.com/tumblr_m4rb3j8o9l1qgoi9lo1_500.gif", "http://24.media.tumblr.com/tumblr_m3gd8b0Vm71qbhh43o1_500.gif", "http://25.media.tumblr.com/tumblr_m0y41dR5Rg1qf0kb5o1_r1_400.gif", "http://25.media.tumblr.com/tumblr_m1pl69N19a1qf0kb5o1_400.gif", "http://24.media.tumblr.com/tumblr_lyp0cn0ZVh1r69h01o1_r2_250.gif", "http://25.media.tumblr.com/tumblr_lyiyhyMJbt1qgoi9lo1_500.gif", "http://24.media.tumblr.com/tumblr_lu9m4mCoVB1qk5u7ao1_400.gif", "http://25.media.tumblr.com/tumblr_lpabn5sAXF1qldcnvo1_500.gif", "http://25.media.tumblr.com/tumblr_lpbjdhqbyF1qa7lwzo1_500.gif", "http://25.media.tumblr.com/tumblr_lmq1fewvEi1qb34nxo1_500.gif", "http://media.tumblr.com/tumblr_m5hknk8g841qzblt6.gif", "http://25.media.tumblr.com/tumblr_lljt1gEqIs1qerndjo1_400.gif", "http://24.media.tumblr.com/tumblr_lka9b7SinV1qhivy6o1_500.gif" ] def process(self, message, sender, command=None, *args): if re.search(r'\bg\.?o\.?b\.?\b', message, re.I): return choice(Gob.gobs) plugin_registry.register(Gob())
return 'Invalid build \'{}\''.format(build_name) response = self.call_teamcity_api(TEAMCITY_BUILD_RUN.format(build_id=self.builds[build_name])) return 'Build {} requested: {}'.format(build_name, self.build_urls[self.builds[build_name]]) def call_teamcity_api(self, url): response = '' print('Calling URL: {}'.format(url)) try: request = urllib2.Request(url) base64string = base64.encodestring('%s:%s' % (TEAMCITY_USERNAME, TEAMCITY_PASSWORD)).replace('\n', '') request.add_header("Authorization", "Basic %s" % base64string) request.add_header("Accept", "application/json") f = urllib2.urlopen(request) response = f.read() except urllib2.URLError as e: return {} try: return json.loads(response) except: return {} plugin_registry.register(TeamCity())
if not self.isGameOn(): return 'You need to start the game first and choose a topic first Or should I just chop your head off now? teehee' guess = args[0] if guess in self.selected_characters: return 'I guess you peasant has a short-term memory issue. You have already guessed that character before' else: self.selected_characters.append(guess) if self.wonYet(): self.reset() return 'Congratulations! I now promote you to become Hand of the King!' progression = self.getHangProgression() game_progress_msg = self.getHangProgressionImage(progression) if progression == 100: game_progress_msg += 'Ha Ha Ha! Game Ended! You shall be served idiot!\n*Chopping Sound* (X_X) ... (==<' self.reset() else: mask = self.getWordMask() game_progress_msg += 'So far: ' + mask game_progress_msg += '\nAvailable characters: ' + self.displayAvailableCharacters() return game_progress_msg elif args[0] == 'help': return 'Available commands are\n!hangman: to start a game\n!hangman foods: to start playing hangman with the topic foods\n!hangman a: to guess letter a\n!hangman guess yamaha: to guess the word yamaha (you may get punished for wrong guess)\n!hangman stop: to stop the game' else : return 'Are you trying to hack this godly game or simply just retarded? Nice try' plugin_registry.register(Phrangman())
from random import choice import re from registry import BasePlugin, plugin_registry class Joffrey(BasePlugin): name = 'Joffrey' swears = ('shit', 'f**k', 'suck', 'screw', 'ass', 'c**t') insults = ( 'F**k you', 'How dare you talk to your King like that', 'I\'ll tear your intestines out and feed them to the dire wolves', ) def process(self, message, sender, command=None, *args): if 'joffrey' in message.lower(): for s in Joffrey.swears: if re.search(r'\b%s' % s, message, re.IGNORECASE): return choice(Joffrey.insults) if not re.search(r'\bking\b', message, re.IGNORECASE): return '*King* Joffrey' def post_process(self, reply, message, sender): return '{}, peasant'.format(reply) plugin_registry.register(Joffrey())
from random import randrange from registry import BasePlugin, plugin_registry class Dice(BasePlugin): name = 'Dice' commands = { '!dice': 'Roll a die' } def process(self, message, sender, command=None, *args): if command == 'dice': return 'It\'s a {}'.format(randrange(1, 6)) plugin_registry.register(Dice())
from registry import BasePlugin, plugin_registry class Help(BasePlugin): name = 'Help' commands = { '!help': 'This help command', } def process(self, message, sender, command=None, *args): if command != 'help': return reply = ['Available commands:'] for plugin in plugin_registry.plugins: if plugin.commands: reply.append(plugin.name) reply.append('\n'.join(('{}: {}'.format(c, d) for c, d in plugin.commands.iteritems()))) return '\n'.join(reply) plugin_registry.register(Help())