Coder Social home page Coder Social logo

ssbot's Introduction

ssbot

通过go-cqhttp接收qq机器人发来的消息,并自动调用go-cqhttp api发送消息等

比如做一个涩涩机器人, 发送以!!或者!!开头的群消息,机器人就会开始进行解析,包含涩图则会发一张涩图出来 image

部署方式

docker run -d --name=ssbot -p 7500:80 -v $PWD/setu:/app/images/setu -e Cqhttp__Host=http://192.168.1.100:6700 -e Cqhttp__secret=myqq lginc/ssbot

其中-p 7500:80 是把容器的80端口映射到宿主机的7500端口,请自行替换

-v $PWD/setu:/app/images/setu 是把宿主机当前目录下的setu目录映射到容器的/app/images/setu, 可以把$PWD/setu替换为你自己的涩图所在的目录

环境变量 作用 示例值
Cqhttp__Host cqhttp的服务器地址 http://192.168.1.100:6700
Cqhttp__secret cqhttp的配置中的access-token xxxx
Cqhttp__filter 需要过滤的命令列表,只要输入的消息在列表内则不做处理,用英文逗号做分割 美图,谁在线
ConnectionStrings__redis redis连接串 192.168.1.100,password=123123,connectTimeout=5000,writeBuffer=40960
ChatGPT__ApiKey chatGPT中申请的apikey xxxx
ChatGPT__Proxy 发送请求到chatGPT使用的代理,可不加 http://192.168.1.100:7890

使用redis缓存图片列表,避免发送重复的图片(不同的群使用不同的key) 同时也会缓存不同用户发送到chatGPT的消息和结果(只会保留最近10条,缓存2h),以保证chatGPT能够联系上下文回答

修改cqhttp配置

修改post上传url

cqhttp配置中有关于post url的配置 image

这里取消注释(删除行首的#), url填入ssbot服务的url,如宿主机是192.168.1.100,端口也是7500,则填写为

post:           # 反向HTTP POST地址列表
  - url: 'http://192.168.1.100:7500/recv'                # 地址

修改默认的filter

filter.json里增加对!!的过滤 \uFF01就是!的unicode

{
    "raw_message": {
        ".regex": "^(!!|\uFF01\uFF01)"
    }
}

同时记得把setu目录映射到cqhttp的/data/data/images下,因为cqhttp只能发送这个目录(可以有子目录)下的图片 然后重启cqhttp服务,就可以愉快地涩涩了

路线图

  • 发送涩图
  • 识别涩图命令
  • 发送请求到chatGPT(目前仅为GPT-3的api,免费额度$18)
  • 将cqhttp上报场景抽象为接口,实现对应接口则会自动调用相应的实现类
  • 分离命令类型识别和对应命令处理方法

ssbot's People

Contributors

lginc avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

cyaim

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.