コード例 #1
0
 def __init__(self, config):
     super().__init__(config)
     identity = config.BOT_IDENTITY
     self.at_name = config.BOT_PREFIX
     self.creds_file = identity['GOOGLE_CREDS_FILE']
     self.gce_project = identity['GOOGLE_CLOUD_ENGINE_PROJECT']
     self.gce_topic = identity['GOOGLE_CLOUD_ENGINE_PUBSUB_TOPIC']
     self.gce_subscription = identity['GOOGLE_CLOUD_ENGINE_PUBSUB_SUBSCRIPTION']
     self.chat_api = GoogleHangoutsChatAPI(self.creds_file)
     self.bot_identifier = HangoutsChatUser(None, self.at_name, None, None)
     self.event_cache = LRUCache(1024)
     self.md = hangoutschat_markdown_converter()
コード例 #2
0
    def __init__(self, config):
        super().__init__(config)

        self.bot_identifier = HangoutsChatPerson(id='botty',
                                                 full_name='Botty McBotface',
                                                 email='botty',
                                                 space_name='')

        self.identity = config.BOT_IDENTITY
        for key in ('project_id', 'subscription_name', 'credentials_path'):
            if key not in self.identity:
                log.fatal(
                    "You need to supply the key `{}` for me to use.".format(
                        key))
                sys.exit(1)

        self.subscriber = pubsub_v1.SubscriberClient()
        self.subscription_path = self.subscriber.subscription_path(
            self.identity['project_id'], self.identity['subscription_name'])

        self.md = hangoutschat_markdown_converter()
コード例 #3
0
 def test_upper(self):
     md = markdownconverter.hangoutschat_markdown_converter()
     md.convert
     self.assertEqual(md.convert('**test**'), '*test*')
     self.assertEqual(md.convert('This is [a link](http://www.errbot.io).'),
                      'This is <http://www.errbot.io|a link>.')