Code Monkey home page Code Monkey logo

wxhook's Introduction

WxHook

简介

WxHook是一个基于dll注入实现的python微信机器人框架,支持多种接口、高扩展性、多线程消息处理,让你轻松应对海量消息,为你的需求实现提供便捷灵活的支持。

支持的接口

  1. hook同步消息
  2. 取消hook同步消息
  3. hook日志
  4. 取消hook日志
  5. 检查登录状态
  6. 获取用户信息
  7. 发送文本消息
  8. 发送图片消息
  9. 发送文件消息
  10. 发送表情消息
  11. 发送小程序消息
  12. 发送群@消息
  13. 发送拍一拍消息
  14. 获取联系人列表
  15. 获取联系人详情
  16. 创建群聊
  17. 退出群聊
  18. 获取群详情
  19. 获取群成员列表
  20. 添加群成员
  21. 删除群成员
  22. 邀请群成员
  23. 修改群成员昵称
  24. 设置群置顶消息
  25. 移除群置顶消息
  26. 转发消息
  27. 获取朋友圈首页
  28. 获取朋友圈下一页
  29. 收藏消息
  30. 收藏图片
  31. 下载附件
  32. 转发公众号消息
  33. 转发公众号消息通过消息ID
  34. 解码图片
  35. 获取语音通过消息ID
  36. 图片文本识别
  37. 获取数据库句柄
  38. 执行SQL命令
  39. 测试

微信版本下载

安装

pip install wxhook

使用示例

# import os
# os.environ["WXHOOK_LOG_LEVEL"] = "INFO" # 修改日志输出级别
# os.environ["WXHOOK_LOG_FORMAT"] = "<green>{time:YYYY-MM-DD HH:mm:ss}</green> | <level>{message}</level>" # 修改日志输出格式
from wxhook import Bot
from wxhook import events
from wxhook.model import Event


def on_login(bot: Bot, event: Event):
    print("登录成功之后会触发这个函数")


def on_start(bot: Bot):
    print("微信客户端打开之后会触发这个函数")


def on_stop(bot: Bot):
    print("关闭微信客户端之前会触发这个函数")


def on_before_message(bot: Bot, event: Event):
    print("消息事件处理之前")


def on_after_message(bot: Bot, event: Event):
    print("消息事件处理之后")


bot = Bot(
    # faked_version="3.9.10.19", # 解除微信低版本限制
    on_login=on_login,
    on_start=on_start,
    on_stop=on_stop,
    on_before_message=on_before_message,
    on_after_message=on_after_message
)


# 消息回调地址
# bot.set_webhook_url("http://127.0.0.1:8000")

@bot.handle(events.TEXT_MESSAGE)
def on_message(bot: Bot, event: Event):
    bot.send_text("filehelper", "hello world!")


bot.run()

QQ交流群:625920216

wxhook's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.