chatgpt_on_wechat 插件系统
chatgpt_on_wechat 是一个基于ChatGPT的微信机器人项目,支持丰富的插件扩展。
功能特点
- 支持ChatGPT3.5/4.0 API
- 支持企业微信、个人微信
- 支持多种对话模式
- 完善的插件系统
官方地址
GitHub: https://github.com/zhayujie/chatgpt-on-wechat
插件推荐
1. weather-plugin 天气查询
git clone https://github.com/xxx/weather-plugin.git plugins/weather
使用:@机器人 天气 北京
2. translate-plugin 翻译插件
支持多语言互译。
使用:
@机器人 翻译 Hello World @机器人 日译中 今日は良い天気です
3. rss-plugin RSS订阅
订阅RSS源,自动推送更新。
rss:
feeds:
- name: 科技资讯
url: https://feeds.example.com/tech.xml
interval: 3600
4. image-plugin 图片生成
集成Midjourney、DALL-E等图片生成服务。
使用:@机器人 画一只可爱的猫咪
5. admin-plugin 管理员插件
管理员命令,管理群聊和用户。
6. token-plugin Token管理
查看和管理API使用量。
插件开发
插件结构
plugins/
my_plugin/
__init__.py # 插件入口
config.yaml # 插件配置
README.md # 插件说明
编写插件
from bridge.reply import Reply , ReplyType
from plugins import Plugin
class MyPlugin(Plugin):
def __init__(self):
super().__init__()
self.handlers[Event.on_handle_context] = self.on_handle_context
def on_handle_context(self , e_context):
if e_context['context'].content == 'hello':
reply = Reply(ReplyType.TEXT , 'Hello!')
e_context['reply'] = reply
注意事项
- 确保插件版本与主程序兼容
- 部分插件会消耗API配额
- 谨慎授权第三方插件
- 过多插件可能影响响应速度
总结
chatgpt_on_wechat的插件生态丰富,通过合理使用插件,可以大幅提升机器人的实用性和可玩性。
评论区
评论加载中...