mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +08:00
Merge remote-tracking branch 'upstream/master' into dev
This commit is contained in:
commit
8f7f207891
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -28,7 +28,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup Go environment
|
- name: Setup Go environment
|
||||||
uses: actions/setup-go@v2.1.1
|
uses: actions/setup-go@v2.1.3
|
||||||
with:
|
with:
|
||||||
go-version: 1.15
|
go-version: 1.15
|
||||||
|
|
||||||
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -20,7 +20,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Set RELEASE_VERSION env
|
- name: Set RELEASE_VERSION env
|
||||||
run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF:10}
|
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
|
||||||
- uses: pcrbot/go-release-action@master
|
- uses: pcrbot/go-release-action@master
|
||||||
env:
|
env:
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM golang:1.14.7-alpine AS builder
|
FROM golang:1.15.5-alpine AS builder
|
||||||
|
|
||||||
RUN go env -w GO111MODULE=auto \
|
RUN go env -w GO111MODULE=auto \
|
||||||
&& go env -w CGO_ENABLED=0 \
|
&& go env -w CGO_ENABLED=0 \
|
||||||
|
83
README.md
83
README.md
@ -46,33 +46,34 @@
|
|||||||
<summary>已实现API</summary>
|
<summary>已实现API</summary>
|
||||||
|
|
||||||
##### 注意: 部分API实现与CQHTTP原版略有差异,请参考文档
|
##### 注意: 部分API实现与CQHTTP原版略有差异,请参考文档
|
||||||
| API | 功能 |
|
| API | 功能 |
|
||||||
| ------------------------ | ------------------------------------------------------------ |
|
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
| /get_login_info | [获取登录号信息](https://cqhttp.cc/docs/4.15/#/API?id=get_login_info-获取登录号信息) |
|
| /get_login_info | [获取登录号信息](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#get_login_info-%E8%8E%B7%E5%8F%96%E7%99%BB%E5%BD%95%E5%8F%B7%E4%BF%A1%E6%81%AF) |
|
||||||
| /get_friend_list | [获取好友列表](https://cqhttp.cc/docs/4.15/#/API?id=get_friend_list-获取好友列表) |
|
| /get_friend_list | [获取好友列表](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#get_friend_list-%E8%8E%B7%E5%8F%96%E5%A5%BD%E5%8F%8B%E5%88%97%E8%A1%A8) |
|
||||||
| /get_group_list | [获取群列表](https://cqhttp.cc/docs/4.15/#/API?id=get_group_list-获取群列表) |
|
| /get_group_list | [获取群列表](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#get_group_list-%E8%8E%B7%E5%8F%96%E7%BE%A4%E5%88%97%E8%A1%A8) |
|
||||||
| /get_group_info | [获取群信息](https://cqhttp.cc/docs/4.15/#/API?id=get_group_info-获取群信息) |
|
| /get_group_info | [获取群信息](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#get_group_info-%E8%8E%B7%E5%8F%96%E7%BE%A4%E4%BF%A1%E6%81%AF) |
|
||||||
| /get_group_member_list | [获取群成员列表](https://cqhttp.cc/docs/4.15/#/API?id=get_group_member_list-获取群成员列表) |
|
| /get_group_member_list | [获取群成员列表](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#get_group_member_list-%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%88%90%E5%91%98%E5%88%97%E8%A1%A8) |
|
||||||
| /get_group_member_info | [获取群成员信息](https://cqhttp.cc/docs/4.15/#/API?id=get_group_member_info-获取群成员信息) |
|
| /get_group_member_info | [获取群成员信息](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#get_group_member_info-%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%88%90%E5%91%98%E4%BF%A1%E6%81%AF) |
|
||||||
| /send_msg | [发送消息](https://cqhttp.cc/docs/4.15/#/API?id=send_msg-发送消息) |
|
| /send_msg | [发送消息](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#send_msg-%E5%8F%91%E9%80%81%E6%B6%88%E6%81%AF) |
|
||||||
| /send_group_msg | [发送群消息](https://cqhttp.cc/docs/4.15/#/API?id=send_group_msg-发送群消息) |
|
| /send_group_msg | [发送群消息](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#send_group_msg-%E5%8F%91%E9%80%81%E7%BE%A4%E6%B6%88%E6%81%AF) |
|
||||||
| /send_private_msg | [发送私聊消息](https://cqhttp.cc/docs/4.15/#/API?id=send_private_msg-发送私聊消息) |
|
| /send_private_msg | [发送私聊消息](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#send_private_msg-%E5%8F%91%E9%80%81%E7%A7%81%E8%81%8A%E6%B6%88%E6%81%AF) |
|
||||||
| /delete_msg | [撤回信息](https://cqhttp.cc/docs/4.15/#/API?id=delete_msg-撤回消息) |
|
| /delete_msg | [撤回信息](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#delete_msg-%E6%92%A4%E5%9B%9E%E6%B6%88%E6%81%AF) |
|
||||||
| /set_friend_add_request | [处理加好友请求](https://cqhttp.cc/docs/4.15/#/API?id=set_friend_add_request-处理加好友请求) |
|
| /set_friend_add_request | [处理加好友请求](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#set_friend_add_request-%E5%A4%84%E7%90%86%E5%8A%A0%E5%A5%BD%E5%8F%8B%E8%AF%B7%E6%B1%82) |
|
||||||
| /set_group_add_request | [处理加群请求/邀请](https://cqhttp.cc/docs/4.15/#/API?id=set_group_add_request-处理加群请求/邀请) |
|
| /set_group_add_request | [处理加群请求/邀请](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#set_group_add_request-%E5%A4%84%E7%90%86%E5%8A%A0%E7%BE%A4%E8%AF%B7%E6%B1%82%E9%82%80%E8%AF%B7) |
|
||||||
| /set_group_card | [设置群名片(群备注)](https://cqhttp.cc/docs/4.15/#/API?id=set_group_card-设置群名片(群备注)) |
|
| /set_group_card | [设置群名片(群备注)](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#set_group_card-%E8%AE%BE%E7%BD%AE%E7%BE%A4%E5%90%8D%E7%89%87%E7%BE%A4%E5%A4%87%E6%B3%A8) |
|
||||||
| /set_group_special_title | [设置群组专属头衔](https://cqhttp.cc/docs/4.15/#/API?id=set_group_special_title-设置群组专属头衔) |
|
| /set_group_special_title | [设置群组专属头衔](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#set_group_special_title-%E8%AE%BE%E7%BD%AE%E7%BE%A4%E7%BB%84%E4%B8%93%E5%B1%9E%E5%A4%B4%E8%A1%94) |
|
||||||
| /set_group_kick | [群组T人](https://cqhttp.cc/docs/4.15/#/API?id=set_group_kick-群组踢人) |
|
| /set_group_kick | [群组T人](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#set_group_kick-%E7%BE%A4%E7%BB%84%E8%B8%A2%E4%BA%BA) |
|
||||||
| /set_group_ban | [群组单人禁言](https://cqhttp.cc/docs/4.15/#/API?id=set_group_ban-群组单人禁言) |
|
| /set_group_ban | [群组单人禁言](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#set_group_ban-%E7%BE%A4%E7%BB%84%E5%8D%95%E4%BA%BA%E7%A6%81%E8%A8%80) |
|
||||||
| /set_group_whole_ban | [群组全员禁言](https://cqhttp.cc/docs/4.15/#/API?id=set_group_whole_ban-群组全员禁言) |
|
| /set_group_whole_ban | [群组全员禁言](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#set_group_whole_ban-%E7%BE%A4%E7%BB%84%E5%85%A8%E5%91%98%E7%A6%81%E8%A8%80) |
|
||||||
| /set_group_leave | [退出群组](https://cqhttp.cc/docs/4.15/#/API?id=set_group_leave-退出群组) |
|
| /set_group_leave | [退出群组](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#set_group_leave-%E9%80%80%E5%87%BA%E7%BE%A4%E7%BB%84) |
|
||||||
| /set_group_name | 设置群组名(拓展API) |
|
| /set_group_name | [设置群组名](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#set_group_name-%E8%AE%BE%E7%BD%AE%E7%BE%A4%E5%90%8D) |
|
||||||
| /get_image | 获取图片信息(拓展API) |
|
| /set_restart | [重启go-cqhttp](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#set_restart-%E9%87%8D%E5%90%AF-onebot-%E5%AE%9E%E7%8E%B0) |
|
||||||
| /get_msg | [获取消息]() | <!-- TODO 来人补个链接-->
|
| /get_image | [获取图片信息](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#get_image-%E8%8E%B7%E5%8F%96%E5%9B%BE%E7%89%87) |
|
||||||
| /can_send_image | [检查是否可以发送图片](https://cqhttp.cc/docs/4.15/#/API?id=can_send_image-检查是否可以发送图片) |
|
| /get_msg | [获取消息](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#get_msg-%E8%8E%B7%E5%8F%96%E6%B6%88%E6%81%AF) |
|
||||||
| /can_send_record | [检查是否可以发送语音](https://cqhttp.cc/docs/4.15/#/API?id=can_send_record-检查是否可以发送语音) |
|
| /can_send_image | [检查是否可以发送图片](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#can_send_image-%E6%A3%80%E6%9F%A5%E6%98%AF%E5%90%A6%E5%8F%AF%E4%BB%A5%E5%8F%91%E9%80%81%E5%9B%BE%E7%89%87) |
|
||||||
| /get_status | [获取插件运行状态](https://cqhttp.cc/docs/4.15/#/API?id=get_status-获取插件运行状态) |
|
| /can_send_record | [检查是否可以发送语音](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#can_send_record-%E6%A3%80%E6%9F%A5%E6%98%AF%E5%90%A6%E5%8F%AF%E4%BB%A5%E5%8F%91%E9%80%81%E8%AF%AD%E9%9F%B3) |
|
||||||
| /get_version_info | [获取 酷Q 及 CQHTTP插件的版本信息](https://cqhttp.cc/docs/4.15/#/API?id=get_version_info-获取-酷q-及-cqhttp-插件的版本信息) |
|
| /get_status | [获取插件运行状态](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#get_status-%E8%8E%B7%E5%8F%96%E8%BF%90%E8%A1%8C%E7%8A%B6%E6%80%81) |
|
||||||
|
| /get_version_info | [获取 酷Q 及 CQHTTP插件的版本信息](https://github.com/howmanybots/onebot/blob/master/v11/specs/api/public.md#get_version_info-%E8%8E%B7%E5%8F%96%E7%89%88%E6%9C%AC%E4%BF%A1%E6%81%AF) |
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
@ -80,20 +81,20 @@
|
|||||||
<summary>已实现Event</summary>
|
<summary>已实现Event</summary>
|
||||||
|
|
||||||
##### 注意: 部分Event数据与CQHTTP原版略有差异,请参考文档
|
##### 注意: 部分Event数据与CQHTTP原版略有差异,请参考文档
|
||||||
| Event |
|
| Event |
|
||||||
| ------------------------------------------------------------ |
|
| ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| [私聊信息](https://cqhttp.cc/docs/4.15/#/Post?id=私聊消息) |
|
| [私聊信息](https://github.com/howmanybots/onebot/blob/master/v11/specs/event/message.md#%E7%A7%81%E8%81%8A%E6%B6%88%E6%81%AF) |
|
||||||
| [群消息](https://cqhttp.cc/docs/4.15/#/Post?id=群消息) |
|
| [群消息](https://github.com/howmanybots/onebot/blob/master/v11/specs/event/message.md#%E7%BE%A4%E6%B6%88%E6%81%AF) |
|
||||||
| [群消息撤回(拓展Event)](docs/cqhttp.md#群消息撤回) |
|
| [群消息撤回(拓展Event)](docs/cqhttp.md#群消息撤回) |
|
||||||
| [好友消息撤回(拓展Event)](docs/cqhttp.md#好友消息撤回) |
|
| [好友消息撤回(拓展Event)](docs/cqhttp.md#好友消息撤回) |
|
||||||
| [群内提示事件(拓展Event)(龙王等事件)](docs/cqhttp.md#群内戳一戳) |
|
| [群内提示事件(拓展Event)(龙王等事件)](docs/cqhttp.md#群内戳一戳) |
|
||||||
| [群管理员变动](https://cqhttp.cc/docs/4.15/#/Post?id=群管理员变动) |
|
| [群管理员变动](https://github.com/howmanybots/onebot/blob/master/v11/specs/event/notice.md#%E7%BE%A4%E7%AE%A1%E7%90%86%E5%91%98%E5%8F%98%E5%8A%A8) |
|
||||||
| [群成员减少](https://cqhttp.cc/docs/4.15/#/Post?id=群成员减少) |
|
| [群成员减少](https://github.com/howmanybots/onebot/blob/master/v11/specs/event/notice.md#%E7%BE%A4%E6%88%90%E5%91%98%E5%87%8F%E5%B0%91) |
|
||||||
| [群成员增加](https://cqhttp.cc/docs/4.15/#/Post?id=群成员增加) |
|
| [群成员增加](https://github.com/howmanybots/onebot/blob/master/v11/specs/event/notice.md#%E7%BE%A4%E6%88%90%E5%91%98%E5%A2%9E%E5%8A%A0) |
|
||||||
| [群禁言](https://cqhttp.cc/docs/4.15/#/Post?id=群禁言) |
|
| [群禁言](https://github.com/howmanybots/onebot/blob/master/v11/specs/event/notice.md#%E7%BE%A4%E7%A6%81%E8%A8%80) |
|
||||||
| [群文件上传](https://cqhttp.cc/docs/4.15/#/Post?id=群文件上传) |
|
| [群文件上传](https://github.com/howmanybots/onebot/blob/master/v11/specs/event/notice.md#%E7%BE%A4%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0) |
|
||||||
| [加好友请求](https://cqhttp.cc/docs/4.15/#/Post?id=加好友请求) |
|
| [加好友请求](https://github.com/howmanybots/onebot/blob/master/v11/specs/event/request.md#%E5%8A%A0%E5%A5%BD%E5%8F%8B%E8%AF%B7%E6%B1%82) |
|
||||||
| [加群请求/邀请](https://cqhttp.cc/docs/4.15/#/Post?id=加群请求/邀请) |
|
| [加群请求/邀请](https://github.com/howmanybots/onebot/blob/master/v11/specs/event/request.md#%E5%8A%A0%E7%BE%A4%E8%AF%B7%E6%B1%82%E9%82%80%E8%AF%B7) |
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
@ -516,12 +516,11 @@ func (bot *CQBot) CQSetGroupAdmin(groupId, userId int64, enable bool) MSG {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (bot *CQBot) CQGetVipInfo(userId int64) MSG {
|
func (bot *CQBot) CQGetVipInfo(userId int64) MSG {
|
||||||
msg := MSG{}
|
|
||||||
vip, err := bot.Client.GetVipInfo(userId)
|
vip, err := bot.Client.GetVipInfo(userId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Failed(100)
|
return Failed(100)
|
||||||
}
|
}
|
||||||
msg = MSG{
|
msg := MSG{
|
||||||
"user_id": vip.Uin,
|
"user_id": vip.Uin,
|
||||||
"nickname": vip.Name,
|
"nickname": vip.Name,
|
||||||
"level": vip.Level,
|
"level": vip.Level,
|
||||||
|
@ -5,12 +5,13 @@ import (
|
|||||||
"encoding/gob"
|
"encoding/gob"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/syndtr/goleveldb/leveldb"
|
|
||||||
"hash/crc32"
|
"hash/crc32"
|
||||||
"path"
|
"path"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/syndtr/goleveldb/leveldb"
|
||||||
|
|
||||||
"github.com/Mrs4s/MiraiGo/binary"
|
"github.com/Mrs4s/MiraiGo/binary"
|
||||||
"github.com/Mrs4s/MiraiGo/client"
|
"github.com/Mrs4s/MiraiGo/client"
|
||||||
"github.com/Mrs4s/MiraiGo/message"
|
"github.com/Mrs4s/MiraiGo/message"
|
||||||
@ -56,6 +57,7 @@ func NewQQBot(cli *client.QQClient, conf *global.JsonConfig) *CQBot {
|
|||||||
bot.Client.OnGroupMuted(bot.groupMutedEvent)
|
bot.Client.OnGroupMuted(bot.groupMutedEvent)
|
||||||
bot.Client.OnGroupMessageRecalled(bot.groupRecallEvent)
|
bot.Client.OnGroupMessageRecalled(bot.groupRecallEvent)
|
||||||
bot.Client.OnGroupNotify(bot.groupNotifyEvent)
|
bot.Client.OnGroupNotify(bot.groupNotifyEvent)
|
||||||
|
bot.Client.OnFriendNotify(bot.friendNotifyEvent)
|
||||||
bot.Client.OnFriendMessageRecalled(bot.friendRecallEvent)
|
bot.Client.OnFriendMessageRecalled(bot.friendRecallEvent)
|
||||||
bot.Client.OnReceivedOfflineFile(bot.offlineFileEvent)
|
bot.Client.OnReceivedOfflineFile(bot.offlineFileEvent)
|
||||||
bot.Client.OnJoinGroup(bot.joinGroupEvent)
|
bot.Client.OnJoinGroup(bot.joinGroupEvent)
|
||||||
@ -235,6 +237,10 @@ func (bot *CQBot) SendPrivateMessage(target int64, m *message.SendingMessage) in
|
|||||||
newElem = append(newElem, fm)
|
newElem = append(newElem, fm)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if i, ok := elem.(*PokeElement); ok {
|
||||||
|
bot.Client.SendFriendPoke(i.Target)
|
||||||
|
return 0
|
||||||
|
}
|
||||||
if i, ok := elem.(*message.VoiceElement); ok {
|
if i, ok := elem.(*message.VoiceElement); ok {
|
||||||
fv, err := bot.Client.UploadPrivatePtt(target, i.Data)
|
fv, err := bot.Client.UploadPrivatePtt(target, i.Data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -8,11 +8,6 @@ import (
|
|||||||
xml2 "encoding/xml"
|
xml2 "encoding/xml"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Mrs4s/MiraiGo/binary"
|
|
||||||
"github.com/Mrs4s/MiraiGo/message"
|
|
||||||
"github.com/Mrs4s/go-cqhttp/global"
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
"github.com/tidwall/gjson"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/url"
|
"net/url"
|
||||||
"path"
|
"path"
|
||||||
@ -20,6 +15,12 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/Mrs4s/MiraiGo/binary"
|
||||||
|
"github.com/Mrs4s/MiraiGo/message"
|
||||||
|
"github.com/Mrs4s/go-cqhttp/global"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
"github.com/tidwall/gjson"
|
||||||
)
|
)
|
||||||
|
|
||||||
var matchReg = regexp.MustCompile(`\[CQ:\w+?.*?]`)
|
var matchReg = regexp.MustCompile(`\[CQ:\w+?.*?]`)
|
||||||
@ -182,6 +183,16 @@ func ToArrayMessage(e []message.IMessageElement, code int64, raw ...bool) (r []M
|
|||||||
"data": map[string]string{"file": o.Filename, "url": o.Url},
|
"data": map[string]string{"file": o.Filename, "url": o.Url},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case *message.GroupFlashImgElement:
|
||||||
|
return []MSG{MSG{
|
||||||
|
"type": "image",
|
||||||
|
"data": map[string]string{"file": o.Filename, "type": "flash"},
|
||||||
|
}}
|
||||||
|
case *message.FriendFlashImgElement:
|
||||||
|
return []MSG{MSG{
|
||||||
|
"type": "image",
|
||||||
|
"data": map[string]string{"file": o.Filename, "type": "flash"},
|
||||||
|
}}
|
||||||
case *message.ServiceElement:
|
case *message.ServiceElement:
|
||||||
if isOk := strings.Contains(o.Content, "<?xml"); isOk {
|
if isOk := strings.Contains(o.Content, "<?xml"); isOk {
|
||||||
m = MSG{
|
m = MSG{
|
||||||
@ -254,6 +265,10 @@ func ToStringMessage(e []message.IMessageElement, code int64, raw ...bool) (r st
|
|||||||
r += fmt.Sprintf("[CQ:image,file=%s]", hex.EncodeToString(o.Md5)+".image")
|
r += fmt.Sprintf("[CQ:image,file=%s]", hex.EncodeToString(o.Md5)+".image")
|
||||||
case *message.FriendImageElement:
|
case *message.FriendImageElement:
|
||||||
r += fmt.Sprintf("[CQ:image,file=%s]", hex.EncodeToString(o.Md5)+".image")
|
r += fmt.Sprintf("[CQ:image,file=%s]", hex.EncodeToString(o.Md5)+".image")
|
||||||
|
case *message.GroupFlashImgElement:
|
||||||
|
return fmt.Sprintf("[CQ:image,type=flash,file=%s]", o.Filename)
|
||||||
|
case *message.FriendFlashImgElement:
|
||||||
|
return fmt.Sprintf("[CQ:image,type=flash,file=%s]", o.Filename)
|
||||||
case *message.ServiceElement:
|
case *message.ServiceElement:
|
||||||
if isOk := strings.Contains(o.Content, "<?xml"); isOk {
|
if isOk := strings.Contains(o.Content, "<?xml"); isOk {
|
||||||
r += fmt.Sprintf(`[CQ:xml,data=%s,resid=%d]`, CQCodeEscapeValue(o.Content), o.Id)
|
r += fmt.Sprintf(`[CQ:xml,data=%s,resid=%d]`, CQCodeEscapeValue(o.Content), o.Id)
|
||||||
@ -434,9 +449,6 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (m interf
|
|||||||
}
|
}
|
||||||
|
|
||||||
case "poke":
|
case "poke":
|
||||||
if !group {
|
|
||||||
return nil, errors.New("todo") // TODO: private poke
|
|
||||||
}
|
|
||||||
t, _ := strconv.ParseInt(d["qq"], 10, 64)
|
t, _ := strconv.ParseInt(d["qq"], 10, 64)
|
||||||
return &PokeElement{Target: t}, nil
|
return &PokeElement{Target: t}, nil
|
||||||
case "gift":
|
case "gift":
|
||||||
|
@ -2,16 +2,17 @@ package coolq
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"github.com/Mrs4s/MiraiGo/binary"
|
|
||||||
"github.com/Mrs4s/MiraiGo/client"
|
|
||||||
"github.com/Mrs4s/MiraiGo/message"
|
|
||||||
"github.com/Mrs4s/go-cqhttp/global"
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"path"
|
"path"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/Mrs4s/MiraiGo/binary"
|
||||||
|
"github.com/Mrs4s/MiraiGo/client"
|
||||||
|
"github.com/Mrs4s/MiraiGo/message"
|
||||||
|
"github.com/Mrs4s/go-cqhttp/global"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
var format = "string"
|
var format = "string"
|
||||||
@ -220,7 +221,7 @@ func (bot *CQBot) groupRecallEvent(c *client.QQClient, e *client.GroupMessageRec
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bot *CQBot) groupNotifyEvent(c *client.QQClient, e client.IGroupNotifyEvent) {
|
func (bot *CQBot) groupNotifyEvent(c *client.QQClient, e client.INotifyEvent) {
|
||||||
group := c.FindGroup(e.From())
|
group := c.FindGroup(e.From())
|
||||||
switch notify := e.(type) {
|
switch notify := e.(type) {
|
||||||
case *client.GroupPokeNotifyEvent:
|
case *client.GroupPokeNotifyEvent:
|
||||||
@ -279,6 +280,24 @@ func (bot *CQBot) groupNotifyEvent(c *client.QQClient, e client.IGroupNotifyEven
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (bot *CQBot) friendNotifyEvent(c *client.QQClient, e client.INotifyEvent) {
|
||||||
|
friend := c.FindFriend(e.From())
|
||||||
|
switch notify := e.(type) {
|
||||||
|
case *client.FriendPokeNotifyEvent:
|
||||||
|
log.Infof("好友 %v 戳了戳你.", friend.Nickname)
|
||||||
|
bot.dispatchEventMessage(MSG{
|
||||||
|
"post_type": "notice",
|
||||||
|
"notice_type": "notify",
|
||||||
|
"sub_type": "poke",
|
||||||
|
"self_id": c.Uin,
|
||||||
|
"user_id": notify.Sender,
|
||||||
|
"sender_id": notify.Sender,
|
||||||
|
"target_id": notify.Receiver,
|
||||||
|
"time": time.Now().Unix(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (bot *CQBot) friendRecallEvent(c *client.QQClient, e *client.FriendMessageRecalledEvent) {
|
func (bot *CQBot) friendRecallEvent(c *client.QQClient, e *client.FriendMessageRecalledEvent) {
|
||||||
f := c.FindFriend(e.FriendUin)
|
f := c.FindFriend(e.FriendUin)
|
||||||
gid := ToGlobalId(e.FriendUin, e.MessageId)
|
gid := ToGlobalId(e.FriendUin, e.MessageId)
|
||||||
@ -509,6 +528,28 @@ func (bot *CQBot) checkMedia(e []message.IMessageElement) {
|
|||||||
w.WriteString(i.Url)
|
w.WriteString(i.Url)
|
||||||
}), 0644)
|
}), 0644)
|
||||||
}
|
}
|
||||||
|
case *message.GroupFlashImgElement:
|
||||||
|
filename := hex.EncodeToString(i.Md5) + ".image"
|
||||||
|
if !global.PathExists(path.Join(global.IMAGE_PATH, filename)) {
|
||||||
|
_ = ioutil.WriteFile(path.Join(global.IMAGE_PATH, filename), binary.NewWriterF(func(w *binary.Writer) {
|
||||||
|
w.Write(i.Md5)
|
||||||
|
w.WriteUInt32(uint32(i.Size))
|
||||||
|
w.WriteString(i.Filename)
|
||||||
|
w.WriteString("")
|
||||||
|
}), 0644)
|
||||||
|
}
|
||||||
|
i.Filename = filename
|
||||||
|
case *message.FriendFlashImgElement:
|
||||||
|
filename := hex.EncodeToString(i.Md5) + ".image"
|
||||||
|
if !global.PathExists(path.Join(global.IMAGE_PATH, filename)) {
|
||||||
|
_ = ioutil.WriteFile(path.Join(global.IMAGE_PATH, filename), binary.NewWriterF(func(w *binary.Writer) {
|
||||||
|
w.Write(i.Md5)
|
||||||
|
w.WriteUInt32(uint32(i.Size))
|
||||||
|
w.WriteString(i.Filename)
|
||||||
|
w.WriteString("")
|
||||||
|
}), 0644)
|
||||||
|
}
|
||||||
|
i.Filename = filename
|
||||||
case *message.VoiceElement:
|
case *message.VoiceElement:
|
||||||
i.Name = strings.ReplaceAll(i.Name, "{", "")
|
i.Name = strings.ReplaceAll(i.Name, "{", "")
|
||||||
i.Name = strings.ReplaceAll(i.Name, "}", "")
|
i.Name = strings.ReplaceAll(i.Name, "}", "")
|
||||||
|
@ -110,16 +110,16 @@
|
|||||||
|
|
||||||
下面列出所有运算符(「要求的参数类型」是指运算符的键所对应的值的类型,「可作用于的类型」是指在过滤时事件对象相应值的类型):
|
下面列出所有运算符(「要求的参数类型」是指运算符的键所对应的值的类型,「可作用于的类型」是指在过滤时事件对象相应值的类型):
|
||||||
|
|
||||||
| 运算符 | 要求的参数类型 | 可作用于的类型 |
|
| 运算符 | 要求的参数类型 | 可作用于的类型 |
|
||||||
| ----- | ------------ | ----------- |
|
| ----------- | -------------------------- | ----------------------------------------------------- |
|
||||||
| `.not` | object | 任何 |
|
| `.not` | object | 任何 |
|
||||||
| `.and` | object | 若参数中全为运算符,则任何;若不全为运算符,则 object |
|
| `.and` | object | 若参数中全为运算符,则任何;若不全为运算符,则 object |
|
||||||
| `.or` | array(数组元素为 object) | 任何 |
|
| `.or` | array(数组元素为 object) | 任何 |
|
||||||
| `.eq` | 任何 | 任何 |
|
| `.eq` | 任何 | 任何 |
|
||||||
| `.neq` | 任何 | 任何 |
|
| `.neq` | 任何 | 任何 |
|
||||||
| `.in` | string/array | 若参数为 string,则 string;若参数为 array,则任何 |
|
| `.in` | string/array | 若参数为 string,则 string;若参数为 array,则任何 |
|
||||||
| `.contains` | string | string |
|
| `.contains` | string | string |
|
||||||
| `.regex` | string | string |
|
| `.regex` | string | string |
|
||||||
|
|
||||||
|
|
||||||
## 过滤时的事件数据对象
|
## 过滤时的事件数据对象
|
||||||
|
123
docs/adminApi.md
123
docs/adminApi.md
@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
参数:
|
参数:
|
||||||
|
|
||||||
| 参数名 | 类型 | 说明 |
|
| 参数名 | 类型 | 说明 |
|
||||||
| ------ | ------ | ----------- |
|
| ------------ | ------ | --------------------------- |
|
||||||
| access_token | string | 校验口令,config.json中配置 |
|
| access_token | string | 校验口令,config.json中配置 |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -24,9 +24,9 @@ method:`POST/GET`
|
|||||||
|
|
||||||
参数:
|
参数:
|
||||||
|
|
||||||
| 参数名 | 类型 | 说明 |
|
| 参数名 | 类型 | 说明 |
|
||||||
| ------ | ---- | ------------------------------------- |
|
| ------ | ---- | ---- |
|
||||||
| 无|||
|
| 无 | | |
|
||||||
|
|
||||||
返回:
|
返回:
|
||||||
|
|
||||||
@ -44,19 +44,19 @@ method: `GET`
|
|||||||
|
|
||||||
参数:
|
参数:
|
||||||
|
|
||||||
| 参数名 | 类型 | 说明 |
|
| 参数名 | 类型 | 说明 |
|
||||||
| ------ | ------ | ----------- |
|
| ------ | ---- | ---- |
|
||||||
| 无|||
|
| 无 | | |
|
||||||
|
|
||||||
返回:
|
返回:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{"data": {"ispic": true,"picbase64":"xxxxx"}, "retcode": 0, "status": "ok"}
|
{"data": {"ispic": true,"picbase64":"xxxxx"}, "retcode": 0, "status": "ok"}
|
||||||
```
|
```
|
||||||
| 参数名 | 类型 | 说明 |
|
| 参数名 | 类型 | 说明 |
|
||||||
| ------ | ------ | ----------- |
|
| -------- | ------ | --------------------------------------------------- |
|
||||||
| ispic| bool| 是否是验证码类型 true是,false为不是(比如设备锁|
|
| ispic | bool | 是否是验证码类型 true是,false为不是(比如设备锁 |
|
||||||
|picbas64| string| 验证码的base64编码内容,加上头,放入img标签即可显示|
|
| picbas64 | string | 验证码的base64编码内容,加上头,放入img标签即可显示 |
|
||||||
|
|
||||||
### admin/do_web_write
|
### admin/do_web_write
|
||||||
|
|
||||||
@ -67,9 +67,9 @@ method: `POST` formdata
|
|||||||
|
|
||||||
参数:
|
参数:
|
||||||
|
|
||||||
| 参数名 | 类型 | 说明 |
|
| 参数名 | 类型 | 说明 |
|
||||||
| ------ | ------ | ----------- |
|
| ------ | ------ | ---------- |
|
||||||
| input | string | 输入的类容 |
|
| input | string | 输入的内容 |
|
||||||
|
|
||||||
返回:
|
返回:
|
||||||
|
|
||||||
@ -89,9 +89,28 @@ method: `POST`
|
|||||||
|
|
||||||
参数:
|
参数:
|
||||||
|
|
||||||
| 参数名 |类型 | 说明 |
|
| 参数名 | 类型 | 说明 |
|
||||||
| ------ | ------ | -----------|
|
| ------ | ---- | ---- |
|
||||||
| 无 | | |
|
| 无 | | |
|
||||||
|
|
||||||
|
返回:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"data": {}, "retcode": 0, "status": "ok"}
|
||||||
|
```
|
||||||
|
|
||||||
|
### admin/do_process_restart
|
||||||
|
|
||||||
|
> 冷重启
|
||||||
|
|
||||||
|
method: `POST`
|
||||||
|
|
||||||
|
|
||||||
|
参数:
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 说明 |
|
||||||
|
| ------ | ---- | ---- |
|
||||||
|
| 无 | | |
|
||||||
|
|
||||||
返回:
|
返回:
|
||||||
|
|
||||||
@ -108,12 +127,12 @@ method: `POST` formdata
|
|||||||
|
|
||||||
参数:
|
参数:
|
||||||
|
|
||||||
| 参数名 | 类型 | 说明 |
|
| 参数名 | 类型 | 说明 |
|
||||||
| ------ | ------ | ------------------------------------------------------------ |
|
| ------------ | ------ | ------------------------------------- |
|
||||||
| uin | string | qq号 |
|
| uin | string | qq号 |
|
||||||
| password | string | qq密码 |
|
| password | string | qq密码 |
|
||||||
| enable_db | string | 是否启动数据库,填 'true' 或者 'false' |
|
| enable_db | string | 是否启动数据库,填 'true' 或者 'false' |
|
||||||
| access_token | string | 授权 token |
|
| access_token | string | 授权 token |
|
||||||
|
|
||||||
返回:
|
返回:
|
||||||
|
|
||||||
@ -130,14 +149,14 @@ method: `POST` formdata
|
|||||||
|
|
||||||
参数:
|
参数:
|
||||||
|
|
||||||
| 参数名 | 类型 | 说明 |
|
| 参数名 | 类型 | 说明 |
|
||||||
| ------ | ------ | ------------------------------------------------------------ |
|
| ----------- | ------ | --------------------------------------------- |
|
||||||
| port | string | 服务端口 |
|
| port | string | 服务端口 |
|
||||||
| host | string | 服务监听地址 |
|
| host | string | 服务监听地址 |
|
||||||
| enable | string | 是否启用 ,填 'true' 或者 'false' |
|
| enable | string | 是否启用 ,填 'true' 或者 'false' |
|
||||||
| timeout | string | http请求超时时间 |
|
| timeout | string | http请求超时时间 |
|
||||||
| post_url | string | post上报地址 不需要就填空字符串,或者不填|
|
| post_url | string | post上报地址 不需要就填空字符串,或者不填 |
|
||||||
| post_secret | string | post上报的secret 不需要就填空字符串,或者不填 |
|
| post_secret | string | post上报的secret 不需要就填空字符串,或者不填 |
|
||||||
|
|
||||||
返回:
|
返回:
|
||||||
|
|
||||||
@ -154,11 +173,11 @@ method: `POST` formdata
|
|||||||
|
|
||||||
参数:
|
参数:
|
||||||
|
|
||||||
| 参数名 | 类型 | 说明 |
|
| 参数名 | 类型 | 说明 |
|
||||||
| ------ | ------ | ------------------------------------------------------------ |
|
| ------ | ------ | -------------------------------- |
|
||||||
| port | string | 服务端口 |
|
| port | string | 服务端口 |
|
||||||
| host | string | 服务监听地址 |
|
| host | string | 服务监听地址 |
|
||||||
| enable | string | 是否启用 ,填 'true' 或者 'false' |
|
| enable | string | 是否启用 ,填 'true' 或者 'false' |
|
||||||
|
|
||||||
|
|
||||||
返回:
|
返回:
|
||||||
@ -175,11 +194,11 @@ method: `POST` formdata
|
|||||||
|
|
||||||
参数:
|
参数:
|
||||||
|
|
||||||
| 参数名 | 类型 | 说明 |
|
| 参数名 | 类型 | 说明 |
|
||||||
| ------ | ------ | ------------------------------------------------------------ |
|
| ------ | ------ | -------------------------------- |
|
||||||
| port | string | 服务端口 |
|
| port | string | 服务端口 |
|
||||||
| host | string | 服务监听地址 |
|
| host | string | 服务监听地址 |
|
||||||
| enable | string | 是否启用 ,填 'true' 或者 'false' |
|
| enable | string | 是否启用 ,填 'true' 或者 'false' |
|
||||||
|
|
||||||
|
|
||||||
返回:
|
返回:
|
||||||
@ -196,9 +215,9 @@ method: `POST` formdata
|
|||||||
|
|
||||||
参数:
|
参数:
|
||||||
|
|
||||||
| 参数名 | 类型 | 说明 |
|
| 参数名 | 类型 | 说明 |
|
||||||
| ------ | ------ | ------------------------------------------------------------ |
|
| ------ | ------ | ----------------------------------- |
|
||||||
| json | string | 完整的config.json的配合,json字符串 |
|
| json | string | 完整的config.json的配合,json字符串 |
|
||||||
|
|
||||||
|
|
||||||
返回:
|
返回:
|
||||||
@ -215,9 +234,9 @@ method: `GET`
|
|||||||
|
|
||||||
参数:
|
参数:
|
||||||
|
|
||||||
| 参数名 | 类型 | 说明 |
|
| 参数名 | 类型 | 说明 |
|
||||||
| ------ | ------ | ------------------------------------------------------------ |
|
| ------ | ---- | ---- |
|
||||||
| 无 | | |
|
| 无 | | |
|
||||||
|
|
||||||
|
|
||||||
返回:
|
返回:
|
||||||
@ -226,7 +245,7 @@ method: `GET`
|
|||||||
{"data": {"config":"xxxx"}, "retcode": 0, "status": "ok"}
|
{"data": {"config":"xxxx"}, "retcode": 0, "status": "ok"}
|
||||||
```
|
```
|
||||||
|
|
||||||
| 参数名 | 类型 | 说明 |
|
| 参数名 | 类型 | 说明 |
|
||||||
| ------ | ------ | ------------------------------------------------------------ |
|
| ------ | ------ | ----------------------------------- |
|
||||||
| config | string | 完整的config.json的配合,json字符串 |
|
| config | string | 完整的config.json的配合,json字符串 |
|
||||||
|
|
||||||
|
@ -61,29 +61,29 @@ go-cqhttp 支持导入CQHTTP的配置文件, 具体步骤为:
|
|||||||
}
|
}
|
||||||
````
|
````
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| ------------------ | -------- | ------------------------------------------------------------------- |
|
| --------------------- | -------- | ---------------------------------------------------------------------------------------- |
|
||||||
| uin | int64 | 登录用QQ号 |
|
| uin | int64 | 登录用QQ号 |
|
||||||
| password | string | 登录用密码 |
|
| password | string | 登录用密码 |
|
||||||
| encrypt_password | bool | 是否对密码进行加密. |
|
| encrypt_password | bool | 是否对密码进行加密. |
|
||||||
| password_encrypted | string | 加密后的密码(请勿修改) |
|
| password_encrypted | string | 加密后的密码(请勿修改) |
|
||||||
| enable_db | bool | 是否开启内置数据库, 关闭后将无法使用 **回复/撤回** 等上下文相关接口 |
|
| enable_db | bool | 是否开启内置数据库, 关闭后将无法使用 **回复/撤回** 等上下文相关接口 |
|
||||||
| access_token | string | 同CQHTTP的 `access_token` 用于身份验证 |
|
| access_token | string | 同CQHTTP的 `access_token` 用于身份验证 |
|
||||||
| relogin | bool | 是否自动重新登录 |
|
| relogin | bool | 是否自动重新登录 |
|
||||||
| relogin_delay | int | 重登录延时(秒) |
|
| relogin_delay | int | 重登录延时(秒) |
|
||||||
| max_relogin_times | uint | 最大重登录次数,若0则不设置上限 |
|
| max_relogin_times | uint | 最大重登录次数,若0则不设置上限 |
|
||||||
| _rate_limit | bool | 是否启用API调用限速 |
|
| _rate_limit | bool | 是否启用API调用限速 |
|
||||||
| frequency | float64 | 1s内能调用API的次数 |
|
| frequency | float64 | 1s内能调用API的次数 |
|
||||||
| bucket_size | int | 令牌桶的大小,默认为1,修改此值可允许一定程度内连续调用api |
|
| bucket_size | int | 令牌桶的大小,默认为1,修改此值可允许一定程度内连续调用api |
|
||||||
| post_message_format | string | 上报信息类型 |
|
| post_message_format | string | 上报信息类型 |
|
||||||
| ignore_invalid_cqcode| bool | 是否忽略错误的CQ码 |
|
| ignore_invalid_cqcode | bool | 是否忽略错误的CQ码 |
|
||||||
| force_fragmented | bool | 是否强制分片发送群长消息 |
|
| force_fragmented | bool | 是否强制分片发送群长消息 |
|
||||||
| use_sso_address | bool | 是否使用服务器下发的地址 |
|
| use_sso_address | bool | 是否使用服务器下发的地址 |
|
||||||
| heartbeat_interval | int64 | 心跳间隔时间,单位秒。小于0则关闭心跳,等于0使用默认值(5秒) |
|
| heartbeat_interval | int64 | 心跳间隔时间,单位秒。小于0则关闭心跳,等于0使用默认值(5秒) |
|
||||||
| http_config | object | HTTP API配置 |
|
| http_config | object | HTTP API配置 |
|
||||||
| ws_config | object | Websocket API 配置 |
|
| ws_config | object | Websocket API 配置 |
|
||||||
| ws_reverse_servers | object[] | 反向 Websocket API 配置 |
|
| ws_reverse_servers | object[] | 反向 Websocket API 配置 |
|
||||||
| log_level | string | 指定日志收集级别,将收集的日志单独存放到固定文件中,便于查看日志线索 当前支持 warn,error|
|
| log_level | string | 指定日志收集级别,将收集的日志单独存放到固定文件中,便于查看日志线索 当前支持 warn,error |
|
||||||
|
|
||||||
> 注: 开启密码加密后程序将在每次启动时要求输入解密密钥, 密钥错误会导致登录时提示密码错误.
|
> 注: 开启密码加密后程序将在每次启动时要求输入解密密钥, 密钥错误会导致登录时提示密码错误.
|
||||||
> 解密后密码将储存在内存中,用于自动重连等功能. 所以此加密并不能防止内存读取.
|
> 解密后密码将储存在内存中,用于自动重连等功能. 所以此加密并不能防止内存读取.
|
||||||
@ -110,11 +110,12 @@ go-cqhttp 支持导入CQHTTP的配置文件, 具体步骤为:
|
|||||||
|
|
||||||
在大部分情况下 我们只需要关心 `protocol` 字段:
|
在大部分情况下 我们只需要关心 `protocol` 字段:
|
||||||
|
|
||||||
| 值 | 类型 | 限制 |
|
| 值 | 类型 | 限制 |
|
||||||
| ---- | ------------- | ----------------------------------------------------- |
|
| --- | ------------- | ---------------------------------------------------------------- |
|
||||||
| 0 | iPad | 无 |
|
| 0 | iPad | 无 |
|
||||||
| 1 | Android Phone | 无 |
|
| 1 | Android Phone | 无法接收新版表情如 `/吃瓜 /汪汪`, 会自动转换为字符串 |
|
||||||
| 2 | Android Watch | 无法接收 `group_notify` 事件、无法接收口令红包、无法接收撤回消息 |
|
| 2 | Android Watch | 除`Android Phone`的限制外, 无法接收 `notify` 事件、无法接收口令红包、无法接收撤回消息 |
|
||||||
|
| 3 | MacOS | 无 |
|
||||||
|
|
||||||
> 注意, 根据协议的不同, 各类消息有所限制
|
> 注意, 根据协议的不同, 各类消息有所限制
|
||||||
|
|
||||||
|
422
docs/cqhttp.md
422
docs/cqhttp.md
@ -6,24 +6,24 @@
|
|||||||
|
|
||||||
### 图片
|
### 图片
|
||||||
|
|
||||||
| 参数名 | 可能的值 | 说明 |
|
| 参数名 | 可能的值 | 说明 |
|
||||||
| --- | --- | --- |
|
| ------- | --------------- | --------------------------------------------------------------- |
|
||||||
| `file` | - | 图片文件名 |
|
| `file` | - | 图片文件名 |
|
||||||
| `type` | `flash`,`show` | 图片类型,`flash` 表示闪照,`show` 表示秀图,默认普通图片 |
|
| `type` | `flash`,`show` | 图片类型,`flash` 表示闪照,`show` 表示秀图,默认普通图片 |
|
||||||
| `url` | - | 图片 URL |
|
| `url` | - | 图片 URL |
|
||||||
| `cache` | `0` `1` | 只在通过网络 URL 发送时有效,表示是否使用已缓存的文件,默认 `1` |
|
| `cache` | `0` `1` | 只在通过网络 URL 发送时有效,表示是否使用已缓存的文件,默认 `1` |
|
||||||
| `id` | - | 发送秀图时的特效id,默认为40000 |
|
| `id` | - | 发送秀图时的特效id,默认为40000 |
|
||||||
|
|
||||||
可用的特效ID:
|
可用的特效ID:
|
||||||
|
|
||||||
| id |类型 |
|
| id | 类型 |
|
||||||
| --- |-------|
|
| ----- | ---- |
|
||||||
| 40000 | 普通 |
|
| 40000 | 普通 |
|
||||||
| 40001 | 幻影 |
|
| 40001 | 幻影 |
|
||||||
| 40002 | 抖动 |
|
| 40002 | 抖动 |
|
||||||
| 40003 | 生日 |
|
| 40003 | 生日 |
|
||||||
| 40004 | 爱你 |
|
| 40004 | 爱你 |
|
||||||
| 40005 | 征友 |
|
| 40005 | 征友 |
|
||||||
|
|
||||||
|
|
||||||
### 回复
|
### 回复
|
||||||
@ -64,9 +64,9 @@ Type: `poke`
|
|||||||
|
|
||||||
参数:
|
参数:
|
||||||
|
|
||||||
| 参数名 | 类型 | 说明 |
|
| 参数名 | 类型 | 说明 |
|
||||||
| ------ | ------ | ----------- |
|
| ------ | ----- | ------------ |
|
||||||
| qq | int64 | 需要戳的成员 |
|
| qq | int64 | 需要戳的成员 |
|
||||||
|
|
||||||
示例: `[CQ:poke,qq=123456]`
|
示例: `[CQ:poke,qq=123456]`
|
||||||
|
|
||||||
@ -80,29 +80,29 @@ Type: `gift`
|
|||||||
|
|
||||||
参数:
|
参数:
|
||||||
|
|
||||||
| 参数名 |类型 | 说明 |
|
| 参数名 | 类型 | 说明 |
|
||||||
| ------ | ------ | -----------|
|
| ------ | ----- | -------------- |
|
||||||
| qq | int64 | 接收礼物的成员 |
|
| qq | int64 | 接收礼物的成员 |
|
||||||
| id | int | 礼物的类型 |
|
| id | int | 礼物的类型 |
|
||||||
|
|
||||||
目前支持的礼物ID:
|
目前支持的礼物ID:
|
||||||
|
|
||||||
| id |类型 |
|
| id | 类型 |
|
||||||
| ---| ---------|
|
| --- | ---------- |
|
||||||
| 0 | 甜Wink |
|
| 0 | 甜Wink |
|
||||||
| 1 | 快乐肥宅水|
|
| 1 | 快乐肥宅水 |
|
||||||
| 2 | 幸运手链 |
|
| 2 | 幸运手链 |
|
||||||
| 3 | 卡布奇诺 |
|
| 3 | 卡布奇诺 |
|
||||||
| 4 | 猫咪手表 |
|
| 4 | 猫咪手表 |
|
||||||
| 5 | 绒绒手套 |
|
| 5 | 绒绒手套 |
|
||||||
| 6 | 彩虹糖果 |
|
| 6 | 彩虹糖果 |
|
||||||
| 7 | 坚强 |
|
| 7 | 坚强 |
|
||||||
| 8 | 告白话筒 |
|
| 8 | 告白话筒 |
|
||||||
| 9 | 牵你的手 |
|
| 9 | 牵你的手 |
|
||||||
| 10 | 可爱猫咪 |
|
| 10 | 可爱猫咪 |
|
||||||
| 11 | 神秘面具 |
|
| 11 | 神秘面具 |
|
||||||
| 12 | 我超忙的 |
|
| 12 | 我超忙的 |
|
||||||
| 13 | 爱心口罩 |
|
| 13 | 爱心口罩 |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -116,8 +116,8 @@ Type: `forward`
|
|||||||
|
|
||||||
参数:
|
参数:
|
||||||
|
|
||||||
| 参数名 | 类型 | 说明 |
|
| 参数名 | 类型 | 说明 |
|
||||||
| ------ | ------ | ------------------------------------------------------------ |
|
| ------ | ------ | ------------------------------------------------------------- |
|
||||||
| id | string | 合并转发ID, 需要通过 `/get_forward_msg` API获取转发的具体内容 |
|
| id | string | 合并转发ID, 需要通过 `/get_forward_msg` API获取转发的具体内容 |
|
||||||
|
|
||||||
示例: `[CQ:forward,id=xxxx]`
|
示例: `[CQ:forward,id=xxxx]`
|
||||||
@ -130,12 +130,12 @@ Type: `node`
|
|||||||
|
|
||||||
参数:
|
参数:
|
||||||
|
|
||||||
| 参数名 | 类型 | 说明 | 特殊说明 |
|
| 参数名 | 类型 | 说明 | 特殊说明 |
|
||||||
| ------- | ------- | -------------- | ------------------------------------------------------------ |
|
| ------- | ------- | -------------- | -------------------------------------------------------------------------------------- |
|
||||||
| id | int32 | 转发消息id | 直接引用他人的消息合并转发, 实际查看顺序为原消息发送顺序 **与下面的自定义消息二选一** |
|
| id | int32 | 转发消息id | 直接引用他人的消息合并转发, 实际查看顺序为原消息发送顺序 **与下面的自定义消息二选一** |
|
||||||
| name | string | 发送者显示名字 | 用于自定义消息 (自定义消息并合并转发,实际查看顺序为自定义消息段顺序) |
|
| name | string | 发送者显示名字 | 用于自定义消息 (自定义消息并合并转发,实际查看顺序为自定义消息段顺序) |
|
||||||
| uin | int64 | 发送者QQ号 | 用于自定义消息 |
|
| uin | int64 | 发送者QQ号 | 用于自定义消息 |
|
||||||
| content | message | 具体消息 | 用于自定义消息 **不支持转发套娃,不支持引用回复** |
|
| content | message | 具体消息 | 用于自定义消息 **不支持转发套娃,不支持引用回复** |
|
||||||
|
|
||||||
特殊说明: **需要使用单独的API `/send_group_forward_msg` 发送,并且由于消息段较为复杂,仅支持Array形式入参。 如果引用消息和自定义消息同时出现,实际查看顺序将取消息段顺序. 另外按 [CQHTTP](https://cqhttp.cc/docs/4.15/#/Message?id=格式) 文档说明, `data` 应全为字符串, 但由于需要接收`message` 类型的消息, 所以 *仅限此Type的content字段* 支持Array套娃**
|
特殊说明: **需要使用单独的API `/send_group_forward_msg` 发送,并且由于消息段较为复杂,仅支持Array形式入参。 如果引用消息和自定义消息同时出现,实际查看顺序将取消息段顺序. 另外按 [CQHTTP](https://cqhttp.cc/docs/4.15/#/Message?id=格式) 文档说明, `data` 应全为字符串, 但由于需要接收`message` 类型的消息, 所以 *仅限此Type的content字段* 支持Array套娃**
|
||||||
|
|
||||||
@ -217,10 +217,10 @@ Type: `xml`
|
|||||||
|
|
||||||
参数:
|
参数:
|
||||||
|
|
||||||
| 参数名 | 类型 | 说明 |
|
| 参数名 | 类型 | 说明 |
|
||||||
| ------ | ------ | ------------------------------------------------------------ |
|
| ------ | ------ | ----------------------------------------- |
|
||||||
| data | string | xml内容,xml中的value部分,记得实体化处理|
|
| data | string | xml内容,xml中的value部分,记得实体化处理 |
|
||||||
| resid | int32 | 可以不填|
|
| resid | int32 | 可以不填 |
|
||||||
|
|
||||||
示例: `[CQ:xml,data=xxxx]`
|
示例: `[CQ:xml,data=xxxx]`
|
||||||
|
|
||||||
@ -266,10 +266,10 @@ Type: `json`
|
|||||||
|
|
||||||
参数:
|
参数:
|
||||||
|
|
||||||
| 参数名 | 类型 | 说明 |
|
| 参数名 | 类型 | 说明 |
|
||||||
| ------ | ------ | ------------------------------------------------------------ |
|
| ------ | ------ | ----------------------------------------------- |
|
||||||
| data | string | json内容,json的所有字符串记得实体化处理|
|
| data | string | json内容,json的所有字符串记得实体化处理 |
|
||||||
| resid | int32 | 默认不填为0,走小程序通道,填了走富文本通道发送|
|
| resid | int32 | 默认不填为0,走小程序通道,填了走富文本通道发送 |
|
||||||
|
|
||||||
json中的字符串需要进行转义:
|
json中的字符串需要进行转义:
|
||||||
|
|
||||||
@ -299,15 +299,15 @@ Type: `cardimage`
|
|||||||
|
|
||||||
参数:
|
参数:
|
||||||
|
|
||||||
| 参数名 | 类型 | 说明 |
|
| 参数名 | 类型 | 说明 |
|
||||||
| ------ | ------ | ------------------------------------------------------------ |
|
| --------- | ------ | ------------------------------------- |
|
||||||
| file | string | 和image的file字段对齐,支持也是一样的|
|
| file | string | 和image的file字段对齐,支持也是一样的 |
|
||||||
| minwidth | int64 | 默认不填为400,最小width|
|
| minwidth | int64 | 默认不填为400,最小width |
|
||||||
| minheight | int64 | 默认不填为400,最小height|
|
| minheight | int64 | 默认不填为400,最小height |
|
||||||
| maxwidth | int64 | 默认不填为500,最大width|
|
| maxwidth | int64 | 默认不填为500,最大width |
|
||||||
| maxheight | int64 | 默认不填为1000,最大height|
|
| maxheight | int64 | 默认不填为1000,最大height |
|
||||||
| source | string | 分享来源的名称,可以留空|
|
| source | string | 分享来源的名称,可以留空 |
|
||||||
| icon | string | 分享来源的icon图标url,可以留空|
|
| icon | string | 分享来源的icon图标url,可以留空 |
|
||||||
|
|
||||||
|
|
||||||
示例cardimage 的cq码:
|
示例cardimage 的cq码:
|
||||||
@ -325,9 +325,9 @@ Type: `tts`
|
|||||||
|
|
||||||
参数:
|
参数:
|
||||||
|
|
||||||
| 参数名 | 类型 | 说明 |
|
| 参数名 | 类型 | 说明 |
|
||||||
| ------ | ------ | ----------- |
|
| ------ | ------ | ---- |
|
||||||
| text | string | 内容 |
|
| text | string | 内容 |
|
||||||
|
|
||||||
示例: `[CQ:tts,text=这是一条测试消息]`
|
示例: `[CQ:tts,text=这是一条测试消息]`
|
||||||
|
|
||||||
@ -339,10 +339,10 @@ Type: `tts`
|
|||||||
|
|
||||||
**参数**
|
**参数**
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| -------- | ------ | ---- |
|
| ---------- | ------ | ---- |
|
||||||
| group_id | int64 | 群号 |
|
| group_id | int64 | 群号 |
|
||||||
| group_name | string | 新名 |
|
| group_name | string | 新名 |
|
||||||
|
|
||||||
### 设置群头像
|
### 设置群头像
|
||||||
|
|
||||||
@ -350,11 +350,11 @@ Type: `tts`
|
|||||||
|
|
||||||
**参数**
|
**参数**
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| -------- | ------ | ---- |
|
| -------- | ------ | ------------------------ |
|
||||||
| group_id | int64 | 群号 |
|
| group_id | int64 | 群号 |
|
||||||
| file | string | 图片文件名 |
|
| file | string | 图片文件名 |
|
||||||
| cache | int | 表示是否使用已缓存的文件 |
|
| cache | int | 表示是否使用已缓存的文件 |
|
||||||
|
|
||||||
[1]`file` 参数支持以下几种格式:
|
[1]`file` 参数支持以下几种格式:
|
||||||
|
|
||||||
@ -468,15 +468,15 @@ Type: `tts`
|
|||||||
|
|
||||||
**参数**
|
**参数**
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| ------------ | ------ | ------ |
|
| --------- | ------ | ---- |
|
||||||
| `content` | string | 内容 |
|
| `content` | string | 内容 |
|
||||||
|
|
||||||
**响应数据**
|
**响应数据**
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| ---------- | ----------------- | -------- |
|
| -------- | -------- | ---- |
|
||||||
| `slices` | string[] | 词组 |
|
| `slices` | string[] | 词组 |
|
||||||
|
|
||||||
### 图片OCR
|
### 图片OCR
|
||||||
|
|
||||||
@ -486,24 +486,24 @@ Type: `tts`
|
|||||||
|
|
||||||
**参数**
|
**参数**
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| ------------ | ------ | ------ |
|
| ------- | ------ | ------ |
|
||||||
| `image` | string | 图片ID |
|
| `image` | string | 图片ID |
|
||||||
|
|
||||||
**响应数据**
|
**响应数据**
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| ---------- | ----------------- | -------- |
|
| ---------- | --------------- | ------- |
|
||||||
| `texts` | TextDetection[] | OCR结果 |
|
| `texts` | TextDetection[] | OCR结果 |
|
||||||
| `language` | string | 语言 |
|
| `language` | string | 语言 |
|
||||||
|
|
||||||
**TextDetection**
|
**TextDetection**
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| ---------- | ----------------- | -------- |
|
| ------------- | ------- | ------ |
|
||||||
| `text` | string | 文本 |
|
| `text` | string | 文本 |
|
||||||
| `confidence`| int32 | 置信度 |
|
| `confidence` | int32 | 置信度 |
|
||||||
| `coordinates` | vector2 | 坐标 |
|
| `coordinates` | vector2 | 坐标 |
|
||||||
|
|
||||||
|
|
||||||
### 获取群系统消息
|
### 获取群系统消息
|
||||||
@ -512,37 +512,37 @@ Type: `tts`
|
|||||||
|
|
||||||
**响应数据**
|
**响应数据**
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| ---------- | ----------------- | -------- |
|
| ------------------ | ---------------- | ------------ |
|
||||||
| `invited_requests` | InvitedRequest[] | 邀请消息列表 |
|
| `invited_requests` | InvitedRequest[] | 邀请消息列表 |
|
||||||
| `join_requests` | JoinRequest[] | 进群消息列表 |
|
| `join_requests` | JoinRequest[] | 进群消息列表 |
|
||||||
|
|
||||||
> 注意: 如果列表不存在任何消息, 将返回 `null`
|
> 注意: 如果列表不存在任何消息, 将返回 `null`
|
||||||
|
|
||||||
**InvitedRequest**
|
**InvitedRequest**
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| ---------- | ----------------- | -------- |
|
| -------------- | ------ | ----------------- |
|
||||||
| `request_id` | int64 | 请求ID |
|
| `request_id` | int64 | 请求ID |
|
||||||
| `invitor_uin` | int64 | 邀请者 |
|
| `invitor_uin` | int64 | 邀请者 |
|
||||||
| `invitor_nick` | string | 邀请者昵称 |
|
| `invitor_nick` | string | 邀请者昵称 |
|
||||||
| `group_id` | int64 | 群号 |
|
| `group_id` | int64 | 群号 |
|
||||||
| `group_name` | string | 群名 |
|
| `group_name` | string | 群名 |
|
||||||
| `checked` | bool | 是否已被处理|
|
| `checked` | bool | 是否已被处理 |
|
||||||
| `actor` | int64 | 处理者, 未处理为0 |
|
| `actor` | int64 | 处理者, 未处理为0 |
|
||||||
|
|
||||||
**JoinRequest**
|
**JoinRequest**
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| ---------- | ----------------- | -------- |
|
| ---------------- | ------ | ----------------- |
|
||||||
| `request_id` | int64 | 请求ID |
|
| `request_id` | int64 | 请求ID |
|
||||||
| `requester_uin` | int64 | 请求者ID |
|
| `requester_uin` | int64 | 请求者ID |
|
||||||
| `requester_nick` | string | 请求者昵称 |
|
| `requester_nick` | string | 请求者昵称 |
|
||||||
| `message` | string | 验证消息 |
|
| `message` | string | 验证消息 |
|
||||||
| `group_id` | int64 | 群号 |
|
| `group_id` | int64 | 群号 |
|
||||||
| `group_name` | string | 群名 |
|
| `group_name` | string | 群名 |
|
||||||
| `checked` | bool | 是否已被处理|
|
| `checked` | bool | 是否已被处理 |
|
||||||
| `actor` | int64 | 处理者, 未处理为0 |
|
| `actor` | int64 | 处理者, 未处理为0 |
|
||||||
|
|
||||||
### 获取群文件系统信息
|
### 获取群文件系统信息
|
||||||
|
|
||||||
@ -550,18 +550,18 @@ Type: `tts`
|
|||||||
|
|
||||||
**参数**
|
**参数**
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| ------------ | ------ | ------ |
|
| ---------- | ----- | ---- |
|
||||||
| `group_id` | int64 | 群号 |
|
| `group_id` | int64 | 群号 |
|
||||||
|
|
||||||
**响应数据**
|
**响应数据**
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| ---------- | ----------------- | -------- |
|
| ------------- | ----- | ---------- |
|
||||||
| `file_count` | int32 | 文件总数 |
|
| `file_count` | int32 | 文件总数 |
|
||||||
| `limit_count` | int32 | 文件上限 |
|
| `limit_count` | int32 | 文件上限 |
|
||||||
| `used_space` | int64 | 已使用空间 |
|
| `used_space` | int64 | 已使用空间 |
|
||||||
| `total_space` | int64 | 空间上限 |
|
| `total_space` | int64 | 空间上限 |
|
||||||
|
|
||||||
### 获取群根目录文件列表
|
### 获取群根目录文件列表
|
||||||
|
|
||||||
@ -571,16 +571,16 @@ Type: `tts`
|
|||||||
|
|
||||||
**参数**
|
**参数**
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| ------------ | ------ | ------ |
|
| ---------- | ----- | ---- |
|
||||||
| `group_id` | int64 | 群号 |
|
| `group_id` | int64 | 群号 |
|
||||||
|
|
||||||
**响应数据**
|
**响应数据**
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| ---------- | ----------------- | -------- |
|
| --------- | -------- | ---------- |
|
||||||
| `files` | File[] | 文件列表 |
|
| `files` | File[] | 文件列表 |
|
||||||
| `folders` | Folder[] | 文件夹列表 |
|
| `folders` | Folder[] | 文件夹列表 |
|
||||||
|
|
||||||
### 获取群子目录文件列表
|
### 获取群子目录文件列表
|
||||||
|
|
||||||
@ -590,17 +590,17 @@ Type: `tts`
|
|||||||
|
|
||||||
**参数**
|
**参数**
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| ------------ | ------ | ------ |
|
| ----------- | ------ | --------------------------- |
|
||||||
| `group_id` | int64 | 群号 |
|
| `group_id` | int64 | 群号 |
|
||||||
| `folder_id` | string | 文件夹ID 参考 `Folder` 对象 |
|
| `folder_id` | string | 文件夹ID 参考 `Folder` 对象 |
|
||||||
|
|
||||||
**响应数据**
|
**响应数据**
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| ---------- | ----------------- | -------- |
|
| --------- | -------- | ---------- |
|
||||||
| `files` | File[] | 文件列表 |
|
| `files` | File[] | 文件列表 |
|
||||||
| `folders` | Folder[] | 文件夹列表 |
|
| `folders` | Folder[] | 文件夹列表 |
|
||||||
|
|
||||||
### 获取群文件资源链接
|
### 获取群文件资源链接
|
||||||
|
|
||||||
@ -610,43 +610,43 @@ Type: `tts`
|
|||||||
|
|
||||||
**参数**
|
**参数**
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| ------------ | ------ | ------ |
|
| ---------- | ------ | ------------------------- |
|
||||||
| `group_id` | int64 | 群号 |
|
| `group_id` | int64 | 群号 |
|
||||||
| `file_id` | string | 文件ID 参考 `File` 对象 |
|
| `file_id` | string | 文件ID 参考 `File` 对象 |
|
||||||
| `busid` | int32 | 文件类型 参考 `File` 对象 |
|
| `busid` | int32 | 文件类型 参考 `File` 对象 |
|
||||||
|
|
||||||
**响应数据**
|
**响应数据**
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| ---------- | ----------------- | -------- |
|
| ----- | ------ | ------------ |
|
||||||
| `url` | string | 文件下载链接 |
|
| `url` | string | 文件下载链接 |
|
||||||
|
|
||||||
**File**
|
**File**
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| ---------- | ----------------- | -------- |
|
| ---------------- | ------ | ---------------------- |
|
||||||
| `file_id` | string | 文件ID |
|
| `file_id` | string | 文件ID |
|
||||||
| `file_name` | string | 文件名 |
|
| `file_name` | string | 文件名 |
|
||||||
| `busid` | int32 | 文件类型 |
|
| `busid` | int32 | 文件类型 |
|
||||||
| `file_size` | int64 | 文件大小 |
|
| `file_size` | int64 | 文件大小 |
|
||||||
| `upload_time` | int64 | 上传时间 |
|
| `upload_time` | int64 | 上传时间 |
|
||||||
| `dead_time` | int64 | 过期时间,永久文件恒为0 |
|
| `dead_time` | int64 | 过期时间,永久文件恒为0 |
|
||||||
| `modify_time` | int64 | 最后修改时间 |
|
| `modify_time` | int64 | 最后修改时间 |
|
||||||
| `download_times` | int32 | 下载次数 |
|
| `download_times` | int32 | 下载次数 |
|
||||||
| `uploader` | int64 | 上传者ID |
|
| `uploader` | int64 | 上传者ID |
|
||||||
| `uploader_name` | string | 上传者名字 |
|
| `uploader_name` | string | 上传者名字 |
|
||||||
|
|
||||||
**Folder**
|
**Folder**
|
||||||
|
|
||||||
| 字段 | 类型 | 说明 |
|
| 字段 | 类型 | 说明 |
|
||||||
| ---------- | ----------------- | -------- |
|
| ------------------ | ------ | ---------- |
|
||||||
| `folder_id` | string | 文件夹ID |
|
| `folder_id` | string | 文件夹ID |
|
||||||
| `folder_name` | string | 文件名 |
|
| `folder_name` | string | 文件名 |
|
||||||
| `create_time` | int64 | 创建时间 |
|
| `create_time` | int64 | 创建时间 |
|
||||||
| `creator` | int64 | 创建者 |
|
| `creator` | int64 | 创建者 |
|
||||||
| `creator_name` | string | 创建者名字 |
|
| `creator_name` | string | 创建者名字 |
|
||||||
| `total_file_count` | int32 | 子文件数量 |
|
| `total_file_count` | int32 | 子文件数量 |
|
||||||
|
|
||||||
## 事件
|
## 事件
|
||||||
|
|
||||||
@ -667,12 +667,12 @@ Type: `tts`
|
|||||||
|
|
||||||
**上报数据**
|
**上报数据**
|
||||||
|
|
||||||
| 字段 | 类型 | 可能的值 | 说明 |
|
| 字段 | 类型 | 可能的值 | 说明 |
|
||||||
| ------------- | ------ | -------------- | -------------- |
|
| ------------- | ------ | --------------- | -------------- |
|
||||||
| `post_type` | string | `notice` | 上报类型 |
|
| `post_type` | string | `notice` | 上报类型 |
|
||||||
| `notice_type` | string | `friend_recall`| 消息类型 |
|
| `notice_type` | string | `friend_recall` | 消息类型 |
|
||||||
| `user_id` | int64 | | 好友id |
|
| `user_id` | int64 | | 好友id |
|
||||||
| `message_id` | int64 | | 被撤回的消息id |
|
| `message_id` | int64 | | 被撤回的消息id |
|
||||||
|
|
||||||
#### 群内戳一戳
|
#### 群内戳一戳
|
||||||
|
|
||||||
@ -680,14 +680,14 @@ Type: `tts`
|
|||||||
|
|
||||||
**上报数据**
|
**上报数据**
|
||||||
|
|
||||||
| 字段 | 类型 | 可能的值 | 说明 |
|
| 字段 | 类型 | 可能的值 | 说明 |
|
||||||
| ------------- | ------ | -------------- | -------------- |
|
| ------------- | ------ | -------- | -------- |
|
||||||
| `post_type` | string | `notice` | 上报类型 |
|
| `post_type` | string | `notice` | 上报类型 |
|
||||||
| `notice_type` | string | `notify` | 消息类型 |
|
| `notice_type` | string | `notify` | 消息类型 |
|
||||||
| `group_id` | int64 | | 群号 |
|
| `group_id` | int64 | | 群号 |
|
||||||
| `sub_type` | string | `poke` | 提示类型 |
|
| `sub_type` | string | `poke` | 提示类型 |
|
||||||
| `user_id` | int64 | | 发送者id |
|
| `user_id` | int64 | | 发送者id |
|
||||||
| `target_id` | int64 | | 被戳者id |
|
| `target_id` | int64 | | 被戳者id |
|
||||||
|
|
||||||
#### 群红包运气王提示
|
#### 群红包运气王提示
|
||||||
|
|
||||||
@ -695,14 +695,14 @@ Type: `tts`
|
|||||||
|
|
||||||
**上报数据**
|
**上报数据**
|
||||||
|
|
||||||
| 字段 | 类型 | 可能的值 | 说明 |
|
| 字段 | 类型 | 可能的值 | 说明 |
|
||||||
| ------------- | ------ | -------------- | -------------- |
|
| ------------- | ------ | ------------ | ------------ |
|
||||||
| `post_type` | string | `notice` | 上报类型 |
|
| `post_type` | string | `notice` | 上报类型 |
|
||||||
| `notice_type` | string | `notify` | 消息类型 |
|
| `notice_type` | string | `notify` | 消息类型 |
|
||||||
| `group_id` | int64 | | 群号 |
|
| `group_id` | int64 | | 群号 |
|
||||||
| `sub_type` | string | `lucky_king` | 提示类型 |
|
| `sub_type` | string | `lucky_king` | 提示类型 |
|
||||||
| `user_id` | int64 | | 红包发送者id |
|
| `user_id` | int64 | | 红包发送者id |
|
||||||
| `target_id` | int64 | | 运气王id |
|
| `target_id` | int64 | | 运气王id |
|
||||||
|
|
||||||
#### 群成员荣誉变更提示
|
#### 群成员荣誉变更提示
|
||||||
|
|
||||||
@ -710,14 +710,14 @@ Type: `tts`
|
|||||||
|
|
||||||
**上报数据**
|
**上报数据**
|
||||||
|
|
||||||
| 字段 | 类型 | 可能的值 | 说明 |
|
| 字段 | 类型 | 可能的值 | 说明 |
|
||||||
| ------------- | ------ | -------------- | -------------- |
|
| ------------- | ------ | -------------------------------------------------------- | -------- |
|
||||||
| `post_type` | string | `notice` | 上报类型 |
|
| `post_type` | string | `notice` | 上报类型 |
|
||||||
| `notice_type` | string | `notify` | 消息类型 |
|
| `notice_type` | string | `notify` | 消息类型 |
|
||||||
| `group_id` | int64 | | 群号 |
|
| `group_id` | int64 | | 群号 |
|
||||||
| `sub_type` | string | `honor` | 提示类型 |
|
| `sub_type` | string | `honor` | 提示类型 |
|
||||||
| `user_id` | int64 | | 成员id |
|
| `user_id` | int64 | | 成员id |
|
||||||
| `honor_type` | string | `talkative:龙王` `performer:群聊之火` `emotion:快乐源泉` | 荣誉类型 |
|
| `honor_type` | string | `talkative:龙王` `performer:群聊之火` `emotion:快乐源泉` | 荣誉类型 |
|
||||||
|
|
||||||
#### 群成员名片更新
|
#### 群成员名片更新
|
||||||
|
|
||||||
@ -725,14 +725,14 @@ Type: `tts`
|
|||||||
|
|
||||||
**上报数据**
|
**上报数据**
|
||||||
|
|
||||||
| 字段 | 类型 | 可能的值 | 说明 |
|
| 字段 | 类型 | 可能的值 | 说明 |
|
||||||
| ------------- | ------ | -------------- | -------------- |
|
| ------------- | ------ | ------------ | -------- |
|
||||||
| `post_type` | string | `notice` | 上报类型 |
|
| `post_type` | string | `notice` | 上报类型 |
|
||||||
| `notice_type` | string | `group_card` | 消息类型 |
|
| `notice_type` | string | `group_card` | 消息类型 |
|
||||||
| `group_id` | int64 | | 群号 |
|
| `group_id` | int64 | | 群号 |
|
||||||
| `user_id` | int64 | | 成员id |
|
| `user_id` | int64 | | 成员id |
|
||||||
| `card_new` | int64 | | 新名片 |
|
| `card_new` | int64 | | 新名片 |
|
||||||
| `card_old` | int64 | | 旧名片 |
|
| `card_old` | int64 | | 旧名片 |
|
||||||
|
|
||||||
> PS: 当名片为空时 `card_xx` 字段为空字符串, 并不是昵称
|
> PS: 当名片为空时 `card_xx` 字段为空字符串, 并不是昵称
|
||||||
|
|
||||||
@ -740,17 +740,17 @@ Type: `tts`
|
|||||||
|
|
||||||
**上报数据**
|
**上报数据**
|
||||||
|
|
||||||
| 字段 | 类型 | 可能的值 | 说明 |
|
| 字段 | 类型 | 可能的值 | 说明 |
|
||||||
| ------------- | ------ | -------------- | -------------- |
|
| ------------- | ------ | -------------- | -------- |
|
||||||
| `post_type` | string | `notice` | 上报类型 |
|
| `post_type` | string | `notice` | 上报类型 |
|
||||||
| `notice_type` | string | `offline_file` | 消息类型 |
|
| `notice_type` | string | `offline_file` | 消息类型 |
|
||||||
| `user_id` | int64 | | 发送者id |
|
| `user_id` | int64 | | 发送者id |
|
||||||
| `file` | object | | 文件数据 |
|
| `file` | object | | 文件数据 |
|
||||||
|
|
||||||
**file object**
|
**file object**
|
||||||
|
|
||||||
| 字段 | 类型 | 可能的值 | 说明 |
|
| 字段 | 类型 | 可能的值 | 说明 |
|
||||||
| ------------- | ------ | -------------- | -------------- |
|
| ------ | ------ | -------- | -------- |
|
||||||
| `name` | string | | 文件名 |
|
| `name` | string | | 文件名 |
|
||||||
| `size` | int64 | | 文件大小 |
|
| `size` | int64 | | 文件大小 |
|
||||||
| `url` | string | | 下载链接 |
|
| `url` | string | | 下载链接 |
|
@ -117,7 +117,7 @@ enable ws?(Y/n)
|
|||||||
|
|
||||||
*注:可以使用*`go env -w GOPROXY=https://goproxy.cn,direct`*来加速国内依赖安装速度*
|
*注:可以使用*`go env -w GOPROXY=https://goproxy.cn,direct`*来加速国内依赖安装速度*
|
||||||
|
|
||||||
*注:此时构建后的文件名为*`main`(Linux)或`main.exe`(Windows)
|
*注:此时构建后的文件名为*`go-cqhttp`(Linux)或`go-cqhttp.exe`(Windows)
|
||||||
|
|
||||||
## 更新
|
## 更新
|
||||||
|
|
||||||
|
@ -4,11 +4,12 @@ import (
|
|||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
"github.com/wdvxdr1123/go-silk/silk"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"path"
|
"path"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
"github.com/wdvxdr1123/go-silk/silk"
|
||||||
)
|
)
|
||||||
|
|
||||||
var codec silk.Encoder
|
var codec silk.Encoder
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package global
|
package global
|
||||||
|
|
||||||
import (
|
import (
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
"github.com/tidwall/gjson"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
"github.com/tidwall/gjson"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Filter interface {
|
type Filter interface {
|
||||||
|
@ -7,8 +7,6 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/dustin/go-humanize"
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
@ -17,6 +15,9 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/dustin/go-humanize"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -121,7 +122,7 @@ func ReadAddrFile(path string) []*net.TCPAddr {
|
|||||||
lines := strings.Split(str, "\n")
|
lines := strings.Split(str, "\n")
|
||||||
var ret []*net.TCPAddr
|
var ret []*net.TCPAddr
|
||||||
for _, l := range lines {
|
for _, l := range lines {
|
||||||
ip := strings.Split(l, ":")
|
ip := strings.Split(strings.TrimSpace(l), ":")
|
||||||
if len(ip) == 2 {
|
if len(ip) == 2 {
|
||||||
port, _ := strconv.Atoi(ip[1])
|
port, _ := strconv.Atoi(ip[1])
|
||||||
ret = append(ret, &net.TCPAddr{IP: net.ParseIP(ip[0]), Port: port})
|
ret = append(ret, &net.TCPAddr{IP: net.ParseIP(ip[0]), Port: port})
|
||||||
|
@ -4,11 +4,12 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/tidwall/gjson"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/tidwall/gjson"
|
||||||
)
|
)
|
||||||
|
|
||||||
var client = &http.Client{
|
var client = &http.Client{
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package global
|
package global
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/tidwall/gjson"
|
|
||||||
"math"
|
"math"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/tidwall/gjson"
|
||||||
)
|
)
|
||||||
|
|
||||||
var trueSet = map[string]struct{}{
|
var trueSet = map[string]struct{}{
|
||||||
|
@ -2,6 +2,7 @@ package global
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"golang.org/x/time/rate"
|
"golang.org/x/time/rate"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
14
go.mod
14
go.mod
@ -3,36 +3,24 @@ module github.com/Mrs4s/go-cqhttp
|
|||||||
go 1.14
|
go 1.14
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Mrs4s/MiraiGo v0.0.0-20201113135440-20e56a777874
|
github.com/Mrs4s/MiraiGo v0.0.0-20201117154121-989187125900
|
||||||
github.com/dustin/go-humanize v1.0.0
|
github.com/dustin/go-humanize v1.0.0
|
||||||
github.com/getlantern/go-update v0.0.0-20190510022740-79c495ab728c
|
github.com/getlantern/go-update v0.0.0-20190510022740-79c495ab728c
|
||||||
github.com/getlantern/golog v0.0.0-20201105130739-9586b8bde3a9 // indirect
|
github.com/getlantern/golog v0.0.0-20201105130739-9586b8bde3a9 // indirect
|
||||||
github.com/getlantern/ops v0.0.0-20200403153110-8476b16edcd6 // indirect
|
|
||||||
github.com/gin-gonic/gin v1.6.3
|
github.com/gin-gonic/gin v1.6.3
|
||||||
github.com/go-playground/validator/v10 v10.4.1 // indirect
|
|
||||||
github.com/golang/snappy v0.0.2 // indirect
|
|
||||||
github.com/gorilla/websocket v1.4.2
|
github.com/gorilla/websocket v1.4.2
|
||||||
github.com/guonaihong/gout v0.1.3
|
github.com/guonaihong/gout v0.1.3
|
||||||
github.com/json-iterator/go v1.1.10 // indirect
|
|
||||||
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
|
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
|
||||||
github.com/kr/binarydist v0.1.0 // indirect
|
github.com/kr/binarydist v0.1.0 // indirect
|
||||||
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
|
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
|
||||||
github.com/lestrrat-go/strftime v1.0.3 // indirect
|
github.com/lestrrat-go/strftime v1.0.3 // indirect
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
|
||||||
github.com/modern-go/reflect2 v1.0.1 // indirect
|
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
|
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
|
||||||
github.com/sirupsen/logrus v1.7.0
|
github.com/sirupsen/logrus v1.7.0
|
||||||
github.com/syndtr/goleveldb v1.0.0
|
github.com/syndtr/goleveldb v1.0.0
|
||||||
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816
|
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816
|
||||||
github.com/tidwall/gjson v1.6.3
|
github.com/tidwall/gjson v1.6.3
|
||||||
github.com/tidwall/match v1.0.2 // indirect
|
|
||||||
github.com/ugorji/go v1.2.0 // indirect
|
|
||||||
github.com/wdvxdr1123/go-silk v0.0.0-20201007123416-b982fd3d91d6
|
github.com/wdvxdr1123/go-silk v0.0.0-20201007123416-b982fd3d91d6
|
||||||
github.com/yinghau76/go-ascii-art v0.0.0-20190517192627-e7f465a30189
|
github.com/yinghau76/go-ascii-art v0.0.0-20190517192627-e7f465a30189
|
||||||
golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9 // indirect
|
|
||||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect
|
|
||||||
golang.org/x/sys v0.0.0-20201113135734-0a15ea8d9b02 // indirect
|
|
||||||
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e
|
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e
|
||||||
gopkg.in/yaml.v2 v2.3.0 // indirect
|
|
||||||
)
|
)
|
||||||
|
41
go.sum
41
go.sum
@ -1,9 +1,7 @@
|
|||||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/Mrs4s/MiraiGo v0.0.0-20201113113825-c1739dba15c9 h1:7mFBaoEz2HCIkUqfiW1EtpsZEhxfupEda8+EMeuNS+4=
|
github.com/Mrs4s/MiraiGo v0.0.0-20201117154121-989187125900 h1:xnx3dH7hgZ/Z4k33EhKzBmQhwASJ5bvsorqPhO0DWbc=
|
||||||
github.com/Mrs4s/MiraiGo v0.0.0-20201113113825-c1739dba15c9/go.mod h1:pAsWtMIwqkBXr5DkUpTIHoWQJNduVnX9WSBPmPvkuCs=
|
github.com/Mrs4s/MiraiGo v0.0.0-20201117154121-989187125900/go.mod h1:pAsWtMIwqkBXr5DkUpTIHoWQJNduVnX9WSBPmPvkuCs=
|
||||||
github.com/Mrs4s/MiraiGo v0.0.0-20201113135440-20e56a777874 h1:lxsD1Ja+TNNtr0S3ogtCzKpy44NoiaNrND9l7+s9Ds0=
|
|
||||||
github.com/Mrs4s/MiraiGo v0.0.0-20201113135440-20e56a777874/go.mod h1:pAsWtMIwqkBXr5DkUpTIHoWQJNduVnX9WSBPmPvkuCs=
|
|
||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@ -27,8 +25,6 @@ github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55 h1:XYzSdCbkzOC0F
|
|||||||
github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55/go.mod h1:6mmzY2kW1TOOrVy+r41Za2MxXM+hhqTtY3oBKd2AgFA=
|
github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55/go.mod h1:6mmzY2kW1TOOrVy+r41Za2MxXM+hhqTtY3oBKd2AgFA=
|
||||||
github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f h1:wrYrQttPS8FHIRSlsrcuKazukx/xqO/PpLZzZXsF+EA=
|
github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f h1:wrYrQttPS8FHIRSlsrcuKazukx/xqO/PpLZzZXsF+EA=
|
||||||
github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f/go.mod h1:D5ao98qkA6pxftxoqzibIBBrLSUli+kYnJqrgBf9cIA=
|
github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f/go.mod h1:D5ao98qkA6pxftxoqzibIBBrLSUli+kYnJqrgBf9cIA=
|
||||||
github.com/getlantern/ops v0.0.0-20200403153110-8476b16edcd6 h1:QthAQCekS1YOeYWSvoHI6ZatlG4B+GBDLxV/2ZkBsTA=
|
|
||||||
github.com/getlantern/ops v0.0.0-20200403153110-8476b16edcd6/go.mod h1:D5ao98qkA6pxftxoqzibIBBrLSUli+kYnJqrgBf9cIA=
|
|
||||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||||
github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do=
|
github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do=
|
||||||
@ -43,8 +39,6 @@ github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD87
|
|||||||
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||||
github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY=
|
github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY=
|
||||||
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
|
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
|
||||||
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
|
|
||||||
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
|
|
||||||
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
|
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
|
||||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||||
@ -62,8 +56,6 @@ github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM
|
|||||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w=
|
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w=
|
||||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
github.com/golang/snappy v0.0.2 h1:aeE13tS0IiQgFjYdoL8qN3K1N2bXXtI6Vi51/y7BpMw=
|
|
||||||
github.com/golang/snappy v0.0.2/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
|
||||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||||
@ -77,10 +69,7 @@ github.com/guonaihong/gout v0.1.3 h1:BIiV6nnsA+R6dIB1P33uhCM8+TVAG3zHrXGZad7hDc8
|
|||||||
github.com/guonaihong/gout v0.1.3/go.mod h1:vXvv5Kxr70eM5wrp4F0+t9lnLWmq+YPW2GByll2f/EA=
|
github.com/guonaihong/gout v0.1.3/go.mod h1:vXvv5Kxr70eM5wrp4F0+t9lnLWmq+YPW2GByll2f/EA=
|
||||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
|
|
||||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
|
|
||||||
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
|
||||||
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uiaSepXwyf3o52HaUYcV+Tu66S3F5GA=
|
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uiaSepXwyf3o52HaUYcV+Tu66S3F5GA=
|
||||||
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
|
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||||
@ -97,14 +86,8 @@ github.com/lestrrat-go/strftime v1.0.3/go.mod h1:E1nN3pCbtMSu1yjSVeyuRFVm/U0xoR7
|
|||||||
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
|
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
|
||||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
|
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
|
||||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
|
|
||||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
|
|
||||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
|
||||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
|
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
|
||||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
||||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||||
@ -136,27 +119,17 @@ github.com/tidwall/gjson v1.6.3 h1:aHoiiem0dr7GHkW001T1SMTJ7X5PvyekH5WX0whWGnI=
|
|||||||
github.com/tidwall/gjson v1.6.3/go.mod h1:BaHyNc5bjzYkPqgLq7mdVzeiRtULKULXLgZFKsxEHI0=
|
github.com/tidwall/gjson v1.6.3/go.mod h1:BaHyNc5bjzYkPqgLq7mdVzeiRtULKULXLgZFKsxEHI0=
|
||||||
github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc=
|
github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc=
|
||||||
github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
|
github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
|
||||||
github.com/tidwall/match v1.0.2 h1:uuqvHuBGSedK7awZ2YoAtpnimfwBGFjHuWLuLqQj+bU=
|
|
||||||
github.com/tidwall/match v1.0.2/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
|
|
||||||
github.com/tidwall/pretty v1.0.2 h1:Z7S3cePv9Jwm1KwS0513MRaoUe3S01WPbLNV40pwWZU=
|
github.com/tidwall/pretty v1.0.2 h1:Z7S3cePv9Jwm1KwS0513MRaoUe3S01WPbLNV40pwWZU=
|
||||||
github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||||
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
|
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
|
||||||
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
||||||
github.com/ugorji/go v1.2.0 h1:6eXlzYLLwZwXroJx9NyqbYcbv/d93twiOzQLDewE6qM=
|
|
||||||
github.com/ugorji/go v1.2.0/go.mod h1:1ny++pKMXhLWrwWV5Nf+CbOuZJhMoaFD+0GMFfd8fEc=
|
|
||||||
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
|
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
|
||||||
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
||||||
github.com/ugorji/go/codec v1.2.0 h1:As6RccOIlbm9wHuWYMlB30dErcI+4WiKWsYsmPkyrUw=
|
|
||||||
github.com/ugorji/go/codec v1.2.0/go.mod h1:dXvG35r7zTX6QImXOSFhGMmKtX+wJ7VTWzGvYQGIjBs=
|
|
||||||
github.com/wdvxdr1123/go-silk v0.0.0-20201007123416-b982fd3d91d6 h1:lX18MCdNzT2zIi7K02x4C5cPkDXpL+wCb1YTAMXjLWQ=
|
github.com/wdvxdr1123/go-silk v0.0.0-20201007123416-b982fd3d91d6 h1:lX18MCdNzT2zIi7K02x4C5cPkDXpL+wCb1YTAMXjLWQ=
|
||||||
github.com/wdvxdr1123/go-silk v0.0.0-20201007123416-b982fd3d91d6/go.mod h1:5q9LFlBr+yX/J8Jd/9wHdXwkkjFkNyQIS7kX2Lgx/Zs=
|
github.com/wdvxdr1123/go-silk v0.0.0-20201007123416-b982fd3d91d6/go.mod h1:5q9LFlBr+yX/J8Jd/9wHdXwkkjFkNyQIS7kX2Lgx/Zs=
|
||||||
github.com/yinghau76/go-ascii-art v0.0.0-20190517192627-e7f465a30189 h1:4UJw9if55Fu3HOwbfcaQlJ27p3oeJU2JZqoeT3ITJQk=
|
github.com/yinghau76/go-ascii-art v0.0.0-20190517192627-e7f465a30189 h1:4UJw9if55Fu3HOwbfcaQlJ27p3oeJU2JZqoeT3ITJQk=
|
||||||
github.com/yinghau76/go-ascii-art v0.0.0-20190517192627-e7f465a30189/go.mod h1:rIrm5geMiBhPQkdfUm8gDFi/WiHneOp1i9KjmJqc+9I=
|
github.com/yinghau76/go-ascii-art v0.0.0-20190517192627-e7f465a30189/go.mod h1:rIrm5geMiBhPQkdfUm8gDFi/WiHneOp1i9KjmJqc+9I=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
|
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
|
||||||
golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9 h1:umElSU9WZirRdgu2yFHY0ayQkEnKiOC1TtM3fWXFnoU=
|
|
||||||
golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||||
@ -166,11 +139,8 @@ golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73r
|
|||||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa h1:F+8P+gmewFQYRk6JoLQLwjBCTu3mcIURZfNkVweuRKA=
|
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa h1:F+8P+gmewFQYRk6JoLQLwjBCTu3mcIURZfNkVweuRKA=
|
||||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME=
|
|
||||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
@ -178,18 +148,13 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
|
|||||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg=
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg=
|
||||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20201113135734-0a15ea8d9b02 h1:5Ftd3YbC/kANXWCBjvppvUmv1BMakgFcBKA7MpYYp4M=
|
|
||||||
golang.org/x/sys v0.0.0-20201113135734-0a15ea8d9b02/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|
||||||
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e h1:EHBhcS0mlXEAVwNyO2dLfjToGsyY4j24pTs2ScHnX7s=
|
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e h1:EHBhcS0mlXEAVwNyO2dLfjToGsyY4j24pTs2ScHnX7s=
|
||||||
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
@ -225,7 +190,5 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
||||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
|
||||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||||
|
111
main.go
111
main.go
@ -2,33 +2,37 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
|
"context"
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Mrs4s/go-cqhttp/server"
|
|
||||||
"github.com/guonaihong/gout"
|
|
||||||
"github.com/tidwall/gjson"
|
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path"
|
"path"
|
||||||
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/Mrs4s/go-cqhttp/server"
|
||||||
|
"github.com/guonaihong/gout"
|
||||||
|
"github.com/tidwall/gjson"
|
||||||
|
|
||||||
"github.com/Mrs4s/MiraiGo/binary"
|
"github.com/Mrs4s/MiraiGo/binary"
|
||||||
"github.com/Mrs4s/MiraiGo/client"
|
"github.com/Mrs4s/MiraiGo/client"
|
||||||
"github.com/Mrs4s/go-cqhttp/coolq"
|
"github.com/Mrs4s/go-cqhttp/coolq"
|
||||||
"github.com/Mrs4s/go-cqhttp/global"
|
"github.com/Mrs4s/go-cqhttp/global"
|
||||||
"github.com/getlantern/go-update"
|
"github.com/getlantern/go-update"
|
||||||
"github.com/lestrrat-go/file-rotatelogs"
|
rotatelogs "github.com/lestrrat-go/file-rotatelogs"
|
||||||
"github.com/rifflock/lfshook"
|
"github.com/rifflock/lfshook"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/t-tomalak/logrus-easy-formatter"
|
easy "github.com/t-tomalak/logrus-easy-formatter"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -93,13 +97,27 @@ func init() {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
console := bufio.NewReader(os.Stdin)
|
console := bufio.NewReader(os.Stdin)
|
||||||
|
var strKey string
|
||||||
|
var isFastStart bool = false
|
||||||
arg := os.Args
|
arg := os.Args
|
||||||
if len(arg) > 1 && arg[1] == "update" {
|
if len(arg) > 1 {
|
||||||
if len(arg) > 2 {
|
for i := range arg {
|
||||||
selfUpdate(arg[2])
|
switch arg[i] {
|
||||||
} else {
|
case "update":
|
||||||
selfUpdate("")
|
if len(arg) > i+1 {
|
||||||
|
selfUpdate(arg[i+1])
|
||||||
|
} else {
|
||||||
|
selfUpdate("")
|
||||||
|
}
|
||||||
|
case "key":
|
||||||
|
if len(arg) > i+1 {
|
||||||
|
b := []byte(arg[i+1])
|
||||||
|
b = append(b, 13, 10)
|
||||||
|
strKey = string(b[:])
|
||||||
|
}
|
||||||
|
case "faststart":
|
||||||
|
isFastStart = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,13 +234,31 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if conf.PasswordEncrypted != "" {
|
if conf.PasswordEncrypted != "" {
|
||||||
log.Infof("密码加密已启用, 请输入Key对密码进行解密以继续: (Enter 提交)")
|
if strKey == "" {
|
||||||
strKey, _ := console.ReadString('\n')
|
log.Infof("密码加密已启用, 请输入Key对密码进行解密以继续: (Enter 提交)")
|
||||||
|
ctx := context.Background()
|
||||||
|
go func(ctx context.Context) {
|
||||||
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
return
|
||||||
|
case <-time.After(time.Second * 45):
|
||||||
|
log.Infof("解密key输入超时")
|
||||||
|
time.Sleep(3 * time.Second)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
}(ctx)
|
||||||
|
strKey, _ = console.ReadString('\n')
|
||||||
|
ctx.Done()
|
||||||
|
} else {
|
||||||
|
log.Infof("密码加密已启用, 使用运行时传递的参数进行解密,按 Ctrl+C 取消.")
|
||||||
|
}
|
||||||
key := md5.Sum([]byte(strKey))
|
key := md5.Sum([]byte(strKey))
|
||||||
conf.Password = DecryptPwd(conf.PasswordEncrypted, key[:])
|
conf.Password = DecryptPwd(conf.PasswordEncrypted, key[:])
|
||||||
}
|
}
|
||||||
log.Info("Bot将在5秒后登录并开始信息处理, 按 Ctrl+C 取消.")
|
if !isFastStart {
|
||||||
time.Sleep(time.Second * 5)
|
log.Info("Bot将在5秒后登录并开始信息处理, 按 Ctrl+C 取消.")
|
||||||
|
time.Sleep(time.Second * 5)
|
||||||
|
}
|
||||||
log.Info("开始尝试登录并同步消息...")
|
log.Info("开始尝试登录并同步消息...")
|
||||||
log.Infof("使用协议: %v", func() string {
|
log.Infof("使用协议: %v", func() string {
|
||||||
switch client.SystemDeviceInfo.Protocol {
|
switch client.SystemDeviceInfo.Protocol {
|
||||||
@ -232,6 +268,8 @@ func main() {
|
|||||||
return "Android Phone"
|
return "Android Phone"
|
||||||
case client.AndroidWatch:
|
case client.AndroidWatch:
|
||||||
return "Android Watch"
|
return "Android Watch"
|
||||||
|
case client.MacOS:
|
||||||
|
return "MacOS"
|
||||||
}
|
}
|
||||||
return "未知"
|
return "未知"
|
||||||
}())
|
}())
|
||||||
@ -282,10 +320,18 @@ func main() {
|
|||||||
}
|
}
|
||||||
b := server.WebServer.Run(fmt.Sprintf("%s:%d", conf.WebUi.Host, conf.WebUi.WebUiPort), cli)
|
b := server.WebServer.Run(fmt.Sprintf("%s:%d", conf.WebUi.Host, conf.WebUi.WebUiPort), cli)
|
||||||
c := server.Console
|
c := server.Console
|
||||||
|
r := server.Restart
|
||||||
go checkUpdate()
|
go checkUpdate()
|
||||||
signal.Notify(c, os.Interrupt, os.Kill)
|
signal.Notify(c, os.Interrupt, os.Kill)
|
||||||
<-c
|
select {
|
||||||
b.Release()
|
case <-c:
|
||||||
|
b.Release()
|
||||||
|
case <-r:
|
||||||
|
log.Info("正在重启中...")
|
||||||
|
server.HttpServer.ShutDown()
|
||||||
|
defer b.Release()
|
||||||
|
restart(arg)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func EncryptPwd(pwd string, key []byte) string {
|
func EncryptPwd(pwd string, key []byte) string {
|
||||||
@ -404,3 +450,34 @@ func selfUpdate(imageUrl string) {
|
|||||||
readLine()
|
readLine()
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func restart(Args []string) {
|
||||||
|
cmd := &exec.Cmd{}
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
file, err := exec.LookPath(Args[0])
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("重启失败:%s", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
path, err := filepath.Abs(file)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("重启失败:%s", err.Error())
|
||||||
|
}
|
||||||
|
Args = append([]string{"/c", "start ", path, "faststart"}, Args[1:]...)
|
||||||
|
cmd = &exec.Cmd{
|
||||||
|
Path: "cmd.exe",
|
||||||
|
Args: Args,
|
||||||
|
Stderr: os.Stderr,
|
||||||
|
Stdout: os.Stdout,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Args = append(Args, "faststart")
|
||||||
|
cmd = &exec.Cmd{
|
||||||
|
Path: Args[0],
|
||||||
|
Args: Args,
|
||||||
|
Stderr: os.Stderr,
|
||||||
|
Stdout: os.Stdout,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cmd.Start()
|
||||||
|
}
|
||||||
|
@ -6,13 +6,6 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Mrs4s/MiraiGo/client"
|
|
||||||
"github.com/Mrs4s/go-cqhttp/coolq"
|
|
||||||
"github.com/Mrs4s/go-cqhttp/global"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
"github.com/tidwall/gjson"
|
|
||||||
"github.com/yinghau76/go-ascii-art"
|
|
||||||
"image"
|
"image"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -21,12 +14,22 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/Mrs4s/MiraiGo/client"
|
||||||
|
"github.com/Mrs4s/go-cqhttp/coolq"
|
||||||
|
"github.com/Mrs4s/go-cqhttp/global"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
"github.com/tidwall/gjson"
|
||||||
|
asciiart "github.com/yinghau76/go-ascii-art"
|
||||||
)
|
)
|
||||||
|
|
||||||
var WebInput = make(chan string, 1) //长度1,用于阻塞
|
var WebInput = make(chan string, 1) //长度1,用于阻塞
|
||||||
|
|
||||||
var Console = make(chan os.Signal, 1)
|
var Console = make(chan os.Signal, 1)
|
||||||
|
|
||||||
|
var Restart = make(chan struct{}, 1)
|
||||||
|
|
||||||
var JsonConfig *global.JsonConfig
|
var JsonConfig *global.JsonConfig
|
||||||
|
|
||||||
type webServer struct {
|
type webServer struct {
|
||||||
@ -41,16 +44,17 @@ var WebServer = &webServer{}
|
|||||||
|
|
||||||
// admin 子站的 路由映射
|
// admin 子站的 路由映射
|
||||||
var HttpuriAdmin = map[string]func(s *webServer, c *gin.Context){
|
var HttpuriAdmin = map[string]func(s *webServer, c *gin.Context){
|
||||||
"do_restart": AdminDoRestart, //热重启
|
"do_restart": AdminDoRestart, //热重启
|
||||||
"get_web_write": AdminWebWrite, //获取是否验证码输入
|
"do_process_restart": AdminProcessRestart, //进程重启
|
||||||
"do_web_write": AdminDoWebWrite, //web上进行输入操作
|
"get_web_write": AdminWebWrite, //获取是否验证码输入
|
||||||
"do_restart_docker": AdminDoRestartDocker, //直接停止(依赖supervisord/docker)重新拉起
|
"do_web_write": AdminDoWebWrite, //web上进行输入操作
|
||||||
"do_config_base": AdminDoConfigBase, //修改config.json中的基础部分
|
"do_restart_docker": AdminDoRestartDocker, //直接停止(依赖supervisord/docker)重新拉起
|
||||||
"do_config_http": AdminDoConfigHttp, //修改config.json的http部分
|
"do_config_base": AdminDoConfigBase, //修改config.json中的基础部分
|
||||||
"do_config_ws": AdminDoConfigWs, //修改config.json的正向ws部分
|
"do_config_http": AdminDoConfigHttp, //修改config.json的http部分
|
||||||
"do_config_reverse": AdminDoConfigReverse, //修改config.json 中的反向ws部分
|
"do_config_ws": AdminDoConfigWs, //修改config.json的正向ws部分
|
||||||
"do_config_json": AdminDoConfigJson, //直接修改 config.json配置
|
"do_config_reverse": AdminDoConfigReverse, //修改config.json 中的反向ws部分
|
||||||
"get_config_json": AdminGetConfigJson, //拉取 当前的config.json配置
|
"do_config_json": AdminDoConfigJson, //直接修改 config.json配置
|
||||||
|
"get_config_json": AdminGetConfigJson, //拉取 当前的config.json配置
|
||||||
}
|
}
|
||||||
|
|
||||||
func Failed(code int, msg string) coolq.MSG {
|
func Failed(code int, msg string) coolq.MSG {
|
||||||
@ -346,6 +350,8 @@ func (s *webServer) DoReLogin() { // TODO: 协议层的 ReLogin
|
|||||||
return "Android Phone"
|
return "Android Phone"
|
||||||
case client.AndroidWatch:
|
case client.AndroidWatch:
|
||||||
return "Android Watch"
|
return "Android Watch"
|
||||||
|
case client.MacOS:
|
||||||
|
return "MacOS"
|
||||||
}
|
}
|
||||||
return "未知"
|
return "未知"
|
||||||
}())
|
}())
|
||||||
@ -421,6 +427,12 @@ func AdminDoRestart(s *webServer, c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 进程重启
|
||||||
|
func AdminProcessRestart(s *webServer, c *gin.Context) {
|
||||||
|
Restart <- struct{}{}
|
||||||
|
c.JSON(200, coolq.OK(coolq.MSG{}))
|
||||||
|
}
|
||||||
|
|
||||||
// 冷重启
|
// 冷重启
|
||||||
func AdminDoRestartDocker(s *webServer, c *gin.Context) {
|
func AdminDoRestartDocker(s *webServer, c *gin.Context) {
|
||||||
Console <- os.Kill
|
Console <- os.Kill
|
||||||
|
@ -5,13 +5,14 @@ import (
|
|||||||
"crypto/hmac"
|
"crypto/hmac"
|
||||||
"crypto/sha1"
|
"crypto/sha1"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"github.com/guonaihong/gout/dataflow"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/guonaihong/gout/dataflow"
|
||||||
|
|
||||||
"github.com/Mrs4s/go-cqhttp/coolq"
|
"github.com/Mrs4s/go-cqhttp/coolq"
|
||||||
"github.com/Mrs4s/go-cqhttp/global"
|
"github.com/Mrs4s/go-cqhttp/global"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@ -343,6 +344,16 @@ func SetGroupLeave(s *httpServer, c *gin.Context) {
|
|||||||
c.JSON(200, s.bot.CQSetGroupLeave(gid))
|
c.JSON(200, s.bot.CQSetGroupLeave(gid))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetRestart(s *httpServer, c *gin.Context) {
|
||||||
|
delay, _ := strconv.ParseInt(getParam(c, "delay"), 10, 64)
|
||||||
|
c.JSON(200, coolq.MSG{"data": nil, "retcode": 0, "status": "async"})
|
||||||
|
go func(delay int64) {
|
||||||
|
time.Sleep(time.Duration(delay) * time.Millisecond)
|
||||||
|
Restart <- struct{}{}
|
||||||
|
}(delay)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func GetForwardMessage(s *httpServer, c *gin.Context) {
|
func GetForwardMessage(s *httpServer, c *gin.Context) {
|
||||||
resId := getParam(c, "message_id")
|
resId := getParam(c, "message_id")
|
||||||
c.JSON(200, s.bot.CQGetForwardMessage(resId))
|
c.JSON(200, s.bot.CQGetForwardMessage(resId))
|
||||||
@ -488,6 +499,7 @@ var httpApi = map[string]func(s *httpServer, c *gin.Context){
|
|||||||
"set_group_whole_ban": SetWholeBan,
|
"set_group_whole_ban": SetWholeBan,
|
||||||
"set_group_name": SetGroupName,
|
"set_group_name": SetGroupName,
|
||||||
"set_group_admin": SetGroupAdmin,
|
"set_group_admin": SetGroupAdmin,
|
||||||
|
"set_restart": SetRestart,
|
||||||
"_send_group_notice": SendGroupNotice,
|
"_send_group_notice": SendGroupNotice,
|
||||||
"set_group_leave": SetGroupLeave,
|
"set_group_leave": SetGroupLeave,
|
||||||
"get_image": GetImage,
|
"get_image": GetImage,
|
||||||
|
@ -480,6 +480,19 @@ var wsApi = map[string]func(*coolq.CQBot, gjson.Result) coolq.MSG{
|
|||||||
"get_group_honor_info": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
|
"get_group_honor_info": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
|
||||||
return bot.CQGetGroupHonorInfo(p.Get("group_id").Int(), p.Get("type").Str)
|
return bot.CQGetGroupHonorInfo(p.Get("group_id").Int(), p.Get("type").Str)
|
||||||
},
|
},
|
||||||
|
"set_restart": func(c *coolq.CQBot, p gjson.Result) coolq.MSG {
|
||||||
|
var delay int64 = 0
|
||||||
|
delay = p.Get("delay").Int()
|
||||||
|
if delay < 0 {
|
||||||
|
delay = 0
|
||||||
|
}
|
||||||
|
defer func(delay int64) {
|
||||||
|
time.Sleep(time.Duration(delay) * time.Millisecond)
|
||||||
|
Restart <- struct{}{}
|
||||||
|
}(delay)
|
||||||
|
return coolq.MSG{"data": nil, "retcode": 0, "status": "async"}
|
||||||
|
|
||||||
|
},
|
||||||
"can_send_image": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
|
"can_send_image": func(bot *coolq.CQBot, p gjson.Result) coolq.MSG {
|
||||||
return bot.CQCanSendImage()
|
return bot.CQCanSendImage()
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user