zoukankan      html  css  js  c++  java
  • 微信自动回复

    #   coding=utf8
    
    import itchat,time      # 自动回复      # 封装好的装饰器,当接收到的消息是Text,即文字消息
    
    
    @itchat.msg_register('Text')
    def text_reply(msg):
        # 当消息不是由自己发出的时候
    
        myUserName = itchat.get_friends(update=True)[0]["UserName"]
        print myUserName
    
        if not msg['FromUserName'] == myUserName:
            # 发送一条提示给文件助手
            itchat.send_msg(u"[%s]收到好友@%s 的信息:%s
    " %
                            (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(msg['CreateTime'])),
                             msg['User']['NickName'],
                             msg['Text']), 'filehelper')
            return u'[自动回复]您好,我现在有事不在,一会再和您联系。
    已经收到您的的信息:%s
    ' % (msg['Text'])
    
    
    
    if __name__ == '__main__':
        itchat.auto_login()
    
        itchat.run()
  • 相关阅读:
    事后诸葛亮
    冲刺总结
    Alpha第十天
    Alpha第八天
    Alpha第九天
    Alpha第六天
    Alpha第七天
    Alpha第五天
    Python之pytesseract模块-实现OCR
    Selenium4 IDE初体验
  • 原文地址:https://www.cnblogs.com/wanghaonull/p/6861772.html
Copyright © 2011-2022 走看看