Giter Club home page Giter Club logo

wechatter's Introduction

WeChatter: Make WeChat Better

CI/CD GitHub Release GitHub License Welcome

介绍

一个基于 wechatbot-webhook 的微信机器人💬,支持 GPT 问答、热搜推送、天气预报、消息转发、Webhook提醒等功能。

wechatter show

快速开始

运行 wechatbot-webhook

  1. 拉取 Docker 镜像
docker pull dannicool/docker-wechatbot-webhook
  1. 运行 Docker
docker run -d \
--name wxBotWebhook \
-p 3001:3001 \
-e LOGIN_API_TOKEN="<Token>" \
-e RECVD_MSG_API="http(s)://<宿主机IP>:<接收消息端口>/receive_msg" \
dannicool/docker-wechatbot-webhook
  • <Token>:令牌
  • <宿主机IP>:填入 Docker 的宿主机地址。
  • <接收消息端口>:设置一个接收消息的端口,默认为 4000
  1. 登录微信

使用下面命令查看 Docker 日志中的微信二维码,扫码登录微信。

docker logs -f wxBotWebhook

启动 WeChatter

  1. 下载源代码
git clone https://github.com/Cassius0924/WeChatter
cd WeChatter
  1. 安装依赖项
# 如果需要,可创建虚拟环境...

pip install -r requirements.txt
  1. 复制并编辑配置文件
cp config.yaml.example config.yaml
vim config.yaml
  1. 启动 WeChatter
python3 -m wechatter
  1. 测试机器人

使用另一个微信给机器人发送 /help 指令。

支持的命令

  • GPT 问答,基于 Copilot-GPT4-Service(不支持定时任务)
  • Bilibili 热搜
  • 知乎热搜
  • 微博热搜
  • 抖音热搜
  • GitHub 趋势
  • 单词词语翻译(不支持定时任务)
  • 少数派早报
  • 历史上的今天
  • 二维码生成
  • 待办清单(不支持定时任务)
  • 人民日报 PDF
  • 天气预报
  • 食物热量
  • 冷知识
  • 中石化92号汽油指导价

Tip

命令帮助请使用 /help 命令查询或查看命令功能展示

支持的功能

  • 消息可引用回复:用户可以通过引用并回复命令消息进一步获取消息内容。带(可引用:***)的机器人消息即为可进一步互动的可引用消息。

  • 消息转发:转发用户或群的消息到其他用户或群,并支持引用回复转发消息。需进行配置message_forwarding_and_quoted_reply_show

  • 公众号提醒:当指定公众号发布新文章时,机器人会给指定用户或群发送提醒。需进行配置official_account_reminder_show

  • 定时任务:大部分命令均支持定时任务。需进行配置

支持的游戏

  • 井字棋:双人游戏,图片游戏。 tictactoe_show

Tip

游戏相关命令帮助请使用查阅游戏基本命令

支持的 Webhook

  • GitHub 仓库 Webhook,需在 GitHub 仓库 Settings 中添加 Webhook 并进行配置github_webhook_show

配置文件

项目根目录中的 config.yaml.example 为配置文件模版,首次启动项目前需要复制一份配置文件,并命名为 config.yaml。 编辑 config.yaml

下表为配置项解释:

⚙️ WeChatter 配置

配置项 解释 备注
wechatter_port WeChatter服务器的端口,接受消息的端口 默认为 4000,需和 wxbotwebhook Docker 的 RECV_MSG_API 参数的端口一致

⚙️ WxBotWebhook 配置

配置项 解释 备注
wx_webhook_base_api 发送消息的 BaseAPI 默认为 localhost:3001,即 wxBotWebhook Docker 的地址
wx_webhook_recv_api_path 接收消息的接口路径 默认为 /receive_msg,此路径为 Docker 参数 RECVD_MSG_API 的路径
wx_webhook_token wxBotWebhook 的 Token

⚙️ Admin 配置

配置项 解释 备注
admin_list 设置管理员,用于接收机器人状态变化通知 填入管理员微信名(不是备注)
admin_group_list admin_list 同理,接收机器人状态变化通知 填入群名称(不是群备注)

⚙️ Bot 配置

配置项 解释 备注
bot_name 微信机器人的名字 微信名称,非微信号

⚙️ Chat 配置

配置项 解释 备注
command_prefix 机器人命令前缀 默认为 / ,可以设置为>>! 等任意字符
need_mentioned 群聊中的命令是否需要@机器人 默认为 True

⚙️ Copilot GPT4 配置

配置项 解释 备注
cp_gpt4_base_api CopilotGPT4 服务的 BaseAPI 默认为 http://localhost:8080
cp_token GitHub Copilot 的 Token ghu_ 开头的字符串

⚙️ GitHub Webhook 配置

配置项 解释 备注
github_webhook_enabled 功能开关,是否接收 GitHub Webhook 默认为 False
github_webhook_api_path 接收 GitHub Webhook 的接口路径 默认为 /webhook/github
github_webhook_receiver_list 接收 GitHub Webhook 的微信用户
github_webhook_receive_group_list 接收 GitHub Webhook 的微信群

⚙️ Message Forwarding 配置

配置项 子项 解释 备注
message_forwarding_enabled 功能开关,是否开启消息转发 默认为 False
message_forwarding_rule_list 消息规则列表,每个规则包含三个字段:from_listto_person_listto_group_list
from_list 消息转发来源列表,即消息发送者 可以填多个用户名称或群名称,若要转发所有消息则使用 ["%ALL"]
from_list_exclude 消息转发来源排除列表,不转发此列表的用户和群 只在 from_list["%ALL"] 时生效
to_person_list 消息转发目标用户列表,即消息接收用户 可以填多个用户名称或为空列表
to_group_list 消息转发目标群列表,即消息接收群 可以填多个群名称或为空列表

⚙️ Official Account Reminder 配置

配置项 子项 解释 备注
official_account_reminder_enabled 功能开关,是否开启消息转发 默认为 True
official_account_reminder_rule_list 消息规则列表,每个规则包含三个字段:oa_name_listto_person_listto_group_list
oa_name_list 公众号名称列表 可以填多个公众号名称
to_person_list 消息转发目标用户列表,即消息接收用户 可以填多个用户名称或为空列表
to_group_list 消息转发目标群列表,即消息接收群 可以填多个群名称或为空列表

⚙️ Task Cron 配置

配置项 解释 备注
all_task_cron_enabled 所有定时任务的总开关 默认为 True
task_cron_list 定时任务列表,每个任务包含四个字段:taskenabledcroncommands

关于定时任务配置详细请参阅定时任务配置详细

⚙️ Custom Command Key 配置

配置项 解释 备注
custom_command_key_dict 自定义命令关键词字典,格式为 command: [key1, key2, ...], 其中 command 为命令名称,key1key2 为自定义命令关键词

关于命令名称可选值请参阅自定义命令关键词配置详细

日志文件

日志文件存放在项目根目录下的 logs/ 文件夹中。

默认的日志记录级别为 INFO,若需要调整日志记录级别,请修改环境变量 WECHATTER_LOG_LEVEL,可设置 DEBUGINFOWARNINGERRORCRITICAL

export WECHATTER_LOG_LEVEL=DEBUG

贡献者

Thanks to the following people who have contributed to this project:

Contributors

插件化

Note

开发中...

Warning

本项目仍在开发中,欢迎提出建议和意见。

wechatter's People

Contributors

cassius0924 avatar ashesttt avatar dependabot[bot] avatar

Stargazers

 avatar

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.