coolq

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2023 License: AGPL-3.0 Imports: 42 Imported by: 9

Documentation

Overview

Package coolq 包含CQBot实例,CQ码处理,消息发送,消息处理等的相关函数与结构体

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Failed

func Failed(code int, msg ...string) global.MSG

Failed 生成失败返回值

func FeedContentsToArrayMessage added in v1.0.0

func FeedContentsToArrayMessage(contents []topic.IFeedRichContentElement) []global.MSG

FeedContentsToArrayMessage 将话题频道帖子内容转换为 Array Message

func OK

func OK(data any) global.MSG

OK 生成成功返回值

func ToFormattedMessage added in v0.9.18

func ToFormattedMessage(e []message.IMessageElement, source message.Source) (r any)

ToFormattedMessage 将给定[]message.IMessageElement转换为通过coolq.SetMessageFormat所定义的消息上报格式

func ToMessageContent added in v1.0.0

func ToMessageContent(e []message.IMessageElement, source message.Source) (r []global.MSG)

ToMessageContent 将消息转换成 Content. 忽略 Reply 不同于 onebot 的 Array Message, 此函数转换出来的 Content 的 data 段为实际类型 方便数据库查询

Types

type CQBot

type CQBot struct {
	Client *client.QQClient
	// contains filtered or unexported fields
}

CQBot CQBot结构体,存储Bot实例相关配置

func NewQQBot

func NewQQBot(cli *client.QQClient) *CQBot

NewQQBot 初始化一个QQBot实例

func (*CQBot) CQCanSendImage

func (bot *CQBot) CQCanSendImage() global.MSG

CQCanSendImage 检查是否可以发送图片(此处永远返回true)

https://git.io/Jtz1N @route11(can_send_image)

func (*CQBot) CQCanSendRecord

func (bot *CQBot) CQCanSendRecord() global.MSG

CQCanSendRecord 检查是否可以发送语音(此处永远返回true)

https://git.io/Jtz1x @route11(can_send_record)

func (*CQBot) CQCheckURLSafely added in v1.0.0

func (bot *CQBot) CQCheckURLSafely(url string) global.MSG

CQCheckURLSafely 扩展API-检查链接安全性

https://docs.go-cqhttp.org/api/#%E6%A3%80%E6%9F%A5%E9%93%BE%E6%8E%A5%E5%AE%89%E5%85%A8%E6%80%A7 @route(check_url_safely)

func (*CQBot) CQCreateGuildRole added in v1.0.0

func (bot *CQBot) CQCreateGuildRole(guildID uint64, name string, color uint32, independent bool, initialUsers gjson.Result) global.MSG

CQCreateGuildRole 创建频道角色 @route(create_guild_role)

func (*CQBot) CQDelGroupMemo added in v1.0.0

func (bot *CQBot) CQDelGroupMemo(groupID int64, fid string) global.MSG

CQDelGroupMemo 扩展API-删除群公告 @route(_del_group_notice) @rename(fid->notice_id)

func (*CQBot) CQDeleteEssenceMessage added in v0.9.40

func (bot *CQBot) CQDeleteEssenceMessage(messageID int32) global.MSG

CQDeleteEssenceMessage 扩展API-移出精华消息

https://docs.go-cqhttp.org/api/#%E7%A7%BB%E5%87%BA%E7%B2%BE%E5%8D%8E%E6%B6%88%E6%81%AF @route(delete_essence_msg)

func (*CQBot) CQDeleteFriend added in v1.0.0

func (bot *CQBot) CQDeleteFriend(uin int64) global.MSG

CQDeleteFriend 删除好友 @route(delete_friend) @rename(uin->"[user_id\x2Cid].0")

func (*CQBot) CQDeleteGuildRole added in v1.0.0

func (bot *CQBot) CQDeleteGuildRole(guildID uint64, roleID uint64) global.MSG

CQDeleteGuildRole 删除频道角色 @route(delete_guild_role)

func (*CQBot) CQDeleteMessage

func (bot *CQBot) CQDeleteMessage(messageID int32) global.MSG

CQDeleteMessage 撤回消息

https:// git.io/Jtz1y @route(delete_msg)

func (*CQBot) CQDeleteUnidirectionalFriend added in v1.0.0

func (bot *CQBot) CQDeleteUnidirectionalFriend(uin int64) global.MSG

CQDeleteUnidirectionalFriend 删除单向好友

@route(delete_unidirectional_friend) @rename(uin->user_id)

func (*CQBot) CQDownloadFile added in v0.9.38

func (bot *CQBot) CQDownloadFile(url string, headers gjson.Result, threadCount int) global.MSG

CQDownloadFile 扩展API-下载文件到缓存目录

https://docs.go-cqhttp.org/api/#%E4%B8%8B%E8%BD%BD%E6%96%87%E4%BB%B6%E5%88%B0%E7%BC%93%E5%AD%98%E7%9B%AE%E5%BD%95 @route(download_file)

func (*CQBot) CQGetAtAllRemain added in v0.9.35

func (bot *CQBot) CQGetAtAllRemain(groupID int64) global.MSG

CQGetAtAllRemain 扩展API-获取群 @全体成员 剩余次数

https://docs.go-cqhttp.org/api/#%E8%8E%B7%E5%8F%96%E7%BE%A4-%E5%85%A8%E4%BD%93%E6%88%90%E5%91%98-%E5%89%A9%E4%BD%99%E6%AC%A1%E6%95%B0 @route(get_group_at_all_remain)

func (*CQBot) CQGetEssenceMessageList added in v0.9.40

func (bot *CQBot) CQGetEssenceMessageList(groupID int64) global.MSG

CQGetEssenceMessageList 扩展API-获取精华消息列表

https://docs.go-cqhttp.org/api/#%E8%8E%B7%E5%8F%96%E7%B2%BE%E5%8D%8E%E6%B6%88%E6%81%AF%E5%88%97%E8%A1%A8 @route(get_essence_msg_list)

func (*CQBot) CQGetForwardMessage added in v0.9.3

func (bot *CQBot) CQGetForwardMessage(resID string) global.MSG

CQGetForwardMessage 获取合并转发消息

https://git.io/Jtz1F @route(get_forward_msg) @rename(res_id->"[message_id\x2Cid].0")

func (*CQBot) CQGetFriendList

func (bot *CQBot) CQGetFriendList(spec *onebot.Spec) global.MSG

CQGetFriendList 获取好友列表

https://git.io/Jtz1L @route(get_friend_list)

func (*CQBot) CQGetGroupFileSystemInfo added in v0.9.30

func (bot *CQBot) CQGetGroupFileSystemInfo(groupID int64) global.MSG

CQGetGroupFileSystemInfo 扩展API-获取群文件系统信息

https://docs.go-cqhttp.org/api/#%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F%E4%BF%A1%E6%81%AF @route(get_group_file_system_info)

func (*CQBot) CQGetGroupFileURL added in v1.0.0

func (bot *CQBot) CQGetGroupFileURL(groupID int64, fileID string, busID int32) global.MSG

CQGetGroupFileURL 扩展API-获取群文件资源链接

https://docs.go-cqhttp.org/api/#%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%96%87%E4%BB%B6%E8%B5%84%E6%BA%90%E9%93%BE%E6%8E%A5 @route(get_group_file_url) @rename(bus_id->"[busid\x2Cbus_id].0")

func (*CQBot) CQGetGroupFilesByFolderID added in v1.0.0

func (bot *CQBot) CQGetGroupFilesByFolderID(groupID int64, folderID string) global.MSG

CQGetGroupFilesByFolderID 扩展API-获取群子目录文件列表

https://docs.go-cqhttp.org/api/#%E8%8E%B7%E5%8F%96%E7%BE%A4%E5%AD%90%E7%9B%AE%E5%BD%95%E6%96%87%E4%BB%B6%E5%88%97%E8%A1%A8 @route(get_group_files_by_folder)

func (*CQBot) CQGetGroupHonorInfo added in v0.9.20

func (bot *CQBot) CQGetGroupHonorInfo(groupID int64, t string) global.MSG

CQGetGroupHonorInfo 获取群荣誉信息

https://git.io/Jtz1H @route(get_group_honor_info) @rename(t->type)

func (*CQBot) CQGetGroupInfo

func (bot *CQBot) CQGetGroupInfo(groupID int64, noCache bool, spec *onebot.Spec) global.MSG

CQGetGroupInfo 获取群信息

https://git.io/Jtz1O @route(get_group_info)

func (*CQBot) CQGetGroupList

func (bot *CQBot) CQGetGroupList(noCache bool, spec *onebot.Spec) global.MSG

CQGetGroupList 获取群列表

https://git.io/Jtz1t @route(get_group_list)

func (*CQBot) CQGetGroupMemberInfo

func (bot *CQBot) CQGetGroupMemberInfo(groupID, userID int64, noCache bool) global.MSG

CQGetGroupMemberInfo 获取群成员信息

https://git.io/Jtz1s @route(get_group_member_info)

func (*CQBot) CQGetGroupMemberList

func (bot *CQBot) CQGetGroupMemberList(groupID int64, noCache bool) global.MSG

CQGetGroupMemberList 获取群成员列表

https://git.io/Jtz13 @route(get_group_member_list)

func (*CQBot) CQGetGroupMemo added in v1.0.0

func (bot *CQBot) CQGetGroupMemo(groupID int64) global.MSG

CQGetGroupMemo 扩展API-获取群公告 @route(_get_group_notice)

func (*CQBot) CQGetGroupMessageHistory added in v0.9.39

func (bot *CQBot) CQGetGroupMessageHistory(groupID int64, seq int64) global.MSG

CQGetGroupMessageHistory 获取群消息历史记录

https://docs.go-cqhttp.org/api/#%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%B6%88%E6%81%AF%E5%8E%86%E5%8F%B2%E8%AE%B0%E5%BD%95 @route(get_group_msg_history) @rename(seq->message_seq)

func (*CQBot) CQGetGroupRootFiles added in v0.9.30

func (bot *CQBot) CQGetGroupRootFiles(groupID int64) global.MSG

CQGetGroupRootFiles 扩展API-获取群根目录文件列表

https://docs.go-cqhttp.org/api/#%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%A0%B9%E7%9B%AE%E5%BD%95%E6%96%87%E4%BB%B6%E5%88%97%E8%A1%A8 @route(get_group_root_files)

func (*CQBot) CQGetGroupSystemMessages added in v0.9.30

func (bot *CQBot) CQGetGroupSystemMessages() global.MSG

CQGetGroupSystemMessages 扩展API-获取群文件系统消息

https://docs.go-cqhttp.org/api/#%E8%8E%B7%E5%8F%96%E7%BE%A4%E7%B3%BB%E7%BB%9F%E6%B6%88%E6%81%AF @route(get_group_system_msg)

func (*CQBot) CQGetGuildChannelList added in v1.0.0

func (bot *CQBot) CQGetGuildChannelList(guildID uint64, noCache bool) global.MSG

CQGetGuildChannelList 获取频道列表 @route(get_guild_channel_list)

func (*CQBot) CQGetGuildList added in v1.0.0

func (bot *CQBot) CQGetGuildList() global.MSG

CQGetGuildList 获取已加入的频道列表 @route(get_guild_list)

func (*CQBot) CQGetGuildMemberProfile added in v1.0.0

func (bot *CQBot) CQGetGuildMemberProfile(guildID, userID uint64) global.MSG

CQGetGuildMemberProfile 获取频道成员资料 @route(get_guild_member_profile)

func (*CQBot) CQGetGuildMembers added in v1.0.0

func (bot *CQBot) CQGetGuildMembers(guildID uint64, nextToken string) global.MSG

CQGetGuildMembers 获取频道成员列表 @route(get_guild_member_list)

func (*CQBot) CQGetGuildMessage added in v1.0.0

func (bot *CQBot) CQGetGuildMessage(messageID string, noCache bool) global.MSG

CQGetGuildMessage 获取频道消息 @route(get_guild_msg)

func (*CQBot) CQGetGuildMetaByGuest added in v1.0.0

func (bot *CQBot) CQGetGuildMetaByGuest(guildID uint64) global.MSG

CQGetGuildMetaByGuest 通过访客权限获取频道元数据 @route(get_guild_meta_by_guest)

func (*CQBot) CQGetGuildRoles added in v1.0.0

func (bot *CQBot) CQGetGuildRoles(guildID uint64) global.MSG

CQGetGuildRoles 获取频道角色列表 @route(get_guild_roles)

func (*CQBot) CQGetGuildServiceProfile added in v1.0.0

func (bot *CQBot) CQGetGuildServiceProfile() global.MSG

CQGetGuildServiceProfile 获取频道系统个人资料 @route(get_guild_service_profile)

func (*CQBot) CQGetImage

func (bot *CQBot) CQGetImage(file string) global.MSG

CQGetImage 获取图片(修改自OneBot)

https://docs.go-cqhttp.org/api/#%E8%8E%B7%E5%8F%96%E5%9B%BE%E7%89%87%E4%BF%A1%E6%81%AF @route(get_image)

func (*CQBot) CQGetLoginInfo

func (bot *CQBot) CQGetLoginInfo() global.MSG

CQGetLoginInfo 获取登录号信息

https://git.io/Jtz1I @route11(get_login_info) @route12(get_self_info)

func (*CQBot) CQGetMessage added in v0.9.29

func (bot *CQBot) CQGetMessage(messageID int32) global.MSG

CQGetMessage 获取消息

https://git.io/Jtz1b @route(get_msg)

func (*CQBot) CQGetModelShow added in v1.0.0

func (bot *CQBot) CQGetModelShow(model string) global.MSG

CQGetModelShow 获取在线机型

https://club.vip.qq.com/onlinestatus/set @route(_get_model_show)

func (*CQBot) CQGetOnlineClients added in v0.9.39

func (bot *CQBot) CQGetOnlineClients(noCache bool) global.MSG

CQGetOnlineClients 扩展API-获取当前账号在线客户端列表

https://docs.go-cqhttp.org/api/#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E8%B4%A6%E5%8F%B7%E5%9C%A8%E7%BA%BF%E5%AE%A2%E6%88%B7%E7%AB%AF%E5%88%97%E8%A1%A8 @route(get_online_clients)

func (*CQBot) CQGetQiDianAccountInfo added in v1.0.0

func (bot *CQBot) CQGetQiDianAccountInfo() global.MSG

CQGetQiDianAccountInfo 获取企点账号信息 @route(qidian_get_account_info)

func (*CQBot) CQGetStatus

func (bot *CQBot) CQGetStatus(spec *onebot.Spec) global.MSG

CQGetStatus 获取运行状态

https://git.io/JtzMe @route(get_status)

func (*CQBot) CQGetStrangerInfo added in v0.9.26

func (bot *CQBot) CQGetStrangerInfo(userID int64) global.MSG

CQGetStrangerInfo 获取陌生人信息

https://git.io/Jtz17 @route11(get_stranger_info) @route12(get_user_info)

func (*CQBot) CQGetSupportedActions added in v1.0.0

func (bot *CQBot) CQGetSupportedActions(spec *onebot.Spec) global.MSG

CQGetSupportedActions 获取支持的动作列表

@route(get_supported_actions)

func (*CQBot) CQGetTopicChannelFeeds added in v1.0.0

func (bot *CQBot) CQGetTopicChannelFeeds(guildID, channelID uint64) global.MSG

CQGetTopicChannelFeeds 获取话题频道帖子列表 @route(get_topic_channel_feeds)

func (*CQBot) CQGetUnidirectionalFriendList added in v1.0.0

func (bot *CQBot) CQGetUnidirectionalFriendList() global.MSG

CQGetUnidirectionalFriendList 获取单向好友列表

@route(get_unidirectional_friend_list)

func (*CQBot) CQGetVersion added in v1.0.0

func (bot *CQBot) CQGetVersion() global.MSG

CQGetVersion 获取版本信息 OneBotV12

https://git.io/JtwUs @route12(get_version)

func (*CQBot) CQGetVersionInfo

func (bot *CQBot) CQGetVersionInfo() global.MSG

CQGetVersionInfo 获取版本信息

https://git.io/JtwUs @route11(get_version_info)

func (*CQBot) CQGetWordSlices added in v0.9.27

func (bot *CQBot) CQGetWordSlices(content string) global.MSG

CQGetWordSlices 隐藏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)

func (*CQBot) CQGroupFileCreateFolder added in v1.0.0

func (bot *CQBot) CQGroupFileCreateFolder(groupID int64, parentID, name string) global.MSG

CQGroupFileCreateFolder 拓展API-创建群文件文件夹

@route(create_group_file_folder)

func (*CQBot) CQGroupFileDeleteFile added in v1.0.0

func (bot *CQBot) CQGroupFileDeleteFile(groupID int64, id string, busID int32) global.MSG

CQGroupFileDeleteFile 拓展API-删除群文件

@route(delete_group_file) @rename(id->file_id, bus_id->"[busid\x2Cbus_id].0")

func (*CQBot) CQGroupFileDeleteFolder added in v1.0.0

func (bot *CQBot) CQGroupFileDeleteFolder(groupID int64, id string) global.MSG

CQGroupFileDeleteFolder 拓展API-删除群文件文件夹

@route(delete_group_folder) @rename(id->folder_id)

func (*CQBot) CQHandleQuickOperation added in v0.9.1

func (bot *CQBot) CQHandleQuickOperation(context, operation gjson.Result) global.MSG

CQHandleQuickOperation 隐藏API-对事件执行快速操作

https://git.io/Jtz15 @route11(".handle_quick_operation")

func (*CQBot) CQMarkMessageAsRead added in v1.0.0

func (bot *CQBot) CQMarkMessageAsRead(msgID int32) global.MSG

CQMarkMessageAsRead 标记消息已读 @route(mark_msg_as_read) @rename(msg_id->message_id)

func (*CQBot) CQModifyRoleInGuild added in v1.0.0

func (bot *CQBot) CQModifyRoleInGuild(guildID uint64, roleID uint64, name string, color uint32, indepedent bool) global.MSG

CQModifyRoleInGuild 修改频道角色 @route(update_guild_role)

func (*CQBot) CQOcrImage added in v0.9.26

func (bot *CQBot) CQOcrImage(imageID string) global.MSG

CQOcrImage 扩展API-图片OCR

https://docs.go-cqhttp.org/api/#%E5%9B%BE%E7%89%87-ocr @route(ocr_image,".ocr_image") @rename(image_id->image)

func (*CQBot) CQProcessFriendRequest

func (bot *CQBot) CQProcessFriendRequest(flag string, approve bool) global.MSG

CQProcessFriendRequest 处理加好友请求

https://git.io/Jtz11 @route(set_friend_add_request) @default(approve=true)

func (*CQBot) CQProcessGroupRequest

func (bot *CQBot) CQProcessGroupRequest(flag, subType, reason string, approve bool) global.MSG

CQProcessGroupRequest 处理加群请求/邀请

https://git.io/Jtz1D @route(set_group_add_request) @rename(sub_type->"[sub_type\x2Ctype].0") @default(approve=true)

func (*CQBot) CQReloadEventFilter added in v0.9.25

func (bot *CQBot) CQReloadEventFilter(file string) global.MSG

CQReloadEventFilter 重载事件过滤器

@route(reload_event_filter)

func (*CQBot) CQSendForwardMessage added in v1.0.0

func (bot *CQBot) CQSendForwardMessage(groupID, userID int64, m gjson.Result, messageType string) global.MSG

CQSendForwardMessage 发送合并转发消息

@route11(send_forward_msg) @rename(m->messages)

func (*CQBot) CQSendGroupForwardMessage added in v0.9.4

func (bot *CQBot) CQSendGroupForwardMessage(groupID int64, m gjson.Result) global.MSG

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 @route11(send_group_forward_msg) @rename(m->messages)

func (*CQBot) CQSendGroupMessage

func (bot *CQBot) CQSendGroupMessage(groupID int64, m gjson.Result, autoEscape bool) global.MSG

CQSendGroupMessage 发送群消息

https://git.io/Jtz1c @route11(send_group_msg) @rename(m->message)

func (*CQBot) CQSendGroupSign added in v1.0.0

func (bot *CQBot) CQSendGroupSign(groupID int64) global.MSG

CQSendGroupSign 群打卡

https://club.vip.qq.com/onlinestatus/set @route(send_group_sign)

func (*CQBot) CQSendGuildChannelMessage added in v1.0.0

func (bot *CQBot) CQSendGuildChannelMessage(guildID, channelID uint64, m gjson.Result, autoEscape bool) global.MSG

CQSendGuildChannelMessage 发送频道消息

@route(send_guild_channel_msg) @rename(m->message)

func (*CQBot) CQSendMessage added in v1.0.0

func (bot *CQBot) CQSendMessage(groupID, userID int64, m gjson.Result, messageType string, autoEscape bool) global.MSG

CQSendMessage 发送消息

@route11(send_msg) @rename(m->message)

func (*CQBot) CQSendMessageV12 added in v1.0.0

func (bot *CQBot) CQSendMessageV12(groupID, userID, detailType string, m gjson.Result) global.MSG

CQSendMessageV12 发送消息

@route12(send_message) @rename(m->message)

func (*CQBot) CQSendPrivateForwardMessage added in v1.0.0

func (bot *CQBot) CQSendPrivateForwardMessage(userID int64, m gjson.Result) global.MSG

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 @route11(send_private_forward_msg) @rename(m->messages)

func (*CQBot) CQSendPrivateMessage

func (bot *CQBot) CQSendPrivateMessage(userID int64, groupID int64, m gjson.Result, autoEscape bool) global.MSG

CQSendPrivateMessage 发送私聊消息

https://git.io/Jtz1l @route11(send_private_msg) @rename(m->message)

func (*CQBot) CQSetEssenceMessage added in v0.9.40

func (bot *CQBot) CQSetEssenceMessage(messageID int32) global.MSG

CQSetEssenceMessage 扩展API-设置精华消息

https://docs.go-cqhttp.org/api/#%E8%AE%BE%E7%BD%AE%E7%B2%BE%E5%8D%8E%E6%B6%88%E6%81%AF @route(set_essence_msg)

func (*CQBot) CQSetGroupAdmin added in v0.9.25

func (bot *CQBot) CQSetGroupAdmin(groupID, userID int64, enable bool) global.MSG

CQSetGroupAdmin 群组设置管理员

https://git.io/Jtz1S @route(set_group_admin) @default(enable=true)

func (*CQBot) CQSetGroupAnonymous added in v1.0.0

func (bot *CQBot) CQSetGroupAnonymous(groupID int64, enable bool) global.MSG

CQSetGroupAnonymous 群组匿名

https://beautyyu.one @route(set_group_anonymous) @default(enable=true)

func (*CQBot) CQSetGroupAnonymousBan added in v0.9.36

func (bot *CQBot) CQSetGroupAnonymousBan(groupID int64, flag string, duration int32) global.MSG

CQSetGroupAnonymousBan 群组匿名用户禁言

https://git.io/Jtz1p @route(set_group_anonymous_ban) @rename(flag->"[anonymous_flag\x2Canonymous.flag].0")

func (*CQBot) CQSetGroupBan

func (bot *CQBot) CQSetGroupBan(groupID, userID int64, duration uint32) global.MSG

CQSetGroupBan 群组单人禁言

https://git.io/Jtz1w @route(set_group_ban) @default(duration=1800)

func (*CQBot) CQSetGroupCard

func (bot *CQBot) CQSetGroupCard(groupID, userID int64, card string) global.MSG

CQSetGroupCard 设置群名片(群备注)

https://git.io/Jtz1B @route(set_group_card)

func (*CQBot) CQSetGroupKick

func (bot *CQBot) CQSetGroupKick(groupID int64, userID int64, msg string, block bool) global.MSG

CQSetGroupKick 群组踢人

https://git.io/Jtz1V @route(set_group_kick) @rename(msg->message, block->reject_add_request)

func (*CQBot) CQSetGroupLeave added in v0.9.6

func (bot *CQBot) CQSetGroupLeave(groupID int64) global.MSG

CQSetGroupLeave 退出群组

https://git.io/Jtz1K @route(set_group_leave)

func (*CQBot) CQSetGroupMemo added in v0.9.24

func (bot *CQBot) CQSetGroupMemo(groupID int64, msg, img string) global.MSG

CQSetGroupMemo 扩展API-发送群公告

https://docs.go-cqhttp.org/api/#%E5%8F%91%E9%80%81%E7%BE%A4%E5%85%AC%E5%91%8A @route(_send_group_notice) @rename(msg->content, img->image)

func (*CQBot) CQSetGroupName

func (bot *CQBot) CQSetGroupName(groupID int64, name string) global.MSG

CQSetGroupName 设置群名

https://git.io/Jtz12 @route(set_group_name) @rename(name->group_name)

func (*CQBot) CQSetGroupPortrait added in v0.9.26

func (bot *CQBot) CQSetGroupPortrait(groupID int64, file, cache string) global.MSG

CQSetGroupPortrait 扩展API-设置群头像

https://docs.go-cqhttp.org/api/#%E8%AE%BE%E7%BD%AE%E7%BE%A4%E5%A4%B4%E5%83%8F @route(set_group_portrait)

func (*CQBot) CQSetGroupSpecialTitle

func (bot *CQBot) CQSetGroupSpecialTitle(groupID, userID int64, title string) global.MSG

CQSetGroupSpecialTitle 设置群组专属头衔

https://git.io/Jtz10 @route(set_group_special_title) @rename(title->special_title)

func (*CQBot) CQSetGroupWholeBan

func (bot *CQBot) CQSetGroupWholeBan(groupID int64, enable bool) global.MSG

CQSetGroupWholeBan 群组全员禁言

https://git.io/Jtz1o @route(set_group_whole_ban) @default(enable=true)

func (*CQBot) CQSetGuildMemberRole added in v1.0.0

func (bot *CQBot) CQSetGuildMemberRole(guildID uint64, set bool, roleID uint64, users gjson.Result) global.MSG

CQSetGuildMemberRole 设置用户在频道中的角色 @route(set_guild_member_role)

func (*CQBot) CQSetModelShow added in v1.0.0

func (bot *CQBot) CQSetModelShow(model, modelShow string) global.MSG

CQSetModelShow 设置在线机型

https://club.vip.qq.com/onlinestatus/set @route(_set_model_show)

func (*CQBot) CQSetQQProfile added in v1.0.0

func (bot *CQBot) CQSetQQProfile(nickname, company, email, college, personalNote gjson.Result) global.MSG

CQSetQQProfile 设置 QQ 资料

@route(set_qq_profile)

func (*CQBot) CQUploadGroupFile added in v0.9.40

func (bot *CQBot) CQUploadGroupFile(groupID int64, file, name, folder string) global.MSG

CQUploadGroupFile 扩展API-上传群文件

https://docs.go-cqhttp.org/api/#%E4%B8%8A%E4%BC%A0%E7%BE%A4%E6%96%87%E4%BB%B6 @route(upload_group_file)

func (*CQBot) CQUploadPrivateFile added in v1.0.0

func (bot *CQBot) CQUploadPrivateFile(userID int64, file, name string) global.MSG

CQUploadPrivateFile 扩展API-上传私聊文件

@route(upload_private_file)

func (*CQBot) ConvertContentMessage added in v1.0.0

func (bot *CQBot) ConvertContentMessage(content []global.MSG, sourceType message.SourceType, noReply bool) (r []message.IMessageElement)

ConvertContentMessage 将数据库用的 content 转换为消息元素数组

func (*CQBot) ConvertElement added in v1.0.0

func (bot *CQBot) ConvertElement(spec *onebot.Spec, elem msg.Element, sourceType message.SourceType) (m any, err error)

ConvertElement 将解码后的消息转换为MiraiGoElement.

返回 interface{} 存在三种类型

message.IMessageElement []message.IMessageElement nil

func (*CQBot) ConvertElements added in v1.0.0

func (bot *CQBot) ConvertElements(spec *onebot.Spec, elems []msg.Element, sourceType message.SourceType, noReply bool) (r []message.IMessageElement)

ConvertElements 将解码后的消息数组转换为MiraiGo表示

func (*CQBot) ConvertObjectMessage added in v0.9.4

func (bot *CQBot) ConvertObjectMessage(spec *onebot.Spec, m gjson.Result, sourceType message.SourceType) (r []message.IMessageElement)

ConvertObjectMessage 将消息JSON对象转为消息元素数组

func (*CQBot) ConvertStringMessage

func (bot *CQBot) ConvertStringMessage(spec *onebot.Spec, raw string, sourceType message.SourceType) (r []message.IMessageElement)

ConvertStringMessage 将消息字符串转为消息元素数组

func (*CQBot) InsertGroupMessage

func (bot *CQBot) InsertGroupMessage(m *message.GroupMessage, source message.Source) int32

InsertGroupMessage 群聊消息入数据库

func (*CQBot) InsertGuildChannelMessage added in v1.0.0

func (bot *CQBot) InsertGuildChannelMessage(m *message.GuildChannelMessage) string

InsertGuildChannelMessage 频道消息入数据库

func (*CQBot) InsertPrivateMessage added in v0.9.29

func (bot *CQBot) InsertPrivateMessage(m *message.PrivateMessage, source message.Source) int32

InsertPrivateMessage 私聊消息入数据库

func (*CQBot) OnEventPush

func (bot *CQBot) OnEventPush(f func(e *Event))

OnEventPush 注册事件上报函数

func (*CQBot) SendGroupMessage

func (bot *CQBot) SendGroupMessage(groupID int64, m *message.SendingMessage) (int32, error)

SendGroupMessage 发送群消息

func (*CQBot) SendGuildChannelMessage added in v1.0.0

func (bot *CQBot) SendGuildChannelMessage(guildID, channelID uint64, m *message.SendingMessage) string

SendGuildChannelMessage 发送频道消息

func (*CQBot) SendPrivateMessage

func (bot *CQBot) SendPrivateMessage(target int64, groupID int64, m *message.SendingMessage) int32

SendPrivateMessage 发送私聊消息

type Event added in v1.0.0

type Event struct {
	Raw *event
	// contains filtered or unexported fields
}

Event 事件

func (*Event) JSONBytes added in v1.0.0

func (e *Event) JSONBytes() []byte

JSONBytes return byes of json by lazy marshalling.

func (*Event) JSONString added in v1.0.0

func (e *Event) JSONString() string

JSONString return string of json without extra allocation by lazy marshalling.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL