test.py 620 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env python
  2. # coding: utf-8
  3. from wxbot import *
  4. class MyWXBot(WXBot):
  5. def handle_msg_all(self, msg):
  6. if msg['msg_type_id'] == 4 and msg['content']['type'] == 0:
  7. self.send_msg_by_uid(u'hi', msg['user']['id'])
  8. #self.send_img_msg_by_uid("img/1.png", msg['user']['id'])
  9. #self.send_file_msg_by_uid("img/1.png", msg['user']['id'])
  10. '''
  11. def schedule(self):
  12. self.send_msg(u'张三', u'测试')
  13. time.sleep(1)
  14. '''
  15. def main():
  16. bot = MyWXBot()
  17. bot.DEBUG = True
  18. bot.conf['qr'] = 'png'
  19. bot.run()
  20. if __name__ == '__main__':
  21. main()