mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-04 19:17:37 +08:00
feat: cross version ID converter & audio/mention segment support
This commit is contained in:
parent
847ef6d415
commit
672dafdb9d
@ -65,6 +65,9 @@ func (g *generator) generate(routers []Router) {
|
|||||||
g.WriteString("\"github.com/Mrs4s/go-cqhttp/global\"\n")
|
g.WriteString("\"github.com/Mrs4s/go-cqhttp/global\"\n")
|
||||||
g.WriteString(")\n\n")
|
g.WriteString(")\n\n")
|
||||||
g.WriteString(fmt.Sprintf(`func (c *Caller) call(action string, version uint16, p Getter) global.MSG {
|
g.WriteString(fmt.Sprintf(`func (c *Caller) call(action string, version uint16, p Getter) global.MSG {
|
||||||
|
var converter coolq.IDConverter = func(id any) any {
|
||||||
|
return coolq.ConvertIDWithVersion(id,version)
|
||||||
|
}
|
||||||
if version == 12 {
|
if version == 12 {
|
||||||
if action == "get_supported_actions" {
|
if action == "get_supported_actions" {
|
||||||
return coolq.OK([]string{%v})
|
return coolq.OK([]string{%v})
|
||||||
@ -135,7 +138,7 @@ func (g *generator) router(router Router, pathVersion int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i, p := range router.Params {
|
for i, p := range router.Params {
|
||||||
if p.Name == "version" {
|
if p.Name == "version" || p.Name == "converter" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if p.Default == "" {
|
if p.Default == "" {
|
||||||
@ -157,6 +160,10 @@ func (g *generator) router(router Router, pathVersion int) {
|
|||||||
fmt.Fprintf(g.out, "version")
|
fmt.Fprintf(g.out, "version")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if p.Name == "converter" {
|
||||||
|
fmt.Fprintf(g.out, "converter")
|
||||||
|
continue
|
||||||
|
}
|
||||||
fmt.Fprintf(g.out, "p%d", i)
|
fmt.Fprintf(g.out, "p%d", i)
|
||||||
}
|
}
|
||||||
g.WriteString(")\n")
|
g.WriteString(")\n")
|
||||||
@ -166,7 +173,7 @@ func conv(v, t string) string {
|
|||||||
switch t {
|
switch t {
|
||||||
default:
|
default:
|
||||||
panic("unknown type: " + t)
|
panic("unknown type: " + t)
|
||||||
case "gjson.Result":
|
case "gjson.Result", "IDConverter":
|
||||||
return v
|
return v
|
||||||
case "int64":
|
case "int64":
|
||||||
return v + ".Int()"
|
return v + ".Int()"
|
||||||
|
28
coolq/api.go
28
coolq/api.go
@ -328,13 +328,13 @@ func (bot *CQBot) CQGetTopicChannelFeeds(guildID, channelID uint64) global.MSG {
|
|||||||
//
|
//
|
||||||
// https://git.io/Jtz1L
|
// https://git.io/Jtz1L
|
||||||
// @route(get_friend_list)
|
// @route(get_friend_list)
|
||||||
func (bot *CQBot) CQGetFriendList() global.MSG {
|
func (bot *CQBot) CQGetFriendList(version uint16) global.MSG {
|
||||||
fs := make([]global.MSG, 0, len(bot.Client.FriendList))
|
fs := make([]global.MSG, 0, len(bot.Client.FriendList))
|
||||||
for _, f := range bot.Client.FriendList {
|
for _, f := range bot.Client.FriendList {
|
||||||
fs = append(fs, global.MSG{
|
fs = append(fs, global.MSG{
|
||||||
"nickname": f.Nickname,
|
"nickname": f.Nickname,
|
||||||
"remark": f.Remark,
|
"remark": f.Remark,
|
||||||
"user_id": f.Uin,
|
"user_id": ConvertIDWithVersion(f.Uin, version),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return OK(fs)
|
return OK(fs)
|
||||||
@ -400,14 +400,14 @@ func (bot *CQBot) CQDeleteFriend(uin int64) global.MSG {
|
|||||||
//
|
//
|
||||||
// https://git.io/Jtz1t
|
// https://git.io/Jtz1t
|
||||||
// @route(get_group_list)
|
// @route(get_group_list)
|
||||||
func (bot *CQBot) CQGetGroupList(noCache bool) global.MSG {
|
func (bot *CQBot) CQGetGroupList(noCache bool, converter IDConverter) global.MSG {
|
||||||
gs := make([]global.MSG, 0, len(bot.Client.GroupList))
|
gs := make([]global.MSG, 0, len(bot.Client.GroupList))
|
||||||
if noCache {
|
if noCache {
|
||||||
_ = bot.Client.ReloadGroupList()
|
_ = bot.Client.ReloadGroupList()
|
||||||
}
|
}
|
||||||
for _, g := range bot.Client.GroupList {
|
for _, g := range bot.Client.GroupList {
|
||||||
gs = append(gs, global.MSG{
|
gs = append(gs, global.MSG{
|
||||||
"group_id": g.Code,
|
"group_id": converter(g.Code),
|
||||||
"group_name": g.Name,
|
"group_name": g.Name,
|
||||||
"group_create_time": g.GroupCreateTime,
|
"group_create_time": g.GroupCreateTime,
|
||||||
"group_level": g.GroupLevel,
|
"group_level": g.GroupLevel,
|
||||||
@ -422,7 +422,7 @@ func (bot *CQBot) CQGetGroupList(noCache bool) global.MSG {
|
|||||||
//
|
//
|
||||||
// https://git.io/Jtz1O
|
// https://git.io/Jtz1O
|
||||||
// @route(get_group_info)
|
// @route(get_group_info)
|
||||||
func (bot *CQBot) CQGetGroupInfo(groupID int64, noCache bool) global.MSG {
|
func (bot *CQBot) CQGetGroupInfo(groupID int64, noCache bool, converter IDConverter) global.MSG {
|
||||||
group := bot.Client.FindGroup(groupID)
|
group := bot.Client.FindGroup(groupID)
|
||||||
if group == nil || noCache {
|
if group == nil || noCache {
|
||||||
group, _ = bot.Client.GetGroupInfo(groupID)
|
group, _ = bot.Client.GetGroupInfo(groupID)
|
||||||
@ -436,7 +436,7 @@ func (bot *CQBot) CQGetGroupInfo(groupID int64, noCache bool) global.MSG {
|
|||||||
for _, g := range info {
|
for _, g := range info {
|
||||||
if g.Code == groupID {
|
if g.Code == groupID {
|
||||||
return OK(global.MSG{
|
return OK(global.MSG{
|
||||||
"group_id": g.Code,
|
"group_id": converter(g.Code),
|
||||||
"group_name": g.Name,
|
"group_name": g.Name,
|
||||||
"group_memo": g.Memo,
|
"group_memo": g.Memo,
|
||||||
"group_create_time": 0,
|
"group_create_time": 0,
|
||||||
@ -448,7 +448,7 @@ func (bot *CQBot) CQGetGroupInfo(groupID int64, noCache bool) global.MSG {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return OK(global.MSG{
|
return OK(global.MSG{
|
||||||
"group_id": group.Code,
|
"group_id": converter(group.Code),
|
||||||
"group_name": group.Name,
|
"group_name": group.Name,
|
||||||
"group_create_time": group.GroupCreateTime,
|
"group_create_time": group.GroupCreateTime,
|
||||||
"group_level": group.GroupLevel,
|
"group_level": group.GroupLevel,
|
||||||
@ -657,7 +657,7 @@ func (bot *CQBot) CQGroupFileDeleteFile(groupID int64, id string, busID int32) g
|
|||||||
//
|
//
|
||||||
// https://docs.go-cqhttp.org/api/#%E8%8E%B7%E5%8F%96%E4%B8%AD%E6%96%87%E5%88%86%E8%AF%8D-%E9%9A%90%E8%97%8F-api
|
// https://docs.go-cqhttp.org/api/#%E8%8E%B7%E5%8F%96%E4%B8%AD%E6%96%87%E5%88%86%E8%AF%8D-%E9%9A%90%E8%97%8F-api
|
||||||
// @route(.get_word_slices)
|
// @route(.get_word_slices)
|
||||||
func (bot *CQBot) CQGetWordSlices(content string, version uint16) global.MSG {
|
func (bot *CQBot) CQGetWordSlices(content string) global.MSG {
|
||||||
slices, err := bot.Client.GetWordSegmentation(content)
|
slices, err := bot.Client.GetWordSegmentation(content)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Failed(100, "WORD_SEGMENTATION_API_ERROR", err.Error())
|
return Failed(100, "WORD_SEGMENTATION_API_ERROR", err.Error())
|
||||||
@ -670,7 +670,7 @@ func (bot *CQBot) CQGetWordSlices(content string, version uint16) global.MSG {
|
|||||||
|
|
||||||
// CQSendMessage 发送消息
|
// CQSendMessage 发送消息
|
||||||
//
|
//
|
||||||
// @route(send_msg)
|
// @route11(send_msg)
|
||||||
// @rename(m->message)
|
// @rename(m->message)
|
||||||
func (bot *CQBot) CQSendMessage(groupID, userID int64, m gjson.Result, messageType string, autoEscape bool) global.MSG {
|
func (bot *CQBot) CQSendMessage(groupID, userID int64, m gjson.Result, messageType string, autoEscape bool) global.MSG {
|
||||||
switch {
|
switch {
|
||||||
@ -688,7 +688,7 @@ func (bot *CQBot) CQSendMessage(groupID, userID int64, m gjson.Result, messageTy
|
|||||||
|
|
||||||
// CQSendForwardMessage 发送合并转发消息
|
// CQSendForwardMessage 发送合并转发消息
|
||||||
//
|
//
|
||||||
// @route(send_forward_msg)
|
// @route11(send_forward_msg)
|
||||||
// @rename(m->messages)
|
// @rename(m->messages)
|
||||||
func (bot *CQBot) CQSendForwardMessage(groupID, userID int64, m gjson.Result, messageType string) global.MSG {
|
func (bot *CQBot) CQSendForwardMessage(groupID, userID int64, m gjson.Result, messageType string) global.MSG {
|
||||||
switch {
|
switch {
|
||||||
@ -707,7 +707,7 @@ func (bot *CQBot) CQSendForwardMessage(groupID, userID int64, m gjson.Result, me
|
|||||||
// CQSendGroupMessage 发送群消息
|
// CQSendGroupMessage 发送群消息
|
||||||
//
|
//
|
||||||
// https://git.io/Jtz1c
|
// https://git.io/Jtz1c
|
||||||
// @route(send_group_msg)
|
// @route11(send_group_msg)
|
||||||
// @rename(m->message)
|
// @rename(m->message)
|
||||||
func (bot *CQBot) CQSendGroupMessage(groupID int64, m gjson.Result, autoEscape bool) global.MSG {
|
func (bot *CQBot) CQSendGroupMessage(groupID int64, m gjson.Result, autoEscape bool) global.MSG {
|
||||||
group := bot.Client.FindGroup(groupID)
|
group := bot.Client.FindGroup(groupID)
|
||||||
@ -930,7 +930,7 @@ func (bot *CQBot) uploadForwardElement(m gjson.Result, target int64, sourceType
|
|||||||
// CQSendGroupForwardMessage 扩展API-发送合并转发(群)
|
// CQSendGroupForwardMessage 扩展API-发送合并转发(群)
|
||||||
//
|
//
|
||||||
// https://docs.go-cqhttp.org/api/#%E5%8F%91%E9%80%81%E5%90%88%E5%B9%B6%E8%BD%AC%E5%8F%91-%E7%BE%A4
|
// https://docs.go-cqhttp.org/api/#%E5%8F%91%E9%80%81%E5%90%88%E5%B9%B6%E8%BD%AC%E5%8F%91-%E7%BE%A4
|
||||||
// @route(send_group_forward_msg)
|
// @route11(send_group_forward_msg)
|
||||||
// @rename(m->messages)
|
// @rename(m->messages)
|
||||||
func (bot *CQBot) CQSendGroupForwardMessage(groupID int64, m gjson.Result) global.MSG {
|
func (bot *CQBot) CQSendGroupForwardMessage(groupID int64, m gjson.Result) global.MSG {
|
||||||
if m.Type != gjson.JSON {
|
if m.Type != gjson.JSON {
|
||||||
@ -954,7 +954,7 @@ func (bot *CQBot) CQSendGroupForwardMessage(groupID int64, m gjson.Result) globa
|
|||||||
// CQSendPrivateForwardMessage 扩展API-发送合并转发(好友)
|
// CQSendPrivateForwardMessage 扩展API-发送合并转发(好友)
|
||||||
//
|
//
|
||||||
// https://docs.go-cqhttp.org/api/#%E5%8F%91%E9%80%81%E5%90%88%E5%B9%B6%E8%BD%AC%E5%8F%91-%E7%BE%A4
|
// https://docs.go-cqhttp.org/api/#%E5%8F%91%E9%80%81%E5%90%88%E5%B9%B6%E8%BD%AC%E5%8F%91-%E7%BE%A4
|
||||||
// @route(send_private_forward_msg)
|
// @route11(send_private_forward_msg)
|
||||||
// @rename(m->messages)
|
// @rename(m->messages)
|
||||||
func (bot *CQBot) CQSendPrivateForwardMessage(userID int64, m gjson.Result) global.MSG {
|
func (bot *CQBot) CQSendPrivateForwardMessage(userID int64, m gjson.Result) global.MSG {
|
||||||
if m.Type != gjson.JSON {
|
if m.Type != gjson.JSON {
|
||||||
@ -975,7 +975,7 @@ func (bot *CQBot) CQSendPrivateForwardMessage(userID int64, m gjson.Result) glob
|
|||||||
// CQSendPrivateMessage 发送私聊消息
|
// CQSendPrivateMessage 发送私聊消息
|
||||||
//
|
//
|
||||||
// https://git.io/Jtz1l
|
// https://git.io/Jtz1l
|
||||||
// @route(send_private_msg)
|
// @route11(send_private_msg)
|
||||||
// @rename(m->message)
|
// @rename(m->message)
|
||||||
func (bot *CQBot) CQSendPrivateMessage(userID int64, groupID int64, m gjson.Result, autoEscape bool) global.MSG {
|
func (bot *CQBot) CQSendPrivateMessage(userID int64, groupID int64, m gjson.Result, autoEscape bool) global.MSG {
|
||||||
var elem []message.IMessageElement
|
var elem []message.IMessageElement
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
|
|
||||||
"github.com/Mrs4s/go-cqhttp/global"
|
"github.com/Mrs4s/go-cqhttp/global"
|
||||||
"github.com/Mrs4s/go-cqhttp/internal/base"
|
"github.com/Mrs4s/go-cqhttp/internal/base"
|
||||||
|
"github.com/tidwall/gjson"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CQGetVersion 获取版本信息 OneBotV12
|
// CQGetVersion 获取版本信息 OneBotV12
|
||||||
@ -21,3 +22,11 @@ func (bot *CQBot) CQGetVersion() global.MSG {
|
|||||||
"runtime_os": runtime.GOOS,
|
"runtime_os": runtime.GOOS,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CQSendMessageV12 发送消息
|
||||||
|
//
|
||||||
|
// @route12(send_message)
|
||||||
|
// @rename(m->message)
|
||||||
|
func (bot *CQBot) CQSendMessageV12(groupID, userID, detailType string, m gjson.Result) global.MSG {
|
||||||
|
return OK(nil)
|
||||||
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package coolq
|
package coolq
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -13,6 +14,8 @@ import (
|
|||||||
"github.com/Mrs4s/go-cqhttp/global"
|
"github.com/Mrs4s/go-cqhttp/global"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type IDConverter func(id any) any
|
||||||
|
|
||||||
func convertGroupMemberInfo(groupID int64, m *client.GroupMemberInfo) global.MSG {
|
func convertGroupMemberInfo(groupID int64, m *client.GroupMemberInfo) global.MSG {
|
||||||
sex := "unknown"
|
sex := "unknown"
|
||||||
if m.Gender == 1 { // unknown = 0xff
|
if m.Gender == 1 { // unknown = 0xff
|
||||||
@ -221,3 +224,10 @@ func toStringMessage(m []message.IMessageElement, source message.Source) string
|
|||||||
func fU64(v uint64) string {
|
func fU64(v uint64) string {
|
||||||
return strconv.FormatUint(v, 10)
|
return strconv.FormatUint(v, 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ConvertIDWithVersion(v any, version uint16) any {
|
||||||
|
if version == 12 {
|
||||||
|
return fmt.Sprint(v)
|
||||||
|
}
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
@ -832,7 +832,7 @@ func (bot *CQBot) ToElement(t string, d map[string]string, sourceType message.So
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &message.VoiceElement{Data: base.ResampleSilk(data)}, nil
|
return &message.VoiceElement{Data: base.ResampleSilk(data)}, nil
|
||||||
case "record":
|
case "record", "audio":
|
||||||
f := d["file"]
|
f := d["file"]
|
||||||
data, err := global.FindFile(f, d["cache"], global.VoicePath)
|
data, err := global.FindFile(f, d["cache"], global.VoicePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -858,7 +858,10 @@ func (bot *CQBot) ToElement(t string, d map[string]string, sourceType message.So
|
|||||||
return &message.AnimatedSticker{ID: int32(id)}, nil
|
return &message.AnimatedSticker{ID: int32(id)}, nil
|
||||||
}
|
}
|
||||||
return message.NewFace(int32(id)), nil
|
return message.NewFace(int32(id)), nil
|
||||||
case "at":
|
case "mention_all":
|
||||||
|
d["qq"] = "all"
|
||||||
|
fallthrough
|
||||||
|
case "at", "mention":
|
||||||
qq := d["qq"]
|
qq := d["qq"]
|
||||||
if qq == "all" {
|
if qq == "all" {
|
||||||
return message.AtAll(), nil
|
return message.AtAll(), nil
|
||||||
|
@ -8,9 +8,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (c *Caller) call(action string, version uint16, p Getter) global.MSG {
|
func (c *Caller) call(action string, version uint16, p Getter) global.MSG {
|
||||||
|
var converter coolq.IDConverter = func(id any) any {
|
||||||
|
return coolq.ConvertIDWithVersion(id, version)
|
||||||
|
}
|
||||||
if version == 12 {
|
if version == 12 {
|
||||||
if action == "get_supported_actions" {
|
if action == "get_supported_actions" {
|
||||||
return coolq.OK([]string{".get_word_slices", ".handle_quick_operation", ".ocr_image", "ocr_image", "_get_group_notice", "_get_model_show", "_send_group_notice", "_set_model_show", "check_url_safely", "create_group_file_folder", "create_guild_role", "delete_essence_msg", "delete_friend", "delete_group_file", "delete_group_folder", "delete_guild_role", "delete_msg", "delete_unidirectional_friend", "download_file", "get_essence_msg_list", "get_forward_msg", "get_friend_list", "get_group_at_all_remain", "get_group_file_system_info", "get_group_file_url", "get_group_files_by_folder", "get_group_honor_info", "get_group_info", "get_group_list", "get_group_member_info", "get_group_member_list", "get_group_msg_history", "get_group_root_files", "get_group_system_msg", "get_guild_channel_list", "get_guild_list", "get_guild_member_list", "get_guild_member_profile", "get_guild_meta_by_guest", "get_guild_msg", "get_guild_roles", "get_guild_service_profile", "get_image", "get_self_info", "get_msg", "get_online_clients", "get_status", "get_user_info", "get_topic_channel_feeds", "get_unidirectional_friend_list", "get_version", "mark_msg_as_read", "qidian_get_account_info", "reload_event_filter", "send_forward_msg", "send_group_forward_msg", "send_group_msg", "send_group_sign", "send_guild_channel_msg", "send_msg", "send_private_forward_msg", "send_private_msg", "set_essence_msg", "set_friend_add_request", "set_group_add_request", "set_group_admin", "set_group_anonymous_ban", "set_group_ban", "set_group_card", "set_group_kick", "set_group_leave", "set_group_name", "set_group_portrait", "set_group_special_title", "set_group_whole_ban", "set_guild_member_role", "set_qq_profile", "update_guild_role", "upload_group_file"})
|
return coolq.OK([]string{".get_word_slices", ".handle_quick_operation", ".ocr_image", "ocr_image", "_get_group_notice", "_get_model_show", "_send_group_notice", "_set_model_show", "check_url_safely", "create_group_file_folder", "create_guild_role", "delete_essence_msg", "delete_friend", "delete_group_file", "delete_group_folder", "delete_guild_role", "delete_msg", "delete_unidirectional_friend", "download_file", "get_essence_msg_list", "get_forward_msg", "get_friend_list", "get_group_at_all_remain", "get_group_file_system_info", "get_group_file_url", "get_group_files_by_folder", "get_group_honor_info", "get_group_info", "get_group_list", "get_group_member_info", "get_group_member_list", "get_group_msg_history", "get_group_root_files", "get_group_system_msg", "get_guild_channel_list", "get_guild_list", "get_guild_member_list", "get_guild_member_profile", "get_guild_meta_by_guest", "get_guild_msg", "get_guild_roles", "get_guild_service_profile", "get_image", "get_self_info", "get_msg", "get_online_clients", "get_status", "get_user_info", "get_topic_channel_feeds", "get_unidirectional_friend_list", "get_version", "mark_msg_as_read", "qidian_get_account_info", "reload_event_filter", "send_group_sign", "send_guild_channel_msg", "send_message", "set_essence_msg", "set_friend_add_request", "set_group_add_request", "set_group_admin", "set_group_anonymous_ban", "set_group_ban", "set_group_card", "set_group_kick", "set_group_leave", "set_group_name", "set_group_portrait", "set_group_special_title", "set_group_whole_ban", "set_guild_member_role", "set_qq_profile", "update_guild_role", "upload_group_file"})
|
||||||
}
|
}
|
||||||
switch action {
|
switch action {
|
||||||
case "get_self_info":
|
case "get_self_info":
|
||||||
@ -20,6 +23,12 @@ func (c *Caller) call(action string, version uint16, p Getter) global.MSG {
|
|||||||
return c.bot.CQGetStrangerInfo(p0)
|
return c.bot.CQGetStrangerInfo(p0)
|
||||||
case "get_version":
|
case "get_version":
|
||||||
return c.bot.CQGetVersion()
|
return c.bot.CQGetVersion()
|
||||||
|
case "send_message":
|
||||||
|
p0 := p.Get("group_id").String()
|
||||||
|
p1 := p.Get("user_id").String()
|
||||||
|
p2 := p.Get("detail_type").String()
|
||||||
|
p3 := p.Get("message")
|
||||||
|
return c.bot.CQSendMessageV12(p0, p1, p2, p3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if version == 11 {
|
if version == 11 {
|
||||||
@ -35,12 +44,44 @@ func (c *Caller) call(action string, version uint16, p Getter) global.MSG {
|
|||||||
return c.bot.CQGetStrangerInfo(p0)
|
return c.bot.CQGetStrangerInfo(p0)
|
||||||
case "get_version_info":
|
case "get_version_info":
|
||||||
return c.bot.CQGetVersionInfo()
|
return c.bot.CQGetVersionInfo()
|
||||||
|
case "send_forward_msg":
|
||||||
|
p0 := p.Get("group_id").Int()
|
||||||
|
p1 := p.Get("user_id").Int()
|
||||||
|
p2 := p.Get("messages")
|
||||||
|
p3 := p.Get("message_type").String()
|
||||||
|
return c.bot.CQSendForwardMessage(p0, p1, p2, p3)
|
||||||
|
case "send_group_forward_msg":
|
||||||
|
p0 := p.Get("group_id").Int()
|
||||||
|
p1 := p.Get("messages")
|
||||||
|
return c.bot.CQSendGroupForwardMessage(p0, p1)
|
||||||
|
case "send_group_msg":
|
||||||
|
p0 := p.Get("group_id").Int()
|
||||||
|
p1 := p.Get("message")
|
||||||
|
p2 := p.Get("auto_escape").Bool()
|
||||||
|
return c.bot.CQSendGroupMessage(p0, p1, p2)
|
||||||
|
case "send_msg":
|
||||||
|
p0 := p.Get("group_id").Int()
|
||||||
|
p1 := p.Get("user_id").Int()
|
||||||
|
p2 := p.Get("message")
|
||||||
|
p3 := p.Get("message_type").String()
|
||||||
|
p4 := p.Get("auto_escape").Bool()
|
||||||
|
return c.bot.CQSendMessage(p0, p1, p2, p3, p4)
|
||||||
|
case "send_private_forward_msg":
|
||||||
|
p0 := p.Get("user_id").Int()
|
||||||
|
p1 := p.Get("messages")
|
||||||
|
return c.bot.CQSendPrivateForwardMessage(p0, p1)
|
||||||
|
case "send_private_msg":
|
||||||
|
p0 := p.Get("user_id").Int()
|
||||||
|
p1 := p.Get("group_id").Int()
|
||||||
|
p2 := p.Get("message")
|
||||||
|
p3 := p.Get("auto_escape").Bool()
|
||||||
|
return c.bot.CQSendPrivateMessage(p0, p1, p2, p3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch action {
|
switch action {
|
||||||
case ".get_word_slices":
|
case ".get_word_slices":
|
||||||
p0 := p.Get("content").String()
|
p0 := p.Get("content").String()
|
||||||
return c.bot.CQGetWordSlices(p0, version)
|
return c.bot.CQGetWordSlices(p0)
|
||||||
case ".handle_quick_operation":
|
case ".handle_quick_operation":
|
||||||
p0 := p.Get("context")
|
p0 := p.Get("context")
|
||||||
p1 := p.Get("operation")
|
p1 := p.Get("operation")
|
||||||
@ -115,7 +156,7 @@ func (c *Caller) call(action string, version uint16, p Getter) global.MSG {
|
|||||||
p0 := p.Get("[message_id,id].0").String()
|
p0 := p.Get("[message_id,id].0").String()
|
||||||
return c.bot.CQGetForwardMessage(p0)
|
return c.bot.CQGetForwardMessage(p0)
|
||||||
case "get_friend_list":
|
case "get_friend_list":
|
||||||
return c.bot.CQGetFriendList()
|
return c.bot.CQGetFriendList(version)
|
||||||
case "get_group_at_all_remain":
|
case "get_group_at_all_remain":
|
||||||
p0 := p.Get("group_id").Int()
|
p0 := p.Get("group_id").Int()
|
||||||
return c.bot.CQGetAtAllRemain(p0)
|
return c.bot.CQGetAtAllRemain(p0)
|
||||||
@ -138,10 +179,10 @@ func (c *Caller) call(action string, version uint16, p Getter) global.MSG {
|
|||||||
case "get_group_info":
|
case "get_group_info":
|
||||||
p0 := p.Get("group_id").Int()
|
p0 := p.Get("group_id").Int()
|
||||||
p1 := p.Get("no_cache").Bool()
|
p1 := p.Get("no_cache").Bool()
|
||||||
return c.bot.CQGetGroupInfo(p0, p1)
|
return c.bot.CQGetGroupInfo(p0, p1, converter)
|
||||||
case "get_group_list":
|
case "get_group_list":
|
||||||
p0 := p.Get("no_cache").Bool()
|
p0 := p.Get("no_cache").Bool()
|
||||||
return c.bot.CQGetGroupList(p0)
|
return c.bot.CQGetGroupList(p0, converter)
|
||||||
case "get_group_member_info":
|
case "get_group_member_info":
|
||||||
p0 := p.Get("group_id").Int()
|
p0 := p.Get("group_id").Int()
|
||||||
p1 := p.Get("user_id").Int()
|
p1 := p.Get("user_id").Int()
|
||||||
@ -211,21 +252,6 @@ func (c *Caller) call(action string, version uint16, p Getter) global.MSG {
|
|||||||
case "reload_event_filter":
|
case "reload_event_filter":
|
||||||
p0 := p.Get("file").String()
|
p0 := p.Get("file").String()
|
||||||
return c.bot.CQReloadEventFilter(p0)
|
return c.bot.CQReloadEventFilter(p0)
|
||||||
case "send_forward_msg":
|
|
||||||
p0 := p.Get("group_id").Int()
|
|
||||||
p1 := p.Get("user_id").Int()
|
|
||||||
p2 := p.Get("messages")
|
|
||||||
p3 := p.Get("message_type").String()
|
|
||||||
return c.bot.CQSendForwardMessage(p0, p1, p2, p3)
|
|
||||||
case "send_group_forward_msg":
|
|
||||||
p0 := p.Get("group_id").Int()
|
|
||||||
p1 := p.Get("messages")
|
|
||||||
return c.bot.CQSendGroupForwardMessage(p0, p1)
|
|
||||||
case "send_group_msg":
|
|
||||||
p0 := p.Get("group_id").Int()
|
|
||||||
p1 := p.Get("message")
|
|
||||||
p2 := p.Get("auto_escape").Bool()
|
|
||||||
return c.bot.CQSendGroupMessage(p0, p1, p2)
|
|
||||||
case "send_group_sign":
|
case "send_group_sign":
|
||||||
p0 := p.Get("group_id").Int()
|
p0 := p.Get("group_id").Int()
|
||||||
return c.bot.CQSendGroupSign(p0)
|
return c.bot.CQSendGroupSign(p0)
|
||||||
@ -235,23 +261,6 @@ func (c *Caller) call(action string, version uint16, p Getter) global.MSG {
|
|||||||
p2 := p.Get("message")
|
p2 := p.Get("message")
|
||||||
p3 := p.Get("auto_escape").Bool()
|
p3 := p.Get("auto_escape").Bool()
|
||||||
return c.bot.CQSendGuildChannelMessage(p0, p1, p2, p3)
|
return c.bot.CQSendGuildChannelMessage(p0, p1, p2, p3)
|
||||||
case "send_msg":
|
|
||||||
p0 := p.Get("group_id").Int()
|
|
||||||
p1 := p.Get("user_id").Int()
|
|
||||||
p2 := p.Get("message")
|
|
||||||
p3 := p.Get("message_type").String()
|
|
||||||
p4 := p.Get("auto_escape").Bool()
|
|
||||||
return c.bot.CQSendMessage(p0, p1, p2, p3, p4)
|
|
||||||
case "send_private_forward_msg":
|
|
||||||
p0 := p.Get("user_id").Int()
|
|
||||||
p1 := p.Get("messages")
|
|
||||||
return c.bot.CQSendPrivateForwardMessage(p0, p1)
|
|
||||||
case "send_private_msg":
|
|
||||||
p0 := p.Get("user_id").Int()
|
|
||||||
p1 := p.Get("group_id").Int()
|
|
||||||
p2 := p.Get("message")
|
|
||||||
p3 := p.Get("auto_escape").Bool()
|
|
||||||
return c.bot.CQSendPrivateMessage(p0, p1, p2, p3)
|
|
||||||
case "set_essence_msg":
|
case "set_essence_msg":
|
||||||
p0 := int32(p.Get("message_id").Int())
|
p0 := int32(p.Get("message_id").Int())
|
||||||
return c.bot.CQSetEssenceMessage(p0)
|
return c.bot.CQSetEssenceMessage(p0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user