项目作者: x1ah

项目描述 :
QQ 机器人
高级语言: Python
项目地址: git://github.com/x1ah/QQRobot.git
创建时间: 2016-08-17T06:28:14Z
项目社区:https://github.com/x1ah/QQRobot

开源协议:

下载


使用

暂时只考虑支持 Python3

  1. $ pip install -r requirements.txt
  2. $ python cli.py

扩展

暂时性提供的简单扩展方式:

  1. from qqrobot import bot, run
  2. # 注册特定消息字段
  3. # 注册消息,函数返回值即为回复
  4. @bot.register_msg("这里是收到的消息内容")
  5. def hello(msg):
  6. return "返回值即为回复"
  7. # 如,对别人发过来的 hello 要回复 hello world,可以这么做
  8. @bot.register_msg('hello')
  9. def reply(msg):
  10. return "hello world"
  11. # 拦截所有消息
  12. @bot.register_msg("ALL")
  13. def reply_all(msg):
  14. """接收到的所有消息将会加上 ALL 回复给发送者,
  15. 单独注册的消息不受影响
  16. """
  17. return msg + "ALL"
  18. # 运行
  19. run()

TODO

  • 正则匹配消息
  • 处理群消息,讨论组消息
  • 获取联系人列表,QQ号,QQ群号回复,发送

Features

  • 自动回复
  • 收集消息