当前位置: 首页>>代码示例>>Python>>正文


Python DB.convert_ids方法代码示例

本文整理汇总了Python中DB.convert_ids方法的典型用法代码示例。如果您正苦于以下问题:Python DB.convert_ids方法的具体用法?Python DB.convert_ids怎么用?Python DB.convert_ids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DB的用法示例。


在下文中一共展示了DB.convert_ids方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: converter

# 需要导入模块: import DB [as 别名]
# 或者: from DB import convert_ids [as 别名]
    def converter(self, in_q, out_q):
        while True:
            telegram_msg = in_q.get(block=True)

            if 'message' in telegram_msg:  # New message
                if 'text' not in telegram_msg['message']:
                    continue

                vk_id = DB.convert_ids('Telegram', 'VK', telegram_msg['message']['chat']['id'])

                if vk_id is None:
                    continue

                vk_msg = {'api_method': 'messages.send', 'params': {}}
                vk_msg['params']['peer_id'] = vk_id
                vk_msg['params']['message'] = telegram_msg['message']['text']

                out_q.put(vk_msg)
开发者ID:Andrew-Morozko,项目名称:Funnel,代码行数:20,代码来源:Telegram2VK.py

示例2: converter

# 需要导入模块: import DB [as 别名]
# 或者: from DB import convert_ids [as 别名]
    def converter(self, in_q, out_q):
        while True:
            vk_msg = in_q.get(block=True)

            if vk_msg[0] == 4:  # New message
                if vk_msg[2] & 2:  # Flag 'OUTBOX' set
                    continue

                telegram_info = DB.convert_ids('VK', 'Telegram', vk_msg[3], need_group_info=True)

                if telegram_info is None:
                    continue

                telegram_msg = {'parse_mode': "HTML"}
                telegram_msg['chat_id'] = telegram_info[0]

                if telegram_info[1]:
                    telegram_msg['text'] = "<b>Name Placeholder</b>:\n"
                else:
                    telegram_msg['text'] = ""

                telegram_msg['text'] += vk_msg[6].replace('<br>', '\n')
                out_q.put(telegram_msg)
开发者ID:Andrew-Morozko,项目名称:Funnel,代码行数:25,代码来源:VK2Telegram.py


注:本文中的DB.convert_ids方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。