class EmoticonPlugin(WillPlugin): def __init__(self, *args, **kwargs): self.emoticons = HipchatEmoticons( settings.HIPCHAT_SERVER, settings.V2_TOKEN ) return WillPlugin.__init__(self, *args, **kwargs) @respond_to("^emoticon me(?P<search>.*?)$") def emoticon_me(self, message, search=None): "emoticon me ___: Search hipchat emoticons for ___ and return a random one" emoticons = self.emoticons.find(search) if emoticons: self.reply(message, random.choice(emoticons)) else: self.reply(message, 'I cannae find any captain!') @respond_to("^emoticons me(?P<search>.*?)$") def emoticons_me(self, message, search=None): "emoticons me ___: Search hipchat emoticons for ___ and return all of them" emoticons = self.emoticons.find(search) if emoticons: self.reply(message, ','.join(emoticons)) else: self.reply(message, 'I cannae find any captain!')
def __init__(self, *args, **kwargs): self.emoticons = HipchatEmoticons(settings.HIPCHAT_SERVER, settings.V2_TOKEN) return WillPlugin.__init__(self, *args, **kwargs)
def __init__(self, *args, **kwargs): self.emoticons = HipchatEmoticons( settings.HIPCHAT_SERVER, settings.V2_TOKEN ) return WillPlugin.__init__(self, *args, **kwargs)