Python itchat 模块,run() 实例源码

我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用itchat.run()

项目:WerewolvesWechatBot    作者:LouYu2015    | 项目源码 | 文件源码
def __init__(self, game_controller):
        super().__init__(game_controller)

        self.username_to_user = {} # Map Wechat user name to WechatUser object
        self.send_msg_queue = queue.Queue() # Avoid sending messages too fast by buffering

        # Start listening Wechat messages
        itchat.auto_login()
        threading.Thread(target = itchat.run).start()

        # Send messages in another thread
        threading.Thread(target = self.send_messages_in_queue).start()

        # Accept new messages from players
        @itchat.msg_register(itchat.content.TEXT)
        def listen_wechat_message(message_info):
            username = message_info['User']['UserName'] # User name of the Wechat user
            text = message_info['Text'] # Content of the message
            self.got_message(username, text)
项目:wbot    作者:PY-Learning    | 项目源码 | 文件源码
def run(self):
        """???Bot"""
        logger.info("Bot Server start running...")
        try:
            itchat.auto_login(hotReload=True, enableCmdQR=2)
            self.after_login()
            itchat.run()
        except KeyboardInterrupt:
            logger.info("KeyboardInterrupt occurred ...  Quitting, Bye.")
        self.before_destory()
项目:turing-chat    作者:CosmoGao    | 项目源码 | 文件源码
def main():
    itchat.auto_login(enableCmdQR=True + (platform.system() == 'Linux'))
    itchat.run()
项目:Easy-wechat-script    作者:awefight    | 项目源码 | 文件源码
def run():
    @itchat.msg_register(TEXT)
    def open(msg):
        if u'??' in msg['Text']:
            open_txt()
项目:wx_taobao_fanli    作者:xsren    | 项目源码 | 文件源码
def run(self):
        itchat.auto_login()
        itchat.run()
项目:wx_taobao_fanli    作者:xsren    | 项目源码 | 文件源码
def run(self):
        sysstr = platform.system()
        if (sysstr == "Linux") or (sysstr == "Darwin"):
            itchat.auto_login(enableCmdQR=2, hotReload=True)
        else:
            itchat.auto_login(hotReload=True)
        itchat.run(True)