mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-07-27 06:03:48 +00:00
Compare commits
3 Commits
75635739ba
...
v1.2.0
Author | SHA1 | Date | |
---|---|---|---|
5cbbcda2c2 | |||
6ac7a8f0ae | |||
642c74688c |
21
.github/workflows/close_pr.yml
vendored
Normal file
21
.github/workflows/close_pr.yml
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
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:
|
||||
push:
|
||||
|
@ -42,6 +42,10 @@ _✨ 基于 [Mirai](https://github.com/mamoe/mirai) 以及 [MiraiGo](https://git
|
||||
<a href="https://github.com/Mrs4s/go-cqhttp/blob/master/CONTRIBUTING.md">参与贡献</a>
|
||||
</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 的文档。
|
||||
|
@ -255,14 +255,8 @@ func LoginInteract() {
|
||||
versionFile := path.Join(global.VersionsPath, fmt.Sprint(int(cli.Device().Protocol))+".json")
|
||||
if global.PathExists(versionFile) {
|
||||
b, err := os.ReadFile(versionFile)
|
||||
if err != nil {
|
||||
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)
|
||||
if err == nil {
|
||||
_ = cli.Device().Protocol.Version().UpdateFromJson(b)
|
||||
}
|
||||
log.Infof("从文件 %s 读取协议版本 %v.", versionFile, cli.Device().Protocol.Version())
|
||||
}
|
||||
@ -321,11 +315,7 @@ func LoginInteract() {
|
||||
log.Infof("如果登录时出现版本过低错误, 可尝试使用 -update-protocol 参数启动")
|
||||
case !isTokenLogin:
|
||||
_ = device.Protocol.Version().UpdateFromJson(remoteVersion)
|
||||
err := os.WriteFile(versionFile, remoteVersion, 0644)
|
||||
log.Infof("协议版本已更新: %s -> %s", currentVersionName, remoteVersionName)
|
||||
if err != nil {
|
||||
log.Warnln("更新协议版本缓存文件", versionFile, "失败:", err)
|
||||
}
|
||||
default:
|
||||
log.Infof("检测到协议更新: %s -> %s", currentVersionName, remoteVersionName)
|
||||
log.Infof("由于使用了会话缓存, 无法自动更新协议, 请删除缓存后重试")
|
||||
@ -493,7 +483,7 @@ func getRemoteLatestProtocolVersion(protocolType int) ([]byte, error) {
|
||||
}
|
||||
response, err := download.Request{URL: url}.Bytes()
|
||||
if err != nil {
|
||||
return download.Request{URL: "https://mirror.ghproxy.com/" + url}.Bytes()
|
||||
return download.Request{URL: "https://ghproxy.com/" + url}.Bytes()
|
||||
}
|
||||
return response, nil
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ func ToMessageContent(e []message.IMessageElement, source message.Source) (r []g
|
||||
// ConvertStringMessage 将消息字符串转为消息元素数组
|
||||
func (bot *CQBot) ConvertStringMessage(spec *onebot.Spec, raw string, sourceType message.SourceType) (r []message.IMessageElement) {
|
||||
elems := msg.ParseString(raw)
|
||||
return bot.ConvertElements(spec, elems, sourceType, false)
|
||||
return bot.ConvertElements(spec, elems, sourceType, true)
|
||||
}
|
||||
|
||||
// ConvertObjectMessage 将消息JSON对象转为消息元素数组
|
||||
|
Reference in New Issue
Block a user