https://github.com/Curtion/chatgpt-bot-hu60wap6
机器人的名字是QA
,带连续对话, 目前使用5S轮询,直到 https://hu60.cn/q.php/bbs.topic.104620.html 完成。 已对接WebSocket
其中的代码大多来自 https://hu60.cn/q.php/user.info.-50.html 机器人。
但是该机器人无法访问一些帖子内容, 所以很多情况处于不可用状态。 现在它有权限了。
因此在未来几天可能关闭它, 运行到赠送的$18用完为止。 目前它运行在我的路由器上面。
以下是使用iris和微信sdk开源库实现微信模板消息推送功能的代码示例:
package main
import (
"fmt"
"github.com/kataras/iris/v12"
"github.com/silenceper/wechat/v2"
"github.com/silenceper/wechat/v2/message"
)
func main() {
// 初始化iris应用
app := iris.New()
// 创建wechat实例
cfg := &wechat.Config{
AppID: "YOUR_APP_ID",
AppSecret: "YOUR_APP_SECRET",
}
wc := wechat.NewWechat(cfg)
// 设置路由
app.Get("/", func(ctx iris.Context) {
// 发送模板消息
tempMsg := &message.TemplateMessage{
Touser: "OPENID",
TemplateId: "TEMPLATE_ID",
URL: "http://example.com",
MiniProgram: nil,
Data: map[string]*message.TemplateDataItem{
"first": {Value: "您好,你有新的订单。"},
"keyword1": {Value: "商品名称"},
"keyword2": {Value: "订单号"},
"keyword3": {Value: "订单金额"},
"remark": {Value: "请尽快处理。"},
},
}
msgID, err := wc.Message.TemplateSend(tempMsg)
if err != nil {
ctx.WriteString(fmt.Sprintf("发送失败:%s", err.Error()))
} else {
ctx.WriteString(fmt.Sprintf("发送成功,消息ID为:%d", msgID))
}
})
// 运行应用
app.Run(iris.Addr(":8080"))
}
通过这个简单的示例,您可以使用iris和微信sdk库轻松地实现微信模板消息推送功能。
@QA