1
0
mirror of https://github.com/fumiama/NanoBot.git synced 2026-06-08 20:20:23 +08:00

optimize: hide caller & add preblock

This commit is contained in:
源文雨
2023-10-18 13:36:48 +09:00
parent 9c5a9796e1
commit 3bab1f9031
13 changed files with 581 additions and 75 deletions

433
api_generated.go Normal file
View File

@@ -0,0 +1,433 @@
// Code generated by codegen/context. DO NOT EDIT.
package nano
// 生成自文件 openapi_announces.go
// PostAnnounceInGuild 创建频道全局公告,公告类型分为 消息类型的频道公告 和 推荐子频道类型的频道公告
//
// https://bot.q.qq.com/wiki/develop/api/openapi/announces/post_guild_announces.html
//
// 会重写 content 为返回值
func (ctx *Ctx) PostAnnounceInGuild(id string, content *Announces) error {
return ctx.caller.PostAnnounceInGuild(id, content)
}
// DeleteAnnounceInGuild 删除频道 guild_id 下指定 message_id 的全局公告
//
// https://bot.q.qq.com/wiki/develop/api/openapi/announces/delete_guild_announces.html
//
// message_id 有值时,会校验 message_id 合法性,若不校验校验 message_id请将 message_id 设置为 all
func (ctx *Ctx) DeleteAnnounceInGuild(guildid, messageid string) error {
return ctx.caller.DeleteAnnounceInGuild(guildid, messageid)
}
// 生成自文件 openapi_audio.go
// ControlAudioInChannel 控制子频道 channel_id 下的音频
//
// https://bot.q.qq.com/wiki/develop/api/openapi/audio/audio_control.html
func (ctx *Ctx) ControlAudioInChannel(id string, control *AudioControl) error {
return ctx.caller.ControlAudioInChannel(id, control)
}
// OpenMic 机器人在 channel_id 对应的语音子频道上麦
//
// https://bot.q.qq.com/wiki/develop/api/openapi/audio/put_mic.html
func (ctx *Ctx) OpenMicInChannel(id string) error {
return ctx.caller.OpenMicInChannel(id)
}
// CloseMicInChannel 机器人在 channel_id 对应的语音子频道下麦
//
// https://bot.q.qq.com/wiki/develop/api/openapi/audio/delete_mic.html
func (ctx *Ctx) CloseMicInChannel(id string) error {
return ctx.caller.CloseMicInChannel(id)
}
// 生成自文件 openapi_channel.go
// GetChannelsOfGuild 获取 guild_id 指定的频道下的子频道列表
//
// https://bot.q.qq.com/wiki/develop/api/openapi/channel/get_channels.html
func (ctx *Ctx) GetChannelsOfGuild(id string) (channels []Channel, err error) {
return ctx.caller.GetChannelsOfGuild(id)
}
// GetChannelByID 用于获取 channel_id 指定的子频道的详情
//
// https://bot.q.qq.com/wiki/develop/api/openapi/channel/get_channel.html
func (ctx *Ctx) GetChannelByID(id string) (*Channel, error) {
return ctx.caller.GetChannelByID(id)
}
// CreateChannelInGuild 用于在 guild_id 指定的频道下创建一个子频道
//
// https://bot.q.qq.com/wiki/develop/api/openapi/channel/post_channels.html
func (ctx *Ctx) CreateChannelInGuild(id string, config *ChannelPost) (*Channel, error) {
return ctx.caller.CreateChannelInGuild(id, config)
}
// PatchChannelOf 修改 channel_id 指定的子频道的信息
//
// https://bot.q.qq.com/wiki/develop/api/openapi/channel/patch_channel.html
func (ctx *Ctx) PatchChannelOf(id string, config *ChannelPatch) (*Channel, error) {
return ctx.caller.PatchChannelOf(id, config)
}
// DeleteChannelOf 删除 channel_id 指定的子频道
//
// https://bot.q.qq.com/wiki/develop/api/openapi/channel/delete_channel.html
func (ctx *Ctx) DeleteChannelOf(id string) error {
return ctx.caller.DeleteChannelOf(id)
}
// GetOnlineNumsInChannel 查询音视频/直播子频道 channel_id 的在线成员数
//
// https://bot.q.qq.com/wiki/develop/api/openapi/channel/get_online_nums.html
func (ctx *Ctx) GetOnlineNumsInChannel(id string) (int, error) {
return ctx.caller.GetOnlineNumsInChannel(id)
}
// GetChannelPermissionsOfUser 获取子频道 channel_id 下用户 user_id 的权限
//
// https://bot.q.qq.com/wiki/develop/api/openapi/channel_permissions/get_channel_permissions.html
func (ctx *Ctx) GetChannelPermissionsOfUser(channelid, userid string) (*ChannelPermissions, error) {
return ctx.caller.GetChannelPermissionsOfUser(channelid, userid)
}
// SetChannelPermissionsOfUser 修改子频道 channel_id 下用户 user_id 的权限
//
// https://bot.q.qq.com/wiki/develop/api/openapi/channel_permissions/put_channel_permissions.html
func (ctx *Ctx) SetChannelPermissionsOfUser(channelid, userid string, add, remove string) error {
return ctx.caller.SetChannelPermissionsOfUser(channelid, userid, add, remove)
}
// GetChannelPermissionsOfRole 获取子频道 channel_id 下身份组 role_id 的权限
//
// https://bot.q.qq.com/wiki/develop/api/openapi/channel_permissions/get_channel_roles_permissions.html
func (ctx *Ctx) GetChannelPermissionsOfRole(channelid, roleid string) (*ChannelPermissions, error) {
return ctx.caller.GetChannelPermissionsOfRole(channelid, roleid)
}
// SetChannelPermissionsOfRole 修改子频道 channel_id 下身份组 role_id 的权限
//
// https://bot.q.qq.com/wiki/develop/api/openapi/channel_permissions/put_channel_roles_permissions.html
func (ctx *Ctx) SetChannelPermissionsOfRole(channelid, roleid string, add, remove string) error {
return ctx.caller.SetChannelPermissionsOfRole(channelid, roleid, add, remove)
}
// 生成自文件 openapi_codegen_getopenapiof.go
// 生成自文件 openapi_codegen_patchopenapiof.go
// 生成自文件 openapi_codegen_postopenapiof.go
// 生成自文件 openapi_codegen_putopenapiof.go
// 生成自文件 openapi_dms.go
// CreatePrivateChat 机器人和在同一个频道内的成员创建私信会话
//
// https://bot.q.qq.com/wiki/develop/api/openapi/dms/post_dms.html
func (ctx *Ctx) CreatePrivateChat(guildid, userid string) (*DMS, error) {
return ctx.caller.CreatePrivateChat(guildid, userid)
}
// PostMessageToUser 发送私信消息,前提是已经创建了私信会话
//
// https://bot.q.qq.com/wiki/develop/api/openapi/dms/post_dms_messages.html
//
// - 私信的 guild_id 在创建私信会话时以及私信消息事件中获取
func (ctx *Ctx) PostMessageToUser(id string, content *MessagePost) (*Message, error) {
return ctx.caller.PostMessageToUser(id, content)
}
// DeleteMessageOfUser 撤回私信频道 guild_id 中 message_id 指定的私信消息, 只能用于撤回机器人自己发送的私信
//
// https://bot.q.qq.com/wiki/develop/api/openapi/dms/delete_dms.html
func (ctx *Ctx) DeleteMessageOfUser(guildid, messageid string, hidetip bool) error {
return ctx.caller.DeleteMessageOfUser(guildid, messageid, hidetip)
}
// 生成自文件 openapi_emoji.go
// GiveMessageReaction 对消息 message_id 进行表情表态
//
// https://bot.q.qq.com/wiki/develop/api/openapi/reaction/put_message_reaction.html
func (ctx *Ctx) GiveMessageReaction(channelid, messageid string, emoji Emoji) error {
return ctx.caller.GiveMessageReaction(channelid, messageid, emoji)
}
// DeleteMessageReaction 删除自己对消息 message_id 的表情表态
//
// https://bot.q.qq.com/wiki/develop/api/openapi/reaction/delete_own_message_reaction.html
func (ctx *Ctx) DeleteMessageReaction(channelid, messageid string, emoji Emoji) error {
return ctx.caller.DeleteMessageReaction(channelid, messageid, emoji)
}
// GetMessageReactionUsers 拉取对消息 message_id 指定表情表态的用户列表
//
// https://bot.q.qq.com/wiki/develop/api/openapi/reaction/get_reaction_users.html
func (ctx *Ctx) GetMessageReactionUsers(channelid, messageid string, emoji Emoji, cookie string, limit int) (*MessageReactionUsers, error) {
return ctx.caller.GetMessageReactionUsers(channelid, messageid, emoji, cookie, limit)
}
// 生成自文件 openapi_forum.go
// GetChannelThreads 获取子频道下的帖子列表
//
// https://bot.q.qq.com/wiki/develop/api/openapi/forum/get_threads_list.html
func (ctx *Ctx) GetChannelThreads(id string) (threads []Thread, isfinish bool, err error) {
return ctx.caller.GetChannelThreads(id)
}
// GetThreadInfo 获取子频道下的帖子详情
//
// https://bot.q.qq.com/wiki/develop/api/openapi/forum/get_thread.html
func (ctx *Ctx) GetThreadInfo(channelid, threadid string) (*ThreadInfo, error) {
return ctx.caller.GetThreadInfo(channelid, threadid)
}
// PostThread 发表帖子
//
// https://bot.q.qq.com/wiki/develop/api/openapi/forum/put_thread.html
func (ctx *Ctx) PostThreadInChannel(id string, title string, content string, format uint32) (taskid string, createtime string, err error) {
return ctx.caller.PostThreadInChannel(id, title, content, format)
}
// DeleteThreadInChannel 删除指定子频道下的某个帖子
//
// https://bot.q.qq.com/wiki/develop/api/openapi/forum/delete_thread.html
func (ctx *Ctx) DeleteThreadInChannel(channelid, threadid string) error {
return ctx.caller.DeleteThreadInChannel(channelid, threadid)
}
// 生成自文件 openapi_guild.go
// GetGuildByID 获取 guild_id 指定的频道的详情
//
// https://bot.q.qq.com/wiki/develop/api/openapi/guild/get_guild.html
func (ctx *Ctx) GetGuildByID(id string) (*Guild, error) {
return ctx.caller.GetGuildByID(id)
}
// SetAllMuteInGuild 禁言全员 / 解除全员禁言
//
// https://bot.q.qq.com/wiki/develop/api/openapi/guild/patch_guild_mute.html
func (ctx *Ctx) SetAllMuteInGuild(id string, endtimestamp string, seconds string) error {
return ctx.caller.SetAllMuteInGuild(id, endtimestamp, seconds)
}
// SetUserMuteInGuild 禁言 / 解除禁言频道 guild_id 下的成员 user_id
//
// https://bot.q.qq.com/wiki/develop/api/openapi/guild/patch_guild_mute.html
func (ctx *Ctx) SetUserMuteInGuild(guildid, userid string, endtimestamp string, seconds string) error {
return ctx.caller.SetUserMuteInGuild(guildid, userid, endtimestamp, seconds)
}
// SetUsersMuteInGuild 批量禁言 / 解除禁言频道 guild_id 下的成员 user_id
//
// https://bot.q.qq.com/wiki/develop/api/openapi/guild/patch_guild_mute.html
func (ctx *Ctx) SetUsersMuteInGuild(guildid string, endtimestamp string, seconds string, userids ...string) ([]string, error) {
return ctx.caller.SetUsersMuteInGuild(guildid, endtimestamp, seconds, userids...)
}
// 生成自文件 openapi_markdown.go
// 生成自文件 openapi_member.go
// GetGuildMembersIn 获取 guild_id 指定的频道中所有成员的详情列表,支持分页
//
// https://bot.q.qq.com/wiki/develop/api/openapi/member/get_members.html
func (ctx *Ctx) GetGuildMembersIn(id, after string, limit uint32) (members []Member, err error) {
return ctx.caller.GetGuildMembersIn(id, after, limit)
}
// GetRoleMembersOf 获取 guild_id 频道中指定role_id身份组下所有成员的详情列表支持分页
//
// https://bot.q.qq.com/wiki/develop/api/openapi/member/get_role_members.html
func (ctx *Ctx) GetRoleMembersOf(guildid, roleid, startindex string, limit uint32) (*RoleMembers, error) {
return ctx.caller.GetRoleMembersOf(guildid, roleid, startindex, limit)
}
// GetGuildMemberOf 获取 guild_id 指定的频道中 user_id 对应成员的详细信息
//
// https://bot.q.qq.com/wiki/develop/api/openapi/member/get_member.html
func (ctx *Ctx) GetGuildMemberOf(guildid, userid string) (*Member, error) {
return ctx.caller.GetGuildMemberOf(guildid, userid)
}
// DeleteGuildMemberOf 删除 guild_id 指定的频道下的成员 user_id
//
// https://bot.q.qq.com/wiki/develop/api/openapi/member/delete_member.html
//
// - delhistmsgdays: 消息撤回时间范围仅支持固定的天数371530。 特殊的时间范围:-1: 撤回全部消息。默认值为0不撤回任何消息。
func (ctx *Ctx) DeleteGuildMemberOf(guildid, userid string, addblklst bool, delhistmsgdays int) error {
return ctx.caller.DeleteGuildMemberOf(guildid, userid, addblklst, delhistmsgdays)
}
// 生成自文件 openapi_message.go
// GetMessageFromChannel 获取子频道 channel_id 下的消息 message_id 的详情
//
// https://bot.q.qq.com/wiki/develop/api/openapi/message/get_message_of_id.html
func (ctx *Ctx) GetMessageFromChannel(messageid, channelid string) (*Message, error) {
return ctx.caller.GetMessageFromChannel(messageid, channelid)
}
// PostMessageToChannel 向 channel_id 指定的子频道发送消息
//
// https://bot.q.qq.com/wiki/develop/api/openapi/message/post_messages.html
func (ctx *Ctx) PostMessageToChannel(id string, content *MessagePost) (*Message, error) {
return ctx.caller.PostMessageToChannel(id, content)
}
// DeleteMessageInChannel 回子频道 channel_id 下的消息 message_id
//
// https://bot.q.qq.com/wiki/develop/api/openapi/message/delete_message.html
func (ctx *Ctx) DeleteMessageInChannel(channelid, messageid string, hidetip bool) error {
return ctx.caller.DeleteMessageInChannel(channelid, messageid, hidetip)
}
// GetGuildMessageSetting 获取机器人在频道 guild_id 内的消息频率设置
//
// https://bot.q.qq.com/wiki/develop/api/openapi/setting/message_setting.html
func (ctx *Ctx) GetGuildMessageSetting(id string) (*MessageSetting, error) {
return ctx.caller.GetGuildMessageSetting(id)
}
// 生成自文件 openapi_permissions.go
// 生成自文件 openapi_pins.go
// PinMessageInChannel 添加子频道 channel_id 内的精华消息
//
// https://bot.q.qq.com/wiki/develop/api/openapi/pins/put_pins_message.html
func (ctx *Ctx) PinMessageInChannel(channelid, messageid string) (*PinsMessage, error) {
return ctx.caller.PinMessageInChannel(channelid, messageid)
}
// UnpinMessageInChannel 子频道 channel_id 下指定 message_id 的精华消息
//
// https://bot.q.qq.com/wiki/develop/api/openapi/pins/delete_pins_message.html
//
// 删除子频道内全部精华消息,请将 message_id 设置为 all
func (ctx *Ctx) UnpinMessageInChannel(channelid, messageid string) error {
return ctx.caller.UnpinMessageInChannel(channelid, messageid)
}
// GetPinMessagesOfChannel 获取子频道 channel_id 内的精华消息
//
// https://bot.q.qq.com/wiki/develop/api/openapi/pins/get_pins_message.html
func (ctx *Ctx) GetPinMessagesOfChannel(id string) (*PinsMessage, error) {
return ctx.caller.GetPinMessagesOfChannel(id)
}
// 生成自文件 openapi_richobj.go
// 生成自文件 openapi_role.go
// GetGuildRoleListIn 获取 guild_id 指定的频道下的身份组列表
//
// https://bot.q.qq.com/wiki/develop/api/openapi/guild/get_guild_roles.html
func (ctx *Ctx) GetGuildRoleListIn(id string) (*GuildRoleList, error) {
return ctx.caller.GetGuildRoleListIn(id)
}
// CreateGuildRoleOf 创建频道身份组
//
// https://bot.q.qq.com/wiki/develop/api/openapi/guild/post_guild_role.html
//
// 参数为非必填,但至少需要传其中之一,默认为空或 0
func (ctx *Ctx) CreateGuildRoleOf(id string, name string, color uint32, hoist int32) (*GuildRoleCreate, error) {
return ctx.caller.CreateGuildRoleOf(id, name, color, hoist)
}
// PatchGuildRoleOf 修改频道 guild_id 下 role_id 指定的身份组
//
// https://bot.q.qq.com/wiki/develop/api/openapi/guild/patch_guild_role.html
func (ctx *Ctx) PatchGuildRoleOf(guildid, roleid string, name string, color uint32, hoist int32) (*GuildRolePatch, error) {
return ctx.caller.PatchGuildRoleOf(guildid, roleid, name, color, hoist)
}
// DeleteGuildRoleOf 删除频道 guild_id下 role_id 对应的身份组
//
// https://bot.q.qq.com/wiki/develop/api/openapi/guild/delete_guild_role.html
func (ctx *Ctx) DeleteGuildRoleOf(guildid, roleid string) error {
return ctx.caller.DeleteGuildRoleOf(guildid, roleid)
}
// AddRoleToMemberOfGuild 将频道 guild_id 下的用户 user_id 添加到身份组 role_id
//
// https://bot.q.qq.com/wiki/develop/api/openapi/guild/put_guild_member_role.html
//
// 返回 channel_id
func (ctx *Ctx) AddRoleToMemberOfGuild(guildid, userid, roleid, channelid string) (string, error) {
return ctx.caller.AddRoleToMemberOfGuild(guildid, userid, roleid, channelid)
}
// RemoveRoleFromMemberOfGuild 将用户 user_id 从 频道 guild_id 的 role_id 身份组中移除
//
// https://bot.q.qq.com/wiki/develop/api/openapi/guild/delete_guild_member_role.html
func (ctx *Ctx) RemoveRoleFromMemberOfGuild(guildid, userid, roleid, channelid string) error {
return ctx.caller.RemoveRoleFromMemberOfGuild(guildid, userid, roleid, channelid)
}
// 生成自文件 openapi_schedule.go
// GetChannelSchedules 获取channel_id指定的子频道中当天的日程列表
//
// https://bot.q.qq.com/wiki/develop/api/openapi/schedule/get_schedules.html
func (ctx *Ctx) GetChannelSchedules(id string, since uint64) (schedules []Schedule, err error) {
return ctx.caller.GetChannelSchedules(id, since)
}
// GetScheduleInChannel 获取日程子频道 channel_id 下 schedule_id 指定的的日程的详情
//
// https://bot.q.qq.com/wiki/develop/api/openapi/schedule/get_schedule.html
func (ctx *Ctx) GetScheduleInChannel(channelid string, scheduleid string) (*Schedule, error) {
return ctx.caller.GetScheduleInChannel(channelid, scheduleid)
}
// CreateScheduleInChannel 在 channel_id 指定的日程子频道下创建一个日程
//
// https://bot.q.qq.com/wiki/develop/api/openapi/schedule/post_schedule.html
//
// schedule 会被写入返回的对象
func (ctx *Ctx) CreateScheduleInChannel(id string, schedule *Schedule) error {
return ctx.caller.CreateScheduleInChannel(id, schedule)
}
// PatchScheduleInChannel 修改日程子频道 channel_id 下 schedule_id 指定的日程的详情
//
// https://bot.q.qq.com/wiki/develop/api/openapi/schedule/patch_schedule.html
//
// schedule 会被写入返回的对象
func (ctx *Ctx) PatchScheduleInChannel(channelid string, scheduleid string, schedule *Schedule) error {
return ctx.caller.PatchScheduleInChannel(channelid, scheduleid, schedule)
}
// DeleteScheduleInChannel 删除日程子频道 channel_id 下 schedule_id 指定的日程
//
// https://bot.q.qq.com/wiki/develop/api/openapi/schedule/delete_schedule.html
func (ctx *Ctx) DeleteScheduleInChannel(channelid string, scheduleid string) error {
return ctx.caller.DeleteScheduleInChannel(channelid, scheduleid)
}
// 生成自文件 openapi_user.go
// AtMe 返回 <@!bot.ready.User.ID>
func (ctx *Ctx) AtMe() string {
return ctx.caller.AtMe()
}
// GetMyInfo 获取当前用户(机器人)详情
//
// https://bot.q.qq.com/wiki/develop/api/openapi/user/me.html
func (ctx *Ctx) GetMyInfo() (*User, error) {
return ctx.caller.GetMyInfo()
}
// GetMyGuilds 获取当前用户(机器人)频道列表,支持分页
//
// https://bot.q.qq.com/wiki/develop/api/openapi/user/guilds.html
func (ctx *Ctx) GetMyGuilds(before, after string, limit int) (guilds []Guild, err error) {
return ctx.caller.GetMyGuilds(before, after, limit)
}
// 生成自文件 openapi_wss.go
// GetGeneralWSSGateway 获取通用 WSS 接入点
//
// https://bot.q.qq.com/wiki/develop/api/openapi/wss/url_get.html
func (ctx *Ctx) GetGeneralWSSGateway() (string, error) {
return ctx.caller.GetGeneralWSSGateway()
}
// GetShardWSSGateway 获取带分片 WSS 接入点
//
// https://bot.q.qq.com/wiki/develop/api/openapi/wss/shard_url_get.html
func (ctx *Ctx) GetShardWSSGateway() (*ShardWSSGateway, error) {
return ctx.caller.GetShardWSSGateway()
}