mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-07-27 22:13:48 +00:00
Compare commits
6 Commits
v1.2.0
...
75635739ba
Author | SHA1 | Date | |
---|---|---|---|
75635739ba | |||
d25e320238 | |||
b8d622bb90 | |||
9cccd0e39b | |||
e1a4293ee6 | |||
fcf79ded58 |
21
.github/workflows/close_pr.yml
vendored
21
.github/workflows/close_pr.yml
vendored
@ -1,21 +0,0 @@
|
|||||||
name: Check and Close Invalid PR
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request_target:
|
|
||||||
types: [opened, reopened]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# This workflow closes invalid PR
|
|
||||||
close_pr:
|
|
||||||
# The type of runner that the job will run on
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions: write-all
|
|
||||||
|
|
||||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
|
||||||
steps:
|
|
||||||
- name: Close PR if it is not pointed to dev branch
|
|
||||||
if: github.event.pull_request.base.ref != 'dev'
|
|
||||||
uses: superbrothers/close-pull-request@v3
|
|
||||||
with:
|
|
||||||
# Optional. Post a issue comment just before closing a pull request.
|
|
||||||
comment: "Invalid PR to `non-dev` branch `${{ github.event.pull_request.base.ref }}`."
|
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: Release
|
name: release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -42,10 +42,6 @@ _✨ 基于 [Mirai](https://github.com/mamoe/mirai) 以及 [MiraiGo](https://git
|
|||||||
<a href="https://github.com/Mrs4s/go-cqhttp/blob/master/CONTRIBUTING.md">参与贡献</a>
|
<a href="https://github.com/Mrs4s/go-cqhttp/blob/master/CONTRIBUTING.md">参与贡献</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## 重要信息
|
|
||||||
由于QQ官方针对协议库的围追堵截, 不断更新加密方案, 我们已无力继续维护此项目.
|
|
||||||
建议Bot开发者尽快迁移至无头NTQQ项目 -> https://chronocat.vercel.app/blog/0050
|
|
||||||
参考issue: https://github.com/Mrs4s/go-cqhttp/issues/2471
|
|
||||||
|
|
||||||
## 兼容性
|
## 兼容性
|
||||||
go-cqhttp 兼容 [OneBot-v11](https://github.com/botuniverse/onebot-11) 绝大多数内容,并在其基础上做了一些扩展,详情请看 go-cqhttp 的文档。
|
go-cqhttp 兼容 [OneBot-v11](https://github.com/botuniverse/onebot-11) 绝大多数内容,并在其基础上做了一些扩展,详情请看 go-cqhttp 的文档。
|
||||||
|
@ -255,8 +255,14 @@ func LoginInteract() {
|
|||||||
versionFile := path.Join(global.VersionsPath, fmt.Sprint(int(cli.Device().Protocol))+".json")
|
versionFile := path.Join(global.VersionsPath, fmt.Sprint(int(cli.Device().Protocol))+".json")
|
||||||
if global.PathExists(versionFile) {
|
if global.PathExists(versionFile) {
|
||||||
b, err := os.ReadFile(versionFile)
|
b, err := os.ReadFile(versionFile)
|
||||||
if err == nil {
|
if err != nil {
|
||||||
_ = cli.Device().Protocol.Version().UpdateFromJson(b)
|
log.Warnf("从文件 %s 读取本地版本信息文件出错.", versionFile)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
err = cli.Device().Protocol.Version().UpdateFromJson(b)
|
||||||
|
if err != nil {
|
||||||
|
log.Warnf("从文件 %s 解析本地版本信息出错: %v", versionFile, err)
|
||||||
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
log.Infof("从文件 %s 读取协议版本 %v.", versionFile, cli.Device().Protocol.Version())
|
log.Infof("从文件 %s 读取协议版本 %v.", versionFile, cli.Device().Protocol.Version())
|
||||||
}
|
}
|
||||||
@ -315,7 +321,11 @@ func LoginInteract() {
|
|||||||
log.Infof("如果登录时出现版本过低错误, 可尝试使用 -update-protocol 参数启动")
|
log.Infof("如果登录时出现版本过低错误, 可尝试使用 -update-protocol 参数启动")
|
||||||
case !isTokenLogin:
|
case !isTokenLogin:
|
||||||
_ = device.Protocol.Version().UpdateFromJson(remoteVersion)
|
_ = device.Protocol.Version().UpdateFromJson(remoteVersion)
|
||||||
|
err := os.WriteFile(versionFile, remoteVersion, 0644)
|
||||||
log.Infof("协议版本已更新: %s -> %s", currentVersionName, remoteVersionName)
|
log.Infof("协议版本已更新: %s -> %s", currentVersionName, remoteVersionName)
|
||||||
|
if err != nil {
|
||||||
|
log.Warnln("更新协议版本缓存文件", versionFile, "失败:", err)
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
log.Infof("检测到协议更新: %s -> %s", currentVersionName, remoteVersionName)
|
log.Infof("检测到协议更新: %s -> %s", currentVersionName, remoteVersionName)
|
||||||
log.Infof("由于使用了会话缓存, 无法自动更新协议, 请删除缓存后重试")
|
log.Infof("由于使用了会话缓存, 无法自动更新协议, 请删除缓存后重试")
|
||||||
@ -483,7 +493,7 @@ func getRemoteLatestProtocolVersion(protocolType int) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
response, err := download.Request{URL: url}.Bytes()
|
response, err := download.Request{URL: url}.Bytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return download.Request{URL: "https://ghproxy.com/" + url}.Bytes()
|
return download.Request{URL: "https://mirror.ghproxy.com/" + url}.Bytes()
|
||||||
}
|
}
|
||||||
return response, nil
|
return response, nil
|
||||||
}
|
}
|
||||||
|
@ -404,7 +404,7 @@ func ToMessageContent(e []message.IMessageElement, source message.Source) (r []g
|
|||||||
// ConvertStringMessage 将消息字符串转为消息元素数组
|
// ConvertStringMessage 将消息字符串转为消息元素数组
|
||||||
func (bot *CQBot) ConvertStringMessage(spec *onebot.Spec, raw string, sourceType message.SourceType) (r []message.IMessageElement) {
|
func (bot *CQBot) ConvertStringMessage(spec *onebot.Spec, raw string, sourceType message.SourceType) (r []message.IMessageElement) {
|
||||||
elems := msg.ParseString(raw)
|
elems := msg.ParseString(raw)
|
||||||
return bot.ConvertElements(spec, elems, sourceType, true)
|
return bot.ConvertElements(spec, elems, sourceType, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConvertObjectMessage 将消息JSON对象转为消息元素数组
|
// ConvertObjectMessage 将消息JSON对象转为消息元素数组
|
||||||
|
Reference in New Issue
Block a user