python类run()的实例源码

wechat.py 文件源码 项目:WerewolvesWechatBot 作者: LouYu2015 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
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)
base.py 文件源码 项目:wbot 作者: PY-Learning 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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()
wechat.py 文件源码 项目:turing-chat 作者: CosmoGao 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def main():
    itchat.auto_login(enableCmdQR=True + (platform.system() == 'Linux'))
    itchat.run()
PC_controller.py 文件源码 项目:Easy-wechat-script 作者: awefight 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def run():
    @itchat.msg_register(TEXT)
    def open(msg):
        if u'??' in msg['Text']:
            open_txt()
test_itchat.py 文件源码 项目:wx_taobao_fanli 作者: xsren 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def run(self):
        itchat.auto_login()
        itchat.run()
wx_bot.py 文件源码 项目:wx_taobao_fanli 作者: xsren 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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)


问题


面经


文章

微信
公众号

扫码关注公众号