Documentation ¶
Index ¶
- Constants
- Variables
- func AdminPermission(ctx *Ctx) bool
- func BytesToString(b []byte) string
- func ChannelAdminPermission(ctx *Ctx) bool
- func CreaterPermission(ctx *Ctx) bool
- func Delete(service string)
- func DigestID(id string) uint64
- func ForEachByPrio(iterator func(i int, manager *ctrl.Control[*Ctx]) bool)
- func GetTriggeredMessages(id string) []string
- func HasAttachments(ctx *Ctx) bool
- func HideURL(s string) string
- func Lookup(service string) (*ctrl.Control[*Ctx], bool)
- func MessageEscape(text string) string
- func MessageUnescape(text string) string
- func NewHTTPEndpointDeleteRequestWithAuth(ep string, contenttype string, auth, appid string, body io.Reader) (*http.Request, error)
- func NewHTTPEndpointGetRequestWithAuth(ep string, contenttype string, auth, appid string, body io.Reader) (*http.Request, error)
- func NewHTTPEndpointPatchRequestWithAuth(ep string, contenttype string, auth, appid string, body io.Reader) (*http.Request, error)
- func NewHTTPEndpointPostRequestWithAuth(ep string, contenttype string, auth, appid string, body io.Reader) (*http.Request, error)
- func NewHTTPEndpointPutRequestWithAuth(ep string, contenttype string, auth, appid string, body io.Reader) (*http.Request, error)
- func OnlyChannel(ctx *Ctx) bool
- func OnlyDirect(ctx *Ctx) bool
- func OnlyGuild(ctx *Ctx) bool
- func OnlyPrivate(ctx *Ctx) bool
- func OnlyPublic(ctx *Ctx) bool
- func OnlyQQ(ctx *Ctx) bool
- func OnlyQQGroup(ctx *Ctx) bool
- func OnlyQQPrivate(ctx *Ctx) bool
- func OnlyToMe(ctx *Ctx) bool
- func ParseShell(s string) []string
- func RangeBot(iter func(id string, ctx *Ctx) bool)
- func Run(preblock func(), bots ...*Bot) error
- func Start(bots ...*Bot) error
- func StringToBytes(s string) (b []byte)
- func SuperUserPermission(ctx *Ctx) bool
- func UnderlineToCamel(s string) string
- func UserOrChannelAdmin(ctx *Ctx) bool
- func UserOrGrpAdmin(ctx *Ctx) bool
- func WriteBodyByMultipartFormData(params ...any) (*bytes.Buffer, string, error)
- func WriteBodyFromJSON(ptr any) *bytes.Buffer
- func WriteHTTPQueryIfNotNil(baseurl string, queries ...any) string
- type Announces
- type AudioAction
- type AudioControl
- type AudioControlStatus
- type AudioLiveChannelUsersChange
- type AuditResult
- type Bot
- func (bot *Bot) AddRoleToMemberOfGuild(guildid, userid, roleid, channelid string) (string, error)
- func (bot *Bot) AtMe() string
- func (bot *Bot) Authorization() string
- func (bot *Bot) CloseMicInChannel(id string) error
- func (bot *Bot) Connect() *Bot
- func (bot *Bot) ControlAudioInChannel(id string, control *AudioControl) error
- func (bot *Bot) CreateChannelInGuild(id string, config *ChannelPost) (*Channel, error)
- func (bot *Bot) CreateGuildRoleOf(id string, name string, color uint32, hoist int32) (*GuildRoleCreate, error)
- func (bot *Bot) CreatePrivateChat(guildid, userid string) (*DMS, error)
- func (bot *Bot) CreateScheduleInChannel(id string, schedule *Schedule) error
- func (bot *Bot) DeleteAnnounceInGuild(guildid, messageid string) error
- func (bot *Bot) DeleteChannelOf(id string) error
- func (bot *Bot) DeleteGuildMemberOf(guildid, userid string, addblklst bool, delhistmsgdays int) error
- func (bot *Bot) DeleteGuildRoleOf(guildid, roleid string) error
- func (bot *Bot) DeleteMessageInChannel(channelid, messageid string, hidetip bool) error
- func (bot *Bot) DeleteMessageOfUser(guildid, messageid string, hidetip bool) error
- func (bot *Bot) DeleteMessageReaction(channelid, messageid string, emoji Emoji) error
- func (bot *Bot) DeleteOpenAPI(ep, contenttype string, body io.Reader) error
- func (bot *Bot) DeleteOpenAPIWithPtr(ep, contenttype string, ptr any, body io.Reader) error
- func (bot *Bot) DeleteScheduleInChannel(channelid string, scheduleid string) error
- func (bot *Bot) DeleteThreadInChannel(channelid, threadid string) error
- func (bot *Bot) GetAppAccessTokenNoContext() error
- func (bot *Bot) GetChannelByID(id string) (*Channel, error)
- func (bot *Bot) GetChannelPermissionsOfRole(channelid, roleid string) (*ChannelPermissions, error)
- func (bot *Bot) GetChannelPermissionsOfUser(channelid, userid string) (*ChannelPermissions, error)
- func (bot *Bot) GetChannelSchedules(id string, since uint64) (schedules []Schedule, err error)
- func (bot *Bot) GetChannelThreads(id string) (threads []Thread, isfinish bool, err error)
- func (bot *Bot) GetChannelsOfGuild(id string) (channels []Channel, err error)
- func (bot *Bot) GetFirstSuperUser(ids ...string) string
- func (bot *Bot) GetGeneralWSSGatewayNoContext() (string, error)
- func (bot *Bot) GetGuildByID(id string) (*Guild, error)
- func (bot *Bot) GetGuildMemberOf(guildid, userid string) (*Member, error)
- func (bot *Bot) GetGuildMembersIn(id, after string, limit uint32) (members []Member, err error)
- func (bot *Bot) GetGuildMessageSetting(id string) (*MessageSetting, error)
- func (bot *Bot) GetGuildRoleListIn(id string) (*GuildRoleList, error)
- func (bot *Bot) GetMessageFromChannel(messageid, channelid string) (*Message, error)
- func (bot *Bot) GetMessageReactionUsers(channelid, messageid string, emoji Emoji, cookie string, limit int) (*MessageReactionUsers, error)
- func (bot *Bot) GetMyGuilds(before, after string, limit int) (guilds []Guild, err error)
- func (bot *Bot) GetMyInfo() (*User, error)
- func (bot *Bot) GetOnlineNumsInChannel(id string) (int, error)
- func (bot *Bot) GetOpenAPI(ep, contenttype string, ptr any) error
- func (bot *Bot) GetOpenAPIWithBody(ep, contenttype string, ptr any, body io.Reader) error
- func (bot *Bot) GetPinMessagesOfChannel(id string) (*PinsMessage, error)
- func (bot *Bot) GetRoleMembersOf(guildid, roleid, startindex string, limit uint32) (*RoleMembers, error)
- func (bot *Bot) GetScheduleInChannel(channelid string, scheduleid string) (*Schedule, error)
- func (bot *Bot) GetShardWSSGatewayNoContext() (*ShardWSSGateway, error)
- func (bot *Bot) GetThreadInfo(channelid, threadid string) (*ThreadInfo, error)
- func (bot *Bot) GiveMessageReaction(channelid, messageid string, emoji Emoji) error
- func (bot *Bot) Init(secret, gateway string, shard [2]byte) *Bot
- func (bot *Bot) IsV2() bool
- func (bot *Bot) Listen()
- func (bot *Bot) OpenMicInChannel(id string) error
- func (bot *Bot) PatchChannelOf(id string, config *ChannelPatch) (*Channel, error)
- func (bot *Bot) PatchGuildRoleOf(guildid, roleid string, name string, color uint32, hoist int32) (*GuildRolePatch, error)
- func (bot *Bot) PatchOpenAPI(ep, contenttype string, ptr any, body io.Reader) error
- func (bot *Bot) PatchScheduleInChannel(channelid string, scheduleid string, schedule *Schedule) error
- func (bot *Bot) PinMessageInChannel(channelid, messageid string) (*PinsMessage, error)
- func (bot *Bot) PostAnnounceInGuild(id string, content *Announces) error
- func (bot *Bot) PostFileToQQGroup(id string, content *FilePost) (*Message, error)
- func (bot *Bot) PostFileToQQUser(id string, content *FilePost) (*Message, error)
- func (bot *Bot) PostMessageToChannel(id string, content *MessagePost) (*Message, error)
- func (bot *Bot) PostMessageToQQGroup(id string, content *MessagePost) (*Message, error)
- func (bot *Bot) PostMessageToQQUser(id string, content *MessagePost) (*Message, error)
- func (bot *Bot) PostMessageToUser(id string, content *MessagePost) (*Message, error)
- func (bot *Bot) PostOpenAPI(ep, contenttype string, ptr any, body io.Reader) error
- func (bot *Bot) PostThreadInChannel(id string, title string, content string, format uint32) (taskid string, createtime string, err error)
- func (bot *Bot) PutOpenAPI(ep, contenttype string, ptr any, body io.Reader) error
- func (bot *Bot) RemoveRoleFromMemberOfGuild(guildid, userid, roleid, channelid string) error
- func (bot *Bot) Resume() error
- func (bot *Bot) SendPayload(wp *WebsocketPayload) error
- func (bot *Bot) SetAllMuteInGuild(id string, endtimestamp string, seconds string) error
- func (bot *Bot) SetChannelPermissionsOfRole(channelid, roleid string, add, remove string) error
- func (bot *Bot) SetChannelPermissionsOfUser(channelid, userid string, add, remove string) error
- func (bot *Bot) SetUserMuteInGuild(guildid, userid string, endtimestamp string, seconds string) error
- func (bot *Bot) SetUsersMuteInGuild(guildid string, endtimestamp string, seconds string, userids ...string) ([]string, error)
- func (bot *Bot) UnpinMessageInChannel(channelid, messageid string) error
- type Channel
- type ChannelPatch
- type ChannelPermissions
- type ChannelPost
- type ChannelSubType
- type ChannelType
- type CodeMessageBase
- type Ctx
- func (ctx *Ctx) AddRoleToMemberOfGuild(guildid, userid, roleid, channelid string) (string, error)
- func (ctx *Ctx) AtMe() string
- func (ctx *Ctx) Block()
- func (ctx *Ctx) Break()
- func (ctx *Ctx) CheckSession() Rule
- func (ctx *Ctx) CloseMicInChannel(id string) error
- func (ctx *Ctx) ControlAudioInChannel(id string, control *AudioControl) error
- func (ctx *Ctx) CreateChannelInGuild(id string, config *ChannelPost) (*Channel, error)
- func (ctx *Ctx) CreateGuildRoleOf(id string, name string, color uint32, hoist int32) (*GuildRoleCreate, error)
- func (ctx *Ctx) CreatePrivateChat(guildid, userid string) (*DMS, error)
- func (ctx *Ctx) CreateScheduleInChannel(id string, schedule *Schedule) error
- func (ctx *Ctx) DeleteAnnounceInGuild(guildid, messageid string) error
- func (ctx *Ctx) DeleteChannelOf(id string) error
- func (ctx *Ctx) DeleteGuildMemberOf(guildid, userid string, addblklst bool, delhistmsgdays int) error
- func (ctx *Ctx) DeleteGuildRoleOf(guildid, roleid string) error
- func (ctx *Ctx) DeleteMessageInChannel(channelid, messageid string, hidetip bool) error
- func (ctx *Ctx) DeleteMessageOfUser(guildid, messageid string, hidetip bool) error
- func (ctx *Ctx) DeleteMessageReaction(channelid, messageid string, emoji Emoji) error
- func (ctx *Ctx) DeleteScheduleInChannel(channelid string, scheduleid string) error
- func (ctx *Ctx) DeleteThreadInChannel(channelid, threadid string) error
- func (ctx *Ctx) Echo(payload *WebsocketPayload)
- func (ctx *Ctx) ExtractPlainText() string
- func (ctx *Ctx) FutureEvent(Type string, rule ...Rule) *FutureEvent
- func (ctx *Ctx) Get(prompt string) string
- func (ctx *Ctx) GetChannelByID(id string) (*Channel, error)
- func (ctx *Ctx) GetChannelPermissionsOfRole(channelid, roleid string) (*ChannelPermissions, error)
- func (ctx *Ctx) GetChannelPermissionsOfUser(channelid, userid string) (*ChannelPermissions, error)
- func (ctx *Ctx) GetChannelSchedules(id string, since uint64) (schedules []Schedule, err error)
- func (ctx *Ctx) GetChannelThreads(id string) (threads []Thread, isfinish bool, err error)
- func (ctx *Ctx) GetChannelsOfGuild(id string) (channels []Channel, err error)
- func (ctx *Ctx) GetGuildByID(id string) (*Guild, error)
- func (ctx *Ctx) GetGuildMemberOf(guildid, userid string) (*Member, error)
- func (ctx *Ctx) GetGuildMembersIn(id, after string, limit uint32) (members []Member, err error)
- func (ctx *Ctx) GetGuildMessageSetting(id string) (*MessageSetting, error)
- func (ctx *Ctx) GetGuildRoleListIn(id string) (*GuildRoleList, error)
- func (ctx *Ctx) GetMessageFromChannel(messageid, channelid string) (*Message, error)
- func (ctx *Ctx) GetMessageReactionUsers(channelid, messageid string, emoji Emoji, cookie string, limit int) (*MessageReactionUsers, error)
- func (ctx *Ctx) GetMyGuilds(before, after string, limit int) (guilds []Guild, err error)
- func (ctx *Ctx) GetMyInfo() (*User, error)
- func (ctx *Ctx) GetOnlineNumsInChannel(id string) (int, error)
- func (ctx *Ctx) GetPinMessagesOfChannel(id string) (*PinsMessage, error)
- func (ctx *Ctx) GetReady() *EventReady
- func (ctx *Ctx) GetRoleMembersOf(guildid, roleid, startindex string, limit uint32) (*RoleMembers, error)
- func (ctx *Ctx) GetScheduleInChannel(channelid string, scheduleid string) (*Schedule, error)
- func (ctx *Ctx) GetThreadInfo(channelid, threadid string) (*ThreadInfo, error)
- func (ctx *Ctx) GiveMessageReaction(channelid, messageid string, emoji Emoji) error
- func (ctx *Ctx) GroupID() uint64
- func (ctx *Ctx) MessageString() string
- func (ctx *Ctx) OpenMicInChannel(id string) error
- func (ctx *Ctx) Parse(model interface{}) (err error)
- func (ctx *Ctx) PatchChannelOf(id string, config *ChannelPatch) (*Channel, error)
- func (ctx *Ctx) PatchGuildRoleOf(guildid, roleid string, name string, color uint32, hoist int32) (*GuildRolePatch, error)
- func (ctx *Ctx) PatchScheduleInChannel(channelid string, scheduleid string, schedule *Schedule) error
- func (ctx *Ctx) PinMessageInChannel(channelid, messageid string) (*PinsMessage, error)
- func (ctx *Ctx) Post(replytosender bool, post *MessagePost) (reply *Message, err error)
- func (ctx *Ctx) PostAnnounceInGuild(id string, content *Announces) error
- func (ctx *Ctx) PostFileToQQGroup(id string, content *FilePost) (*Message, error)
- func (ctx *Ctx) PostFileToQQUser(id string, content *FilePost) (*Message, error)
- func (ctx *Ctx) PostMessageToChannel(id string, content *MessagePost) (*Message, error)
- func (ctx *Ctx) PostMessageToQQGroup(id string, content *MessagePost) (*Message, error)
- func (ctx *Ctx) PostMessageToQQUser(id string, content *MessagePost) (*Message, error)
- func (ctx *Ctx) PostMessageToUser(id string, content *MessagePost) (*Message, error)
- func (ctx *Ctx) PostThreadInChannel(id string, title string, content string, format uint32) (taskid string, createtime string, err error)
- func (ctx *Ctx) RemoveRoleFromMemberOfGuild(guildid, userid, roleid, channelid string) error
- func (ctx *Ctx) Send(messages Messages) (m []*Message, err error)
- func (ctx *Ctx) SendChain(message ...MessageSegment) (m []*Message, err error)
- func (ctx *Ctx) SendImage(file string, replytosender bool, caption ...any) (reply *Message, err error)
- func (ctx *Ctx) SendImageBytes(data []byte, replytosender bool, caption ...any) (*Message, error)
- func (ctx *Ctx) SendPlainMessage(replytosender bool, printable ...any) (*Message, error)
- func (ctx *Ctx) SetAllMuteInGuild(id string, endtimestamp string, seconds string) error
- func (ctx *Ctx) SetChannelPermissionsOfRole(channelid, roleid string, add, remove string) error
- func (ctx *Ctx) SetChannelPermissionsOfUser(channelid, userid string, add, remove string) error
- func (ctx *Ctx) SetUserMuteInGuild(guildid, userid string, endtimestamp string, seconds string) error
- func (ctx *Ctx) SetUsersMuteInGuild(guildid string, endtimestamp string, seconds string, userids ...string) ([]string, error)
- func (ctx *Ctx) UnpinMessageInChannel(channelid, messageid string) error
- func (ctx *Ctx) UserID() uint64
- type DMS
- type Emoji
- type Engine
- func (e *Engine) ApplySingle(s *Single[int64]) *Engine
- func (e *Engine) DataFolder() string
- func (e *Engine) Delete()
- func (e *Engine) GetLazyData(filename string, isDataMustEqual bool) ([]byte, error)
- func (e *Engine) On(typ string, rules ...Rule) *Matcher
- func (e *Engine) OnAudioFinish(rules ...Rule) *Matcher
- func (e *Engine) OnAudioOffMic(rules ...Rule) *Matcher
- func (e *Engine) OnAudioOnMic(rules ...Rule) *Matcher
- func (e *Engine) OnAudioOrLiveChannelMemberEnter(rules ...Rule) *Matcher
- func (e *Engine) OnAudioOrLiveChannelMemberExit(rules ...Rule) *Matcher
- func (e *Engine) OnAudioStart(rules ...Rule) *Matcher
- func (e *Engine) OnChannelCreate(rules ...Rule) *Matcher
- func (e *Engine) OnChannelDelete(rules ...Rule) *Matcher
- func (e *Engine) OnChannelUpdate(rules ...Rule) *Matcher
- func (e *Engine) OnForumPostCreate(rules ...Rule) *Matcher
- func (e *Engine) OnForumPostDelete(rules ...Rule) *Matcher
- func (e *Engine) OnForumPublishAuditResult(rules ...Rule) *Matcher
- func (e *Engine) OnForumReplyCreate(rules ...Rule) *Matcher
- func (e *Engine) OnForumReplyDelete(rules ...Rule) *Matcher
- func (e *Engine) OnForumThreadCreate(rules ...Rule) *Matcher
- func (e *Engine) OnForumThreadDelete(rules ...Rule) *Matcher
- func (e *Engine) OnForumThreadUpdate(rules ...Rule) *Matcher
- func (e *Engine) OnGuildCreate(rules ...Rule) *Matcher
- func (e *Engine) OnGuildDelete(rules ...Rule) *Matcher
- func (e *Engine) OnGuildMemberAdd(rules ...Rule) *Matcher
- func (e *Engine) OnGuildMemberRemove(rules ...Rule) *Matcher
- func (e *Engine) OnGuildMemberUpdate(rules ...Rule) *Matcher
- func (e *Engine) OnGuildUpdate(rules ...Rule) *Matcher
- func (e *Engine) OnMessage(rules ...Rule) *Matcher
- func (e *Engine) OnMessageAuditPass(rules ...Rule) *Matcher
- func (e *Engine) OnMessageAuditReject(rules ...Rule) *Matcher
- func (e *Engine) OnMessageCommand(commands string, rules ...Rule) *Matcher
- func (e *Engine) OnMessageCommandGroup(commands []string, rules ...Rule) *Matcher
- func (e *Engine) OnMessageDelete(rules ...Rule) *Matcher
- func (e *Engine) OnMessageFullMatch(src string, rules ...Rule) *Matcher
- func (e *Engine) OnMessageFullMatchGroup(src []string, rules ...Rule) *Matcher
- func (e *Engine) OnMessageKeyword(keyword string, rules ...Rule) *Matcher
- func (e *Engine) OnMessageKeywordGroup(keywords []string, rules ...Rule) *Matcher
- func (e *Engine) OnMessagePrefix(prefix string, rules ...Rule) *Matcher
- func (e *Engine) OnMessagePrefixGroup(prefix []string, rules ...Rule) *Matcher
- func (e *Engine) OnMessageReactionAdd(rules ...Rule) *Matcher
- func (e *Engine) OnMessageReactionRemove(rules ...Rule) *Matcher
- func (e *Engine) OnMessageRegex(regexPattern string, rules ...Rule) *Matcher
- func (e *Engine) OnMessageShell(command string, model interface{}, rules ...Rule) *Matcher
- func (e *Engine) OnMessageSuffix(suffix string, rules ...Rule) *Matcher
- func (e *Engine) OnMessageSuffixGroup(suffix []string, rules ...Rule) *Matcher
- func (e *Engine) OnOpenForumPostCreate(rules ...Rule) *Matcher
- func (e *Engine) OnOpenForumPostDelete(rules ...Rule) *Matcher
- func (e *Engine) OnOpenForumReplyCreate(rules ...Rule) *Matcher
- func (e *Engine) OnOpenForumReplyDelete(rules ...Rule) *Matcher
- func (e *Engine) OnOpenForumThreadCreate(rules ...Rule) *Matcher
- func (e *Engine) OnOpenForumThreadDelete(rules ...Rule) *Matcher
- func (e *Engine) OnOpenForumThreadUpdate(rules ...Rule) *Matcher
- func (e *Engine) UseMidHandler(rules ...Rule)
- func (e *Engine) UsePostHandler(handler ...Process)
- func (e *Engine) UsePreHandler(rules ...Rule)
- type Event
- type EventReady
- type FilePost
- type FileType
- type FutureEvent
- type Guild
- type GuildRoleChannelID
- type GuildRoleCreate
- type GuildRoleList
- type GuildRolePatch
- type HTTPRequsetConstructer
- type Handler
- type InlineKeyboard
- type InlineKeyboardButton
- type InlineKeyboardButtonAction
- type InlineKeyboardButtonActionPermission
- type InlineKeyboardButtonActionPermissionType
- type InlineKeyboardButtonActionType
- type InlineKeyboardButtonRenderData
- type InlineKeyboardButtonRenderDataStyle
- type InlineKeyboardRow
- type Manager
- type Matcher
- func On(typ string, rules ...Rule) *Matcher
- func OnAudioFinish(rules ...Rule) *Matcher
- func OnAudioOffMic(rules ...Rule) *Matcher
- func OnAudioOnMic(rules ...Rule) *Matcher
- func OnAudioOrLiveChannelMemberEnter(rules ...Rule) *Matcher
- func OnAudioOrLiveChannelMemberExit(rules ...Rule) *Matcher
- func OnAudioStart(rules ...Rule) *Matcher
- func OnChannelCreate(rules ...Rule) *Matcher
- func OnChannelDelete(rules ...Rule) *Matcher
- func OnChannelUpdate(rules ...Rule) *Matcher
- func OnForumPostCreate(rules ...Rule) *Matcher
- func OnForumPostDelete(rules ...Rule) *Matcher
- func OnForumPublishAuditResult(rules ...Rule) *Matcher
- func OnForumReplyCreate(rules ...Rule) *Matcher
- func OnForumReplyDelete(rules ...Rule) *Matcher
- func OnForumThreadCreate(rules ...Rule) *Matcher
- func OnForumThreadDelete(rules ...Rule) *Matcher
- func OnForumThreadUpdate(rules ...Rule) *Matcher
- func OnGuildCreate(rules ...Rule) *Matcher
- func OnGuildDelete(rules ...Rule) *Matcher
- func OnGuildMemberAdd(rules ...Rule) *Matcher
- func OnGuildMemberRemove(rules ...Rule) *Matcher
- func OnGuildMemberUpdate(rules ...Rule) *Matcher
- func OnGuildUpdate(rules ...Rule) *Matcher
- func OnMessage(rules ...Rule) *Matcher
- func OnMessageAuditPass(rules ...Rule) *Matcher
- func OnMessageAuditReject(rules ...Rule) *Matcher
- func OnMessageCommand(commands string, rules ...Rule) *Matcher
- func OnMessageCommandGroup(commands []string, rules ...Rule) *Matcher
- func OnMessageDelete(rules ...Rule) *Matcher
- func OnMessageFullMatch(src string, rules ...Rule) *Matcher
- func OnMessageFullMatchGroup(src []string, rules ...Rule) *Matcher
- func OnMessageKeyword(keyword string, rules ...Rule) *Matcher
- func OnMessageKeywordGroup(keywords []string, rules ...Rule) *Matcher
- func OnMessagePrefix(prefix string, rules ...Rule) *Matcher
- func OnMessagePrefixGroup(prefix []string, rules ...Rule) *Matcher
- func OnMessageReactionAdd(rules ...Rule) *Matcher
- func OnMessageReactionRemove(rules ...Rule) *Matcher
- func OnMessageRegex(regexPattern string, rules ...Rule) *Matcher
- func OnMessageShell(command string, model interface{}, rules ...Rule) *Matcher
- func OnMessageSuffix(suffix string, rules ...Rule) *Matcher
- func OnMessageSuffixGroup(suffix []string, rules ...Rule) *Matcher
- func OnOpenForumPostCreate(rules ...Rule) *Matcher
- func OnOpenForumPostDelete(rules ...Rule) *Matcher
- func OnOpenForumReplyCreate(rules ...Rule) *Matcher
- func OnOpenForumReplyDelete(rules ...Rule) *Matcher
- func OnOpenForumThreadCreate(rules ...Rule) *Matcher
- func OnOpenForumThreadDelete(rules ...Rule) *Matcher
- func OnOpenForumThreadUpdate(rules ...Rule) *Matcher
- func StoreMatcher(m *Matcher) *Matcher
- func StoreTempMatcher(m *Matcher) *Matcher
- type Member
- type Message
- type MessageArk
- type MessageArkKV
- type MessageArkObj
- type MessageArkObjKV
- type MessageAttachment
- type MessageAudited
- type MessageDelete
- type MessageEmbed
- type MessageEmbedField
- type MessageEmbedThumbnail
- type MessageKeyboard
- type MessageMarkdown
- type MessageMarkdownParams
- type MessageMedia
- type MessagePost
- type MessageReaction
- type MessageReactionUsers
- type MessageReference
- type MessageSegment
- func At(id string) MessageSegment
- func AtAll() MessageSegment
- func AtChannel(id string) MessageSegment
- func Face(id int) MessageSegment
- func Image(file string) MessageSegment
- func ImageBytes(data []byte) MessageSegment
- func Record(url string) MessageSegment
- func ReplyTo(id string) MessageSegment
- func Text(text ...interface{}) MessageSegment
- func Video(url string) MessageSegment
- type MessageSegmentType
- type MessageSetting
- type MessageType
- type Messages
- type OpCode
- type OpCodeIdentifyMessage
- type Option
- type PinsMessage
- type Post
- type PostInfo
- type PrivateType
- type Process
- type QQRobotStatus
- type ReactionTarget
- type ReactionTargetType
- type RecommendChannel
- type Reply
- type ReplyInfo
- type Role
- type RoleMembers
- type Rule
- func CheckChannel(channelID ...string) Rule
- func CheckGuild(guildID ...string) Rule
- func CheckUser(userID ...string) Rule
- func CommandGroupRule(commands ...string) Rule
- func CommandRule(command string) Rule
- func FullMatchGroupRule(src ...string) Rule
- func FullMatchRule(src string) Rule
- func KeywordGroupRule(src ...string) Rule
- func KeywordRule(src string) Rule
- func MustProvidePhoto(onmessage string, needphohint, failhint string) Rule
- func PrefixGroupRule(prefixes ...string) Rule
- func PrefixRule(prefix string) Rule
- func RegexRule(regexPattern string) Rule
- func ReplyRule(messageID string) Rule
- func ShellRule(cmd string, model interface{}) Rule
- func SuffixGroupRule(suffixes ...string) Rule
- func SuffixRule(suffix string) Rule
- type Schedule
- type ShardWSSGateway
- type Single
- type SpeakPermission
- type State
- type Thread
- type ThreadInfo
- type User
- type WebsocketPayload
Constants ¶
const ( IntentGuilds = 1 << 0 IntentGuildMembers = 1 << 1 IntentGuildMessages = 1 << 9 IntentGuildMessageReactions = 1 << 10 IntentDirectMessage = 1 << 12 IntentOpenForumsEvent = 1 << 18 IntentAudioOrLiveChannelMember = 1 << 19 IntentQQ = 1 << 25 IntentInteraction = 1 << 26 IntentMessageAudit = 1 << 27 IntentForumsEvent = 1 << 28 IntentAudioAction = 1 << 29 IntentPublicGuildMessages = 1 << 30 // IntentAllGuild 监听全部频道事件 IntentAllGuild = IntentGuilds | IntentGuildMembers | IntentGuildMessages | IntentGuildMessageReactions | IntentDirectMessage | IntentOpenForumsEvent | IntentAudioOrLiveChannelMember | IntentInteraction | IntentMessageAudit | IntentForumsEvent | IntentAudioAction | IntentPublicGuildMessages // IntentPublic 监听频道公域事件 IntentGuildPublic = IntentGuilds | IntentGuildMembers | IntentGuildMessageReactions | IntentDirectMessage | IntentOpenForumsEvent | IntentAudioOrLiveChannelMember | IntentInteraction | IntentMessageAudit | IntentAudioAction | IntentPublicGuildMessages // IntentPrivate 监听频道私域事件 IntentGuildPrivate = IntentGuilds | IntentGuildMembers | IntentGuildMessages | IntentGuildMessageReactions | IntentDirectMessage | IntentAudioOrLiveChannelMember | IntentInteraction | IntentMessageAudit | IntentForumsEvent | IntentAudioAction )
https://bot.q.qq.com/wiki/develop/api/gateway/intents.html
const ( // StorageFolder 插件控制数据目录 StorageFolder = "data/control/" // Md5File ... Md5File = StorageFolder + "stor.spb" )
const ( // StandardAPI 正式环境接口域名 StandardAPI = `https://api.sgroup.qq.com` // SandboxAPI 沙箱环境接口域名 SandboxAPI = `https://sandbox.api.sgroup.qq.com` // AccessTokenAPI 获取接口凭证的 API AccessTokenAPI = "https://bots.qq.com/app/getAppAccessToken" )
const ( ChannelTypeText ChannelType = iota // 文字子频道 ChannelTypeReserved1 // 保留,不可用 ChannelTypeAudio // 语音子频道 ChannelTypeReserved2 // 保留,不可用 ChannelTypeSubchannel // 子频道分组 ChannelTypeLive = 10000 + iota // 直播子频道 ChannelTypeApplication // 应用子频道 ChannelTypeForum // 论坛子频道 )
const ( SpeakPermissionInvalid = iota // 无效类型 SpeakPermissionAll // 所有人 SpeakPermissionAdminAndShimei // 群主管理员+指定成员,可使用 修改子频道权限接口 指定成员 )
const ( RoleIDAll = "1" // 全体成员 RoleIDAdmin = "2" // 管理员 RoleIDCreater = "4" // 群主/创建者 RoleIDChannelAdmin = "5" // 子频道管理员 )
const ( FileTypeImage = iota + 1 // png/jpg FileTypeVideo // mp4 FileTypeAudio // silk FileTypeFile // 暂不开放 )
const (
// SuperUserAllQQUsers 使所有 QQ 用户成为超级用户
SuperUserAllQQUsers = "AllQQUsers"
)
Variables ¶
var ( ErrEmptyToken = errors.New("empty token") ErrInvalidExpire = errors.New("invalid expire") )
var (
ErrEmptyMessagePost = errors.New("empty message post")
)
var (
ErrMustGiveChannelID = errors.New("must give channel_id")
)
var (
OpenAPI = StandardAPI // OpenAPI 实际使用的 API, 默认 StandardAPI, 可自行赋值配置
)
Functions ¶
func AdminPermission ¶
AdminPermission only triggered by the admins or higher permission
func ChannelAdminPermission ¶
ChannelAdminPermission only triggered by the channel admins or higher permission
func CreaterPermission ¶
CreaterPermission only triggered by the creater or higher permission
func ForEachByPrio ¶
ForEachByPrio iterates through managers by their priority.
func GetTriggeredMessages ¶
GetTriggeredMessages 获取被 id 消息触发的回复消息 id
func HasAttachments ¶
HasAttachments 消息包含 Attachments (典型: 图片) 返回 true
func MessageEscape ¶
MessageEscape 消息转义
https://bot.q.qq.com/wiki/develop/api/openapi/message/message_format.html
func MessageUnescape ¶
MessageUnescape 消息解转义
https://bot.q.qq.com/wiki/develop/api/openapi/message/message_format.html
func NewHTTPEndpointDeleteRequestWithAuth ¶
func NewHTTPEndpointDeleteRequestWithAuth(ep string, contenttype string, auth, appid string, body io.Reader) (*http.Request, error)
NewHTTPEndpointDeleteRequestWithAuth 新建带鉴权头的 HTTP DELETE 请求
func NewHTTPEndpointGetRequestWithAuth ¶
func NewHTTPEndpointGetRequestWithAuth(ep string, contenttype string, auth, appid string, body io.Reader) (*http.Request, error)
NewHTTPEndpointGetRequestWithAuth 新建带鉴权头的 HTTP GET 请求
func NewHTTPEndpointPatchRequestWithAuth ¶
func NewHTTPEndpointPatchRequestWithAuth(ep string, contenttype string, auth, appid string, body io.Reader) (*http.Request, error)
NewHTTPEndpointPatchRequestWithAuth 新建带鉴权头的 HTTP PATCH 请求
func NewHTTPEndpointPostRequestWithAuth ¶
func NewHTTPEndpointPostRequestWithAuth(ep string, contenttype string, auth, appid string, body io.Reader) (*http.Request, error)
NewHTTPEndpointPostRequestWithAuth 新建带鉴权头的 HTTP POST 请求
func NewHTTPEndpointPutRequestWithAuth ¶
func NewHTTPEndpointPutRequestWithAuth(ep string, contenttype string, auth, appid string, body io.Reader) (*http.Request, error)
NewHTTPEndpointPutRequestWithAuth 新建带鉴权头的 HTTP PUT 请求
func OnlyToMe ¶
OnlyToMe only triggered in conditions of @bot or begin with the nicknames
this rule only supports Message
func ParseShell ¶
ParseShell 将指令转换为指令参数. modified from https://github.com/mattn/go-shellwords
func SuperUserPermission ¶
SuperUserPermission only triggered by the bot's owner
func UnderlineToCamel ¶
UnderlineToCamel convert abc_def to AbcDef
func WriteBodyByMultipartFormData ¶
WriteBodyByMultipartFormData 使用 multipart/form-data 上传
func WriteBodyFromJSON ¶
WriteBodyFromJSON 从 json 结构体 ptr 写入 bytes.Buffer, 忽略 error (内部使用不会出错)
func WriteHTTPQueryIfNotNil ¶
WriteHTTPQueryIfNotNil 如果非空则将请求添加到 baseurl 后
ex. WriteHTTPQueryIfNotNil("http://a.com/api", "a", 0, "b", 1, "c", 2) is http://a.com/api?b=1&c=2
Types ¶
type Announces ¶
type Announces struct { GuildID string `json:"guild_id,omitempty"` ChannelID string `json:"channel_id,omitempty"` MessageID string `json:"message_id,omitempty"` AnnouncesType uint32 `json:"announces_type,omitempty"` // 公告类别 0:成员公告 1:欢迎公告,默认成员公告 RecommendChannels []RecommendChannel `json:"recommend_channels,omitempty"` }
Announces 公告对象
https://bot.q.qq.com/wiki/develop/api/openapi/announces/model.html#announces
type AudioAction ¶
type AudioAction struct { ChannelID string `json:"channel_id"` GuildID string `json:"guild_id"` AudioURL string `json:"audio_url"` Text string `json:"text"` }
AudioAction 音频事件
https://bot.q.qq.com/wiki/develop/api/openapi/audio/model.html
type AudioControl ¶
type AudioControl struct { AudioURL string `json:"audio_url"` Text string `json:"text"` Status AudioControlStatus `json:"status"` }
AudioControl 控制子频道 channel_id 下的音频
https://bot.q.qq.com/wiki/develop/api/openapi/audio/audio_control.html
type AudioControlStatus ¶
type AudioControlStatus int
AudioControlStatus https://bot.q.qq.com/wiki/develop/api/openapi/audio/model.html#status
const ( AudioControlStatusStart AudioControlStatus = iota AudioControlStatusPause AudioControlStatusResume AudioControlStatusStop )
type AudioLiveChannelUsersChange ¶
type AudioLiveChannelUsersChange struct { GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` ChannelType int `json:"channel_type"` UserID string `json:"user_id"` }
AudioLiveChannelUsersChange 音视频/直播子频道成员进出事件
https://bot.q.qq.com/wiki/develop/api/gateway/audio_or_live_channel_member.html
type AuditResult ¶
type AuditResult struct { GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` AuthorID string `json:"author_id"` ThreadID string `json:"thread_id"` PostID string `json:"post_id"` ReplyID string `json:"reply_id"` Type uint32 `json:"type"` Result uint32 `json:"result"` ErrMsg string `json:"err_msg"` }
AuditResult 论坛帖子审核结果事件
https://bot.q.qq.com/wiki/develop/api/openapi/forum/model.html#auditresult
type Bot ¶
type Bot struct { AppID string `yaml:"AppID"` // AppID is BotAppID(开发者ID) Token string `yaml:"Token"` // Token is 机器人令牌 有 Secret 则使用新版 API Secret string `yaml:"Secret"` // Secret is 机器人令牌 V2 (AppSecret/ClientSecret) 沙盒目前虽然能登录但无法收发消息 SuperUsers []string `yaml:"SuperUsers"` // SuperUsers 超级用户, 特殊: AllQQUsers 将使所有 QQ 用户成为超级用户 Timeout time.Duration `yaml:"Timeout"` // Timeout is API 调用超时 Handler *Handler `yaml:"-"` // Handler 注册对各种事件的处理 Intents uint32 `yaml:"Intents"` // Intents 欲接收的事件 ShardIndex uint8 `yaml:"ShardIndex"` // ShardIndex 本连接为第几个分片, 默认 1, 0 为不使用分片 ShardCount uint8 `yaml:"ShardCount"` // ShardCount 分片总数 Properties json.RawMessage `yaml:"Properties"` // Properties 一些环境变量, 目前没用 // contains filtered or unexported fields }
Bot 一个机器人实例的配置
func (*Bot) AddRoleToMemberOfGuild ¶
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 (*Bot) Authorization ¶
Authorization 返回 Authorization Header value
func (*Bot) CloseMicInChannel ¶
CloseMicInChannel 机器人在 channel_id 对应的语音子频道下麦
https://bot.q.qq.com/wiki/develop/api/openapi/audio/delete_mic.html
func (*Bot) Connect ¶
Connect 连接到 Gateway + 鉴权连接
https://bot.q.qq.com/wiki/develop/api/gateway/reference.html#_1-%E8%BF%9E%E6%8E%A5%E5%88%B0-gateway
func (*Bot) ControlAudioInChannel ¶
func (bot *Bot) ControlAudioInChannel(id string, control *AudioControl) error
ControlAudioInChannel 控制子频道 channel_id 下的音频
https://bot.q.qq.com/wiki/develop/api/openapi/audio/audio_control.html
func (*Bot) CreateChannelInGuild ¶
func (bot *Bot) CreateChannelInGuild(id string, config *ChannelPost) (*Channel, error)
CreateChannelInGuild 用于在 guild_id 指定的频道下创建一个子频道
https://bot.q.qq.com/wiki/develop/api/openapi/channel/post_channels.html
func (*Bot) CreateGuildRoleOf ¶
func (bot *Bot) CreateGuildRoleOf(id string, name string, color uint32, hoist int32) (*GuildRoleCreate, error)
CreateGuildRoleOf 创建频道身份组
https://bot.q.qq.com/wiki/develop/api/openapi/guild/post_guild_role.html
参数为非必填,但至少需要传其中之一,默认为空或 0
func (*Bot) CreatePrivateChat ¶
CreatePrivateChat 机器人和在同一个频道内的成员创建私信会话
https://bot.q.qq.com/wiki/develop/api/openapi/dms/post_dms.html
func (*Bot) CreateScheduleInChannel ¶
CreateScheduleInChannel 在 channel_id 指定的日程子频道下创建一个日程
https://bot.q.qq.com/wiki/develop/api/openapi/schedule/post_schedule.html
schedule 会被写入返回的对象
func (*Bot) DeleteAnnounceInGuild ¶
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 (*Bot) DeleteChannelOf ¶
DeleteChannelOf 删除 channel_id 指定的子频道
https://bot.q.qq.com/wiki/develop/api/openapi/channel/delete_channel.html
func (*Bot) DeleteGuildMemberOf ¶
func (bot *Bot) DeleteGuildMemberOf(guildid, userid string, addblklst bool, delhistmsgdays int) error
DeleteGuildMemberOf 删除 guild_id 指定的频道下的成员 user_id
https://bot.q.qq.com/wiki/develop/api/openapi/member/delete_member.html
- delhistmsgdays: 消息撤回时间范围仅支持固定的天数:3,7,15,30。 特殊的时间范围:-1: 撤回全部消息。默认值为0不撤回任何消息。
func (*Bot) DeleteGuildRoleOf ¶
DeleteGuildRoleOf 删除频道 guild_id下 role_id 对应的身份组
https://bot.q.qq.com/wiki/develop/api/openapi/guild/delete_guild_role.html
func (*Bot) DeleteMessageInChannel ¶
DeleteMessageInChannel 回子频道 channel_id 下的消息 message_id
https://bot.q.qq.com/wiki/develop/api/openapi/message/delete_message.html
func (*Bot) DeleteMessageOfUser ¶
DeleteMessageOfUser 撤回私信频道 guild_id 中 message_id 指定的私信消息, 只能用于撤回机器人自己发送的私信
https://bot.q.qq.com/wiki/develop/api/openapi/dms/delete_dms.html
func (*Bot) DeleteMessageReaction ¶
DeleteMessageReaction 删除自己对消息 message_id 的表情表态
https://bot.q.qq.com/wiki/develop/api/openapi/reaction/delete_own_message_reaction.html
func (*Bot) DeleteOpenAPI ¶
DeleteOpenAPI 向 ep 发送 DELETE 请求
func (*Bot) DeleteOpenAPIWithPtr ¶
DeleteOpenAPIWithPtr 带返回值地向 ep 发送 DELETE 请求
func (*Bot) DeleteScheduleInChannel ¶
DeleteScheduleInChannel 删除日程子频道 channel_id 下 schedule_id 指定的日程
https://bot.q.qq.com/wiki/develop/api/openapi/schedule/delete_schedule.html
func (*Bot) DeleteThreadInChannel ¶
DeleteThreadInChannel 删除指定子频道下的某个帖子
https://bot.q.qq.com/wiki/develop/api/openapi/forum/delete_thread.html
func (*Bot) GetAppAccessTokenNoContext ¶
GetAppAccessTokenNoContext 获取接口凭证并保存到 bot.Token
func (*Bot) GetChannelByID ¶
GetChannelByID 用于获取 channel_id 指定的子频道的详情
https://bot.q.qq.com/wiki/develop/api/openapi/channel/get_channel.html
func (*Bot) GetChannelPermissionsOfRole ¶
func (bot *Bot) GetChannelPermissionsOfRole(channelid, roleid string) (*ChannelPermissions, error)
GetChannelPermissionsOfRole 获取子频道 channel_id 下身份组 role_id 的权限
https://bot.q.qq.com/wiki/develop/api/openapi/channel_permissions/get_channel_roles_permissions.html
func (*Bot) GetChannelPermissionsOfUser ¶
func (bot *Bot) GetChannelPermissionsOfUser(channelid, userid string) (*ChannelPermissions, error)
GetChannelPermissionsOfUser 获取子频道 channel_id 下用户 user_id 的权限
https://bot.q.qq.com/wiki/develop/api/openapi/channel_permissions/get_channel_permissions.html
func (*Bot) GetChannelSchedules ¶
GetChannelSchedules 获取channel_id指定的子频道中当天的日程列表
https://bot.q.qq.com/wiki/develop/api/openapi/schedule/get_schedules.html
func (*Bot) GetChannelThreads ¶
GetChannelThreads 获取子频道下的帖子列表
https://bot.q.qq.com/wiki/develop/api/openapi/forum/get_threads_list.html
func (*Bot) GetChannelsOfGuild ¶
GetChannelsOfGuild 获取 guild_id 指定的频道下的子频道列表
https://bot.q.qq.com/wiki/develop/api/openapi/channel/get_channels.html
func (*Bot) GetGeneralWSSGatewayNoContext ¶
GetGeneralWSSGatewayNoContext 获取通用 WSS 接入点
https://bot.q.qq.com/wiki/develop/api/openapi/wss/url_get.html
func (*Bot) GetGuildByID ¶
GetGuildByID 获取 guild_id 指定的频道的详情
https://bot.q.qq.com/wiki/develop/api/openapi/guild/get_guild.html
func (*Bot) GetGuildMemberOf ¶
GetGuildMemberOf 获取 guild_id 指定的频道中 user_id 对应成员的详细信息
https://bot.q.qq.com/wiki/develop/api/openapi/member/get_member.html
func (*Bot) GetGuildMembersIn ¶
GetGuildMembersIn 获取 guild_id 指定的频道中所有成员的详情列表,支持分页
https://bot.q.qq.com/wiki/develop/api/openapi/member/get_members.html
func (*Bot) GetGuildMessageSetting ¶
func (bot *Bot) GetGuildMessageSetting(id string) (*MessageSetting, error)
GetGuildMessageSetting 获取机器人在频道 guild_id 内的消息频率设置
https://bot.q.qq.com/wiki/develop/api/openapi/setting/message_setting.html
func (*Bot) GetGuildRoleListIn ¶
func (bot *Bot) GetGuildRoleListIn(id string) (*GuildRoleList, error)
GetGuildRoleListIn 获取 guild_id 指定的频道下的身份组列表
https://bot.q.qq.com/wiki/develop/api/openapi/guild/get_guild_roles.html
func (*Bot) GetMessageFromChannel ¶
GetMessageFromChannel 获取子频道 channel_id 下的消息 message_id 的详情
https://bot.q.qq.com/wiki/develop/api/openapi/message/get_message_of_id.html
func (*Bot) GetMessageReactionUsers ¶
func (bot *Bot) GetMessageReactionUsers(channelid, messageid string, emoji Emoji, cookie string, limit int) (*MessageReactionUsers, error)
GetMessageReactionUsers 拉取对消息 message_id 指定表情表态的用户列表
https://bot.q.qq.com/wiki/develop/api/openapi/reaction/get_reaction_users.html
func (*Bot) GetMyGuilds ¶
GetMyGuilds 获取当前用户(机器人)频道列表,支持分页
https://bot.q.qq.com/wiki/develop/api/openapi/user/guilds.html
func (*Bot) GetOnlineNumsInChannel ¶
GetOnlineNumsInChannel 查询音视频/直播子频道 channel_id 的在线成员数
https://bot.q.qq.com/wiki/develop/api/openapi/channel/get_online_nums.html
func (*Bot) GetOpenAPI ¶
GetOpenAPI 从 ep 获取 json 结构化数据写到 ptr, ptr 除 Slice 外必须在开头继承 CodeMessageBase
func (*Bot) GetOpenAPIWithBody ¶
GetOpenAPIWithBody 不规范地从 ep 获取 json 结构化数据写到 ptr, ptr 除 Slice 外必须在开头继承 CodeMessageBase
func (*Bot) GetPinMessagesOfChannel ¶
func (bot *Bot) GetPinMessagesOfChannel(id string) (*PinsMessage, error)
GetPinMessagesOfChannel 获取子频道 channel_id 内的精华消息
https://bot.q.qq.com/wiki/develop/api/openapi/pins/get_pins_message.html
func (*Bot) GetRoleMembersOf ¶
func (bot *Bot) GetRoleMembersOf(guildid, roleid, startindex string, limit uint32) (*RoleMembers, error)
GetRoleMembersOf 获取 guild_id 频道中指定role_id身份组下所有成员的详情列表,支持分页
https://bot.q.qq.com/wiki/develop/api/openapi/member/get_role_members.html
func (*Bot) GetScheduleInChannel ¶
GetScheduleInChannel 获取日程子频道 channel_id 下 schedule_id 指定的的日程的详情
https://bot.q.qq.com/wiki/develop/api/openapi/schedule/get_schedule.html
func (*Bot) GetShardWSSGatewayNoContext ¶
func (bot *Bot) GetShardWSSGatewayNoContext() (*ShardWSSGateway, error)
GetShardWSSGatewayNoContext 获取带分片 WSS 接入点
https://bot.q.qq.com/wiki/develop/api/openapi/wss/shard_url_get.html
func (*Bot) GetThreadInfo ¶
func (bot *Bot) GetThreadInfo(channelid, threadid string) (*ThreadInfo, error)
GetThreadInfo 获取子频道下的帖子详情
https://bot.q.qq.com/wiki/develop/api/openapi/forum/get_thread.html
func (*Bot) GiveMessageReaction ¶
GiveMessageReaction 对消息 message_id 进行表情表态
https://bot.q.qq.com/wiki/develop/api/openapi/reaction/put_message_reaction.html
func (*Bot) OpenMicInChannel ¶
OpenMic 机器人在 channel_id 对应的语音子频道上麦
https://bot.q.qq.com/wiki/develop/api/openapi/audio/put_mic.html
func (*Bot) PatchChannelOf ¶
func (bot *Bot) PatchChannelOf(id string, config *ChannelPatch) (*Channel, error)
PatchChannelOf 修改 channel_id 指定的子频道的信息
https://bot.q.qq.com/wiki/develop/api/openapi/channel/patch_channel.html
func (*Bot) PatchGuildRoleOf ¶
func (bot *Bot) PatchGuildRoleOf(guildid, roleid string, name string, color uint32, hoist int32) (*GuildRolePatch, error)
PatchGuildRoleOf 修改频道 guild_id 下 role_id 指定的身份组
https://bot.q.qq.com/wiki/develop/api/openapi/guild/patch_guild_role.html
func (*Bot) PatchOpenAPI ¶
PatchOpenAPI 从 ep 得到 json 结构化数据返回值写到 ptr, ptr 除 Slice 外必须在开头继承 CodeMessageBase
func (*Bot) PatchScheduleInChannel ¶
func (bot *Bot) PatchScheduleInChannel(channelid string, scheduleid string, schedule *Schedule) error
PatchScheduleInChannel 修改日程子频道 channel_id 下 schedule_id 指定的日程的详情
https://bot.q.qq.com/wiki/develop/api/openapi/schedule/patch_schedule.html
schedule 会被写入返回的对象
func (*Bot) PinMessageInChannel ¶
func (bot *Bot) PinMessageInChannel(channelid, messageid string) (*PinsMessage, error)
PinMessageInChannel 添加子频道 channel_id 内的精华消息
https://bot.q.qq.com/wiki/develop/api/openapi/pins/put_pins_message.html
func (*Bot) PostAnnounceInGuild ¶
PostAnnounceInGuild 创建频道全局公告,公告类型分为 消息类型的频道公告 和 推荐子频道类型的频道公告
https://bot.q.qq.com/wiki/develop/api/openapi/announces/post_guild_announces.html
会重写 content 为返回值
func (*Bot) PostFileToQQGroup ¶
PostFileToQQGroup 发送文件到 QQ 群的 openid
func (*Bot) PostFileToQQUser ¶
PostFileToQQUser 发送文件到 QQ 用户的 openid
func (*Bot) PostMessageToChannel ¶
func (bot *Bot) PostMessageToChannel(id string, content *MessagePost) (*Message, error)
PostMessageToChannel 向 channel_id 指定的子频道发送消息
https://bot.q.qq.com/wiki/develop/api/openapi/message/post_messages.html
func (*Bot) PostMessageToQQGroup ¶
func (bot *Bot) PostMessageToQQGroup(id string, content *MessagePost) (*Message, error)
PostMessageToQQGroup 向 openid 指定的群发送消息
func (*Bot) PostMessageToQQUser ¶
func (bot *Bot) PostMessageToQQUser(id string, content *MessagePost) (*Message, error)
PostMessageToQQUser 向 openid 指定的用户发送消息
func (*Bot) PostMessageToUser ¶
func (bot *Bot) PostMessageToUser(id string, content *MessagePost) (*Message, error)
PostMessageToUser 发送私信消息,前提是已经创建了私信会话
https://bot.q.qq.com/wiki/develop/api/openapi/dms/post_dms_messages.html
- 私信的 guild_id 在创建私信会话时以及私信消息事件中获取
func (*Bot) PostOpenAPI ¶
PostOpenAPI 从 ep 得到 json 结构化数据返回值写到 ptr, ptr 除 Slice 外必须在开头继承 CodeMessageBase
func (*Bot) PostThreadInChannel ¶
func (bot *Bot) PostThreadInChannel(id string, title string, content string, format uint32) (taskid string, createtime string, err error)
PostThread 发表帖子
https://bot.q.qq.com/wiki/develop/api/openapi/forum/put_thread.html
func (*Bot) PutOpenAPI ¶
PutOpenAPI 向 ep 发送 PUT 并获取 json 结构化数据返回写到 ptr, ptr 除 Slice 外必须在开头继承 CodeMessageBase
func (*Bot) RemoveRoleFromMemberOfGuild ¶
RemoveRoleFromMemberOfGuild 将用户 user_id 从 频道 guild_id 的 role_id 身份组中移除
https://bot.q.qq.com/wiki/develop/api/openapi/guild/delete_guild_member_role.html
func (*Bot) Resume ¶
Resume 恢复连接
https://bot.q.qq.com/wiki/develop/api/gateway/reference.html#_4-%E6%81%A2%E5%A4%8D%E8%BF%9E%E6%8E%A5
func (*Bot) SendPayload ¶
func (bot *Bot) SendPayload(wp *WebsocketPayload) error
SendPayload 发送 ws 包
func (*Bot) SetAllMuteInGuild ¶
SetAllMuteInGuild 禁言全员 / 解除全员禁言
https://bot.q.qq.com/wiki/develop/api/openapi/guild/patch_guild_mute.html
func (*Bot) SetChannelPermissionsOfRole ¶
SetChannelPermissionsOfRole 修改子频道 channel_id 下身份组 role_id 的权限
https://bot.q.qq.com/wiki/develop/api/openapi/channel_permissions/put_channel_roles_permissions.html
func (*Bot) SetChannelPermissionsOfUser ¶
SetChannelPermissionsOfUser 修改子频道 channel_id 下用户 user_id 的权限
https://bot.q.qq.com/wiki/develop/api/openapi/channel_permissions/put_channel_permissions.html
func (*Bot) SetUserMuteInGuild ¶
func (bot *Bot) SetUserMuteInGuild(guildid, userid string, endtimestamp string, seconds string) error
SetUserMuteInGuild 禁言 / 解除禁言频道 guild_id 下的成员 user_id
https://bot.q.qq.com/wiki/develop/api/openapi/guild/patch_guild_mute.html
func (*Bot) SetUsersMuteInGuild ¶
func (bot *Bot) SetUsersMuteInGuild(guildid string, endtimestamp string, seconds string, userids ...string) ([]string, error)
SetUsersMuteInGuild 批量禁言 / 解除禁言频道 guild_id 下的成员 user_id
https://bot.q.qq.com/wiki/develop/api/openapi/guild/patch_guild_mute.html
func (*Bot) UnpinMessageInChannel ¶
UnpinMessageInChannel 子频道 channel_id 下指定 message_id 的精华消息
https://bot.q.qq.com/wiki/develop/api/openapi/pins/delete_pins_message.html
删除子频道内全部精华消息,请将 message_id 设置为 all
type Channel ¶
type Channel struct { ID string `json:"id"` GuildID string `json:"guild_id"` Name string `json:"name"` Type ChannelType `json:"type"` SubType ChannelSubType `json:"sub_type"` Position int `json:"position"` ParentID string `json:"parent_id"` OwnerID string `json:"owner_id"` PrivateType PrivateType `json:"private_type"` SpeakPermission SpeakPermission `json:"speak_permission"` ApplicationID string `json:"application_id"` // ApplicationID see https://bot.q.qq.com/wiki/develop/api/openapi/channel/model.html#%E5%BA%94%E7%94%A8%E5%AD%90%E9%A2%91%E9%81%93%E7%9A%84%E5%BA%94%E7%94%A8%E7%B1%BB%E5%9E%8B Permissions string `json:"permissions"` OpUserID string `json:"op_user_id"` // https://bot.q.qq.com/wiki/develop/api/gateway/channel.html#%E5%86%85%E5%AE%B9 }
Channel 子频道对象
https://bot.q.qq.com/wiki/develop/api/openapi/channel/model.html
type ChannelPatch ¶
type ChannelPatch struct { Name string `json:"name,omitempty"` Position int `json:"position,omitempty"` ParentID *string `json:"parent_id,omitempty"` PrivateType *PrivateType `json:"private_type,omitempty"` SpeakPermission *SpeakPermission `json:"speak_permission,omitempty"` }
ChannelPatch 子频道 patch 操作所用对象
https://bot.q.qq.com/wiki/develop/api/openapi/channel/patch_channel.html
type ChannelPermissions ¶
type ChannelPermissions struct { ChannelID string `json:"channel_id"` UserID string `json:"user_id"` // UserID 不与 RoleID 同时出现 RoleID string `json:"role_id"` // RoleID 不与 UserID 同时出现 Permissions string `json:"permissions"` }
ChannelPermissions 子频道权限对象
https://bot.q.qq.com/wiki/develop/api/openapi/channel_permissions/model.html
type ChannelPost ¶
type ChannelPost struct { Name string `json:"name"` Type ChannelType `json:"type"` SubType ChannelSubType `json:"sub_type"` Position int `json:"position"` ParentID string `json:"parent_id"` OwnerID string `json:"owner_id,omitempty"` PrivateType PrivateType `json:"private_type"` PrivateUserIDs []string `json:"private_user_ids,omitempty"` SpeakPermission SpeakPermission `json:"speak_permission,omitempty"` ApplicationID string `json:"application_id,omitempty"` }
ChannelPost 子频道 post 操作所用对象
https://bot.q.qq.com/wiki/develop/api/openapi/channel/post_channels.html
type ChannelSubType ¶
type ChannelSubType int
ChannelSubType https://bot.q.qq.com/wiki/develop/api/openapi/channel/model.html#channelsubtype
const ( ChannelSubTypeChat ChannelSubType = iota // 闲聊 ChannelSubTypeAnnounce // 公告 ChannelSubTypeKouryaku // 攻略 ChannelSubTypeGame // 开黑 )
type ChannelType ¶
type ChannelType int
ChannelType https://bot.q.qq.com/wiki/develop/api/openapi/channel/model.html#channeltype
type CodeMessageBase ¶
CodeMessageBase 各种消息都有的 code + message 基类
type Ctx ¶
type Ctx struct { Event State Message *Message IsToMe bool IsQQ bool // contains filtered or unexported fields }
func (*Ctx) AddRoleToMemberOfGuild ¶
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) CloseMicInChannel ¶
CloseMicInChannel 机器人在 channel_id 对应的语音子频道下麦
https://bot.q.qq.com/wiki/develop/api/openapi/audio/delete_mic.html
func (*Ctx) ControlAudioInChannel ¶
func (ctx *Ctx) ControlAudioInChannel(id string, control *AudioControl) error
ControlAudioInChannel 控制子频道 channel_id 下的音频
https://bot.q.qq.com/wiki/develop/api/openapi/audio/audio_control.html
func (*Ctx) CreateChannelInGuild ¶
func (ctx *Ctx) CreateChannelInGuild(id string, config *ChannelPost) (*Channel, error)
CreateChannelInGuild 用于在 guild_id 指定的频道下创建一个子频道
https://bot.q.qq.com/wiki/develop/api/openapi/channel/post_channels.html
func (*Ctx) CreateGuildRoleOf ¶
func (ctx *Ctx) CreateGuildRoleOf(id string, name string, color uint32, hoist int32) (*GuildRoleCreate, error)
CreateGuildRoleOf 创建频道身份组
https://bot.q.qq.com/wiki/develop/api/openapi/guild/post_guild_role.html
参数为非必填,但至少需要传其中之一,默认为空或 0
func (*Ctx) CreatePrivateChat ¶
CreatePrivateChat 机器人和在同一个频道内的成员创建私信会话
https://bot.q.qq.com/wiki/develop/api/openapi/dms/post_dms.html
func (*Ctx) CreateScheduleInChannel ¶
CreateScheduleInChannel 在 channel_id 指定的日程子频道下创建一个日程
https://bot.q.qq.com/wiki/develop/api/openapi/schedule/post_schedule.html
schedule 会被写入返回的对象
func (*Ctx) DeleteAnnounceInGuild ¶
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) DeleteChannelOf ¶
DeleteChannelOf 删除 channel_id 指定的子频道
https://bot.q.qq.com/wiki/develop/api/openapi/channel/delete_channel.html
func (*Ctx) DeleteGuildMemberOf ¶
func (ctx *Ctx) DeleteGuildMemberOf(guildid, userid string, addblklst bool, delhistmsgdays int) error
DeleteGuildMemberOf 删除 guild_id 指定的频道下的成员 user_id
https://bot.q.qq.com/wiki/develop/api/openapi/member/delete_member.html
- delhistmsgdays: 消息撤回时间范围仅支持固定的天数:3,7,15,30。 特殊的时间范围:-1: 撤回全部消息。默认值为0不撤回任何消息。
func (*Ctx) DeleteGuildRoleOf ¶
DeleteGuildRoleOf 删除频道 guild_id下 role_id 对应的身份组
https://bot.q.qq.com/wiki/develop/api/openapi/guild/delete_guild_role.html
func (*Ctx) DeleteMessageInChannel ¶
DeleteMessageInChannel 回子频道 channel_id 下的消息 message_id
https://bot.q.qq.com/wiki/develop/api/openapi/message/delete_message.html
func (*Ctx) DeleteMessageOfUser ¶
DeleteMessageOfUser 撤回私信频道 guild_id 中 message_id 指定的私信消息, 只能用于撤回机器人自己发送的私信
https://bot.q.qq.com/wiki/develop/api/openapi/dms/delete_dms.html
func (*Ctx) DeleteMessageReaction ¶
DeleteMessageReaction 删除自己对消息 message_id 的表情表态
https://bot.q.qq.com/wiki/develop/api/openapi/reaction/delete_own_message_reaction.html
func (*Ctx) DeleteScheduleInChannel ¶
DeleteScheduleInChannel 删除日程子频道 channel_id 下 schedule_id 指定的日程
https://bot.q.qq.com/wiki/develop/api/openapi/schedule/delete_schedule.html
func (*Ctx) DeleteThreadInChannel ¶
DeleteThreadInChannel 删除指定子频道下的某个帖子
https://bot.q.qq.com/wiki/develop/api/openapi/forum/delete_thread.html
func (*Ctx) FutureEvent ¶
func (ctx *Ctx) FutureEvent(Type string, rule ...Rule) *FutureEvent
FutureEvent ...
func (*Ctx) GetChannelByID ¶
GetChannelByID 用于获取 channel_id 指定的子频道的详情
https://bot.q.qq.com/wiki/develop/api/openapi/channel/get_channel.html
func (*Ctx) GetChannelPermissionsOfRole ¶
func (ctx *Ctx) GetChannelPermissionsOfRole(channelid, roleid string) (*ChannelPermissions, error)
GetChannelPermissionsOfRole 获取子频道 channel_id 下身份组 role_id 的权限
https://bot.q.qq.com/wiki/develop/api/openapi/channel_permissions/get_channel_roles_permissions.html
func (*Ctx) GetChannelPermissionsOfUser ¶
func (ctx *Ctx) GetChannelPermissionsOfUser(channelid, userid string) (*ChannelPermissions, error)
GetChannelPermissionsOfUser 获取子频道 channel_id 下用户 user_id 的权限
https://bot.q.qq.com/wiki/develop/api/openapi/channel_permissions/get_channel_permissions.html
func (*Ctx) GetChannelSchedules ¶
GetChannelSchedules 获取channel_id指定的子频道中当天的日程列表
https://bot.q.qq.com/wiki/develop/api/openapi/schedule/get_schedules.html
func (*Ctx) GetChannelThreads ¶
GetChannelThreads 获取子频道下的帖子列表
https://bot.q.qq.com/wiki/develop/api/openapi/forum/get_threads_list.html
func (*Ctx) GetChannelsOfGuild ¶
GetChannelsOfGuild 获取 guild_id 指定的频道下的子频道列表
https://bot.q.qq.com/wiki/develop/api/openapi/channel/get_channels.html
func (*Ctx) GetGuildByID ¶
GetGuildByID 获取 guild_id 指定的频道的详情
https://bot.q.qq.com/wiki/develop/api/openapi/guild/get_guild.html
func (*Ctx) GetGuildMemberOf ¶
GetGuildMemberOf 获取 guild_id 指定的频道中 user_id 对应成员的详细信息
https://bot.q.qq.com/wiki/develop/api/openapi/member/get_member.html
func (*Ctx) GetGuildMembersIn ¶
GetGuildMembersIn 获取 guild_id 指定的频道中所有成员的详情列表,支持分页
https://bot.q.qq.com/wiki/develop/api/openapi/member/get_members.html
func (*Ctx) GetGuildMessageSetting ¶
func (ctx *Ctx) GetGuildMessageSetting(id string) (*MessageSetting, error)
GetGuildMessageSetting 获取机器人在频道 guild_id 内的消息频率设置
https://bot.q.qq.com/wiki/develop/api/openapi/setting/message_setting.html
func (*Ctx) GetGuildRoleListIn ¶
func (ctx *Ctx) GetGuildRoleListIn(id string) (*GuildRoleList, error)
GetGuildRoleListIn 获取 guild_id 指定的频道下的身份组列表
https://bot.q.qq.com/wiki/develop/api/openapi/guild/get_guild_roles.html
func (*Ctx) GetMessageFromChannel ¶
GetMessageFromChannel 获取子频道 channel_id 下的消息 message_id 的详情
https://bot.q.qq.com/wiki/develop/api/openapi/message/get_message_of_id.html
func (*Ctx) GetMessageReactionUsers ¶
func (ctx *Ctx) GetMessageReactionUsers(channelid, messageid string, emoji Emoji, cookie string, limit int) (*MessageReactionUsers, error)
GetMessageReactionUsers 拉取对消息 message_id 指定表情表态的用户列表
https://bot.q.qq.com/wiki/develop/api/openapi/reaction/get_reaction_users.html
func (*Ctx) GetMyGuilds ¶
GetMyGuilds 获取当前用户(机器人)频道列表,支持分页
https://bot.q.qq.com/wiki/develop/api/openapi/user/guilds.html
func (*Ctx) GetOnlineNumsInChannel ¶
GetOnlineNumsInChannel 查询音视频/直播子频道 channel_id 的在线成员数
https://bot.q.qq.com/wiki/develop/api/openapi/channel/get_online_nums.html
func (*Ctx) GetPinMessagesOfChannel ¶
func (ctx *Ctx) GetPinMessagesOfChannel(id string) (*PinsMessage, error)
GetPinMessagesOfChannel 获取子频道 channel_id 内的精华消息
https://bot.q.qq.com/wiki/develop/api/openapi/pins/get_pins_message.html
func (*Ctx) GetRoleMembersOf ¶
func (ctx *Ctx) GetRoleMembersOf(guildid, roleid, startindex string, limit uint32) (*RoleMembers, error)
GetRoleMembersOf 获取 guild_id 频道中指定role_id身份组下所有成员的详情列表,支持分页
https://bot.q.qq.com/wiki/develop/api/openapi/member/get_role_members.html
func (*Ctx) GetScheduleInChannel ¶
GetScheduleInChannel 获取日程子频道 channel_id 下 schedule_id 指定的的日程的详情
https://bot.q.qq.com/wiki/develop/api/openapi/schedule/get_schedule.html
func (*Ctx) GetThreadInfo ¶
func (ctx *Ctx) GetThreadInfo(channelid, threadid string) (*ThreadInfo, error)
GetThreadInfo 获取子频道下的帖子详情
https://bot.q.qq.com/wiki/develop/api/openapi/forum/get_thread.html
func (*Ctx) GiveMessageReaction ¶
GiveMessageReaction 对消息 message_id 进行表情表态
https://bot.q.qq.com/wiki/develop/api/openapi/reaction/put_message_reaction.html
func (*Ctx) OpenMicInChannel ¶
OpenMic 机器人在 channel_id 对应的语音子频道上麦
https://bot.q.qq.com/wiki/develop/api/openapi/audio/put_mic.html
func (*Ctx) PatchChannelOf ¶
func (ctx *Ctx) PatchChannelOf(id string, config *ChannelPatch) (*Channel, error)
PatchChannelOf 修改 channel_id 指定的子频道的信息
https://bot.q.qq.com/wiki/develop/api/openapi/channel/patch_channel.html
func (*Ctx) PatchGuildRoleOf ¶
func (ctx *Ctx) PatchGuildRoleOf(guildid, roleid string, name string, color uint32, hoist int32) (*GuildRolePatch, error)
PatchGuildRoleOf 修改频道 guild_id 下 role_id 指定的身份组
https://bot.q.qq.com/wiki/develop/api/openapi/guild/patch_guild_role.html
func (*Ctx) PatchScheduleInChannel ¶
func (ctx *Ctx) PatchScheduleInChannel(channelid string, scheduleid string, schedule *Schedule) error
PatchScheduleInChannel 修改日程子频道 channel_id 下 schedule_id 指定的日程的详情
https://bot.q.qq.com/wiki/develop/api/openapi/schedule/patch_schedule.html
schedule 会被写入返回的对象
func (*Ctx) PinMessageInChannel ¶
func (ctx *Ctx) PinMessageInChannel(channelid, messageid string) (*PinsMessage, error)
PinMessageInChannel 添加子频道 channel_id 内的精华消息
https://bot.q.qq.com/wiki/develop/api/openapi/pins/put_pins_message.html
func (*Ctx) Post ¶
func (ctx *Ctx) Post(replytosender bool, post *MessagePost) (reply *Message, err error)
Post 发送消息到对方
func (*Ctx) PostAnnounceInGuild ¶
PostAnnounceInGuild 创建频道全局公告,公告类型分为 消息类型的频道公告 和 推荐子频道类型的频道公告
https://bot.q.qq.com/wiki/develop/api/openapi/announces/post_guild_announces.html
会重写 content 为返回值
func (*Ctx) PostFileToQQGroup ¶
PostFileToQQGroup 发送文件到 QQ 群的 openid
func (*Ctx) PostFileToQQUser ¶
PostFileToQQUser 发送文件到 QQ 用户的 openid
func (*Ctx) PostMessageToChannel ¶
func (ctx *Ctx) PostMessageToChannel(id string, content *MessagePost) (*Message, error)
PostMessageToChannel 向 channel_id 指定的子频道发送消息
https://bot.q.qq.com/wiki/develop/api/openapi/message/post_messages.html
func (*Ctx) PostMessageToQQGroup ¶
func (ctx *Ctx) PostMessageToQQGroup(id string, content *MessagePost) (*Message, error)
PostMessageToQQGroup 向 openid 指定的群发送消息
func (*Ctx) PostMessageToQQUser ¶
func (ctx *Ctx) PostMessageToQQUser(id string, content *MessagePost) (*Message, error)
PostMessageToQQUser 向 openid 指定的用户发送消息
func (*Ctx) PostMessageToUser ¶
func (ctx *Ctx) PostMessageToUser(id string, content *MessagePost) (*Message, error)
PostMessageToUser 发送私信消息,前提是已经创建了私信会话
https://bot.q.qq.com/wiki/develop/api/openapi/dms/post_dms_messages.html
- 私信的 guild_id 在创建私信会话时以及私信消息事件中获取
func (*Ctx) PostThreadInChannel ¶
func (ctx *Ctx) PostThreadInChannel(id string, title string, content string, format uint32) (taskid string, createtime string, err error)
PostThread 发表帖子
https://bot.q.qq.com/wiki/develop/api/openapi/forum/put_thread.html
func (*Ctx) RemoveRoleFromMemberOfGuild ¶
RemoveRoleFromMemberOfGuild 将用户 user_id 从 频道 guild_id 的 role_id 身份组中移除
https://bot.q.qq.com/wiki/develop/api/openapi/guild/delete_guild_member_role.html
func (*Ctx) SendChain ¶
func (ctx *Ctx) SendChain(message ...MessageSegment) (m []*Message, err error)
SendChain 链式发送
func (*Ctx) SendImage ¶
func (ctx *Ctx) SendImage(file string, replytosender bool, caption ...any) (reply *Message, err error)
SendImage 发送带图片消息到对方
func (*Ctx) SendImageBytes ¶
SendImageBytes 发送带图片消息到对方
func (*Ctx) SendPlainMessage ¶
SendPlainMessage 发送纯文本消息到对方
func (*Ctx) SetAllMuteInGuild ¶
SetAllMuteInGuild 禁言全员 / 解除全员禁言
https://bot.q.qq.com/wiki/develop/api/openapi/guild/patch_guild_mute.html
func (*Ctx) SetChannelPermissionsOfRole ¶
SetChannelPermissionsOfRole 修改子频道 channel_id 下身份组 role_id 的权限
https://bot.q.qq.com/wiki/develop/api/openapi/channel_permissions/put_channel_roles_permissions.html
func (*Ctx) SetChannelPermissionsOfUser ¶
SetChannelPermissionsOfUser 修改子频道 channel_id 下用户 user_id 的权限
https://bot.q.qq.com/wiki/develop/api/openapi/channel_permissions/put_channel_permissions.html
func (*Ctx) SetUserMuteInGuild ¶
func (ctx *Ctx) SetUserMuteInGuild(guildid, userid string, endtimestamp string, seconds string) error
SetUserMuteInGuild 禁言 / 解除禁言频道 guild_id 下的成员 user_id
https://bot.q.qq.com/wiki/develop/api/openapi/guild/patch_guild_mute.html
func (*Ctx) SetUsersMuteInGuild ¶
func (ctx *Ctx) SetUsersMuteInGuild(guildid string, endtimestamp string, seconds string, userids ...string) ([]string, error)
SetUsersMuteInGuild 批量禁言 / 解除禁言频道 guild_id 下的成员 user_id
https://bot.q.qq.com/wiki/develop/api/openapi/guild/patch_guild_mute.html
func (*Ctx) UnpinMessageInChannel ¶
UnpinMessageInChannel 子频道 channel_id 下指定 message_id 的精华消息
https://bot.q.qq.com/wiki/develop/api/openapi/pins/delete_pins_message.html
删除子频道内全部精华消息,请将 message_id 设置为 all
type DMS ¶
type DMS struct { GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` CreateTime string `json:"create_time"` // 创建私信会话时间戳 }
DMS 私信会话对象
https://bot.q.qq.com/wiki/develop/api/openapi/dms/model.html
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is the pre_handler, mid_handler, post_handler manager
func (*Engine) ApplySingle ¶
ApplySingle 应用反并发
func (*Engine) GetLazyData ¶
下载并获取本 engine 文件夹下的懒加载数据
func (*Engine) OnAudioFinish ¶
OnAudioFinish ...
func (*Engine) OnAudioOffMic ¶
OnAudioOffMic ...
func (*Engine) OnAudioOnMic ¶
OnAudioOnMic ...
func (*Engine) OnAudioOrLiveChannelMemberEnter ¶
OnAudioOrLiveChannelMemberEnter ...
func (*Engine) OnAudioOrLiveChannelMemberExit ¶
OnAudioOrLiveChannelMemberExit ...
func (*Engine) OnAudioStart ¶
OnAudioStart ...
func (*Engine) OnChannelCreate ¶
OnChannelCreate ...
func (*Engine) OnChannelDelete ¶
OnChannelDelete ...
func (*Engine) OnChannelUpdate ¶
OnChannelUpdate ...
func (*Engine) OnForumPostCreate ¶
OnForumPostCreate ...
func (*Engine) OnForumPostDelete ¶
OnForumPostDelete ...
func (*Engine) OnForumPublishAuditResult ¶
OnForumPublishAuditResult ...
func (*Engine) OnForumReplyCreate ¶
OnForumReplyCreate ...
func (*Engine) OnForumReplyDelete ¶
OnForumReplyDelete ...
func (*Engine) OnForumThreadCreate ¶
OnForumThreadCreate ...
func (*Engine) OnForumThreadDelete ¶
OnForumThreadDelete ...
func (*Engine) OnForumThreadUpdate ¶
OnForumThreadUpdate ...
func (*Engine) OnGuildCreate ¶
OnGuildCreate ...
func (*Engine) OnGuildDelete ¶
OnGuildDelete ...
func (*Engine) OnGuildMemberAdd ¶
OnGuildMemberAdd ...
func (*Engine) OnGuildMemberRemove ¶
OnGuildMemberRemove ...
func (*Engine) OnGuildMemberUpdate ¶
OnGuildMemberUpdate ...
func (*Engine) OnGuildUpdate ¶
OnGuildUpdate ...
func (*Engine) OnMessageAuditPass ¶
OnMessageAuditPass ...
func (*Engine) OnMessageAuditReject ¶
OnMessageAuditReject ...
func (*Engine) OnMessageCommand ¶
OnMessageCommand ...
func (*Engine) OnMessageCommandGroup ¶
OnMessageCommandGroup ...
func (*Engine) OnMessageDelete ¶
OnMessageDelete ...
func (*Engine) OnMessageFullMatch ¶
OnMessageFullMatch ...
func (*Engine) OnMessageFullMatchGroup ¶
OnMessageFullMatchGroup ...
func (*Engine) OnMessageKeyword ¶
OnMessageKeyword ...
func (*Engine) OnMessageKeywordGroup ¶
OnMessageKeywordGroup ...
func (*Engine) OnMessagePrefix ¶
OnMessagePrefix ...
func (*Engine) OnMessagePrefixGroup ¶
OnMessagePrefixGroup ...
func (*Engine) OnMessageReactionAdd ¶
OnMessageReactionAdd ...
func (*Engine) OnMessageReactionRemove ¶
OnMessageReactionRemove ...
func (*Engine) OnMessageRegex ¶
OnMessageRegex ...
func (*Engine) OnMessageShell ¶
OnMessageShell shell命令触发器
func (*Engine) OnMessageSuffix ¶
OnMessageSuffix ...
func (*Engine) OnMessageSuffixGroup ¶
OnMessageSuffixGroup ...
func (*Engine) OnOpenForumPostCreate ¶
OnOpenForumPostCreate ...
func (*Engine) OnOpenForumPostDelete ¶
OnOpenForumPostDelete ...
func (*Engine) OnOpenForumReplyCreate ¶
OnOpenForumReplyCreate ...
func (*Engine) OnOpenForumReplyDelete ¶
OnOpenForumReplyDelete ...
func (*Engine) OnOpenForumThreadCreate ¶
OnOpenForumThreadCreate ...
func (*Engine) OnOpenForumThreadDelete ¶
OnOpenForumThreadDelete ...
func (*Engine) OnOpenForumThreadUpdate ¶
OnOpenForumThreadUpdate ...
func (*Engine) UseMidHandler ¶
UseMidHandler 向该 Engine 添加新 MidHandler(Rule), 会在 Rule 判断后, Matcher 触发前触发,如果 midHandler 没有通过,则 Matcher 不会触发
可用于速率限制等
func (*Engine) UsePostHandler ¶
UsePostHandler 向该 Engine 添加新 PostHandler(Rule), 会在 Matcher 触发后触发,如果 PostHandler 返回 false, 则后续的 post handler 不会触发
可用于速率限制等
func (*Engine) UsePreHandler ¶
UsePreHandler 向该 Engine 添加新 PreHandler(Rule), 会在 Rule 判断前触发,如果 preHandler 没有通过,则 Rule, Matcher 不会触发
可用于分群组管理插件等
type Event ¶
type Event struct { // Type is payload.T Type string // Seq 序列号 Seq uint32 // Value 是 D Value any // contains filtered or unexported fields }
Event ...
type EventReady ¶
type EventReady struct { Version int `json:"version"` SessionID string `json:"session_id"` User *User `json:"user"` Shard [2]byte `json:"shard"` }
EventReady https://bot.q.qq.com/wiki/develop/api/gateway/reference.html#_2-%E9%89%B4%E6%9D%83%E8%BF%9E%E6%8E%A5
type FilePost ¶
type FilePost struct { Type FileType `json:"file_type"` URL string `json:"url"` IsPositive bool `json:"srv_send_msg"` // IsPositive }
FilePost QQ 富媒体消息发送请求参数
https://bot.q.qq.com/wiki/develop/api-231017/server-inter/message/send-receive/rich-text-media.html
type FutureEvent ¶
FutureEvent 是 ZeroBot 交互式的核心,用于异步获取指定事件
func NewFutureEvent ¶
func NewFutureEvent(Type string, Priority int, Block bool, rule ...Rule) *FutureEvent
NewFutureEvent 创建一个FutureEvent, 并返回其指针
func (*FutureEvent) Next ¶
func (n *FutureEvent) Next() <-chan *Ctx
Next 返回一个 chan 用于接收下一个指定事件
该 chan 必须接收,如需手动取消监听,请使用 Repeat 方法
func (*FutureEvent) Repeat ¶
func (n *FutureEvent) Repeat() (recv <-chan *Ctx, cancel func())
Repeat 返回一个 chan 用于接收无穷个指定事件,和一个取消监听的函数
如果没有取消监听,将不断监听指定事件
func (*FutureEvent) Take ¶
func (n *FutureEvent) Take(num int) <-chan *Ctx
Take 基于 Repeat 封装,返回一个 chan 接收指定数量的事件
该 chan 对象必须接收,否则将有 goroutine 泄漏,如需手动取消请使用 Repeat
type Guild ¶
type Guild struct { ID string `json:"id"` Name string `json:"name"` Icon string `json:"icon"` OwnerID string `json:"owner_id"` Owner bool `json:"owner"` JoinedAt time.Time `json:"joined_at"` MemberCount int `json:"member_count"` MaxMembers int `json:"max_members"` Description string `json:"description"` OpUserID string `json:"op_user_id"` // https://bot.q.qq.com/wiki/develop/api/gateway/guild.html#%E4%BA%8B%E4%BB%B6%E5%86%85%E5%AE%B9 }
Guild 频道对象
https://bot.q.qq.com/wiki/develop/api/openapi/guild/model.html
type GuildRoleChannelID ¶
type GuildRoleChannelID struct { Channel struct { ID string `json:"id"` } `json:"channel"` }
GuildRoleChannelID 频道身份组成员返回 只填充了子频道 id 字段的对象
https://bot.q.qq.com/wiki/develop/api/openapi/guild/put_guild_member_role.html#%E5%8F%82%E6%95%B0
type GuildRoleCreate ¶
GuildRoleCreate 创建频道身份组响应
https://bot.q.qq.com/wiki/develop/api/openapi/guild/post_guild_role.html#%E8%BF%94%E5%9B%9E
type GuildRoleList ¶
type GuildRoleList struct { GuildID string `json:"guild_id"` Roles []Role `json:"roles"` RoleNumLimit string `json:"role_num_limit"` }
GuildRoleList 频道身份组列表
https://bot.q.qq.com/wiki/develop/api/openapi/guild/get_guild_roles.html#%E8%BF%94%E5%9B%9E
type GuildRolePatch ¶
type GuildRolePatch struct { GuildID string `json:"guild_id"` RoleID string `json:"role_id"` Role Role `json:"role"` }
GuildRolePatch 修改频道身份组
https://bot.q.qq.com/wiki/develop/api/openapi/guild/patch_guild_role.html#%E8%BF%94%E5%9B%9E
type HTTPRequsetConstructer ¶
type HTTPRequsetConstructer func(ep string, contenttype string, auth, appid string, body io.Reader) (*http.Request, error)
HTTPRequsetConstructer ...
type Handler ¶
type Handler struct { OnGuildCreate func(s uint32, bot *Bot, d *Guild) OnGuildUpdate func(s uint32, bot *Bot, d *Guild) OnGuildDelete func(s uint32, bot *Bot, d *Guild) OnChannelCreate func(s uint32, bot *Bot, d *Channel) OnChannelUpdate func(s uint32, bot *Bot, d *Channel) OnChannelDelete func(s uint32, bot *Bot, d *Channel) OnGuildMemberAdd func(s uint32, bot *Bot, d *Member) OnGuildMemberUpdate func(s uint32, bot *Bot, d *Member) OnGuildMemberRemove func(s uint32, bot *Bot, d *Member) OnMessageCreate func(s uint32, bot *Bot, d *Message) OnMessageDelete func(s uint32, bot *Bot, d *MessageDelete) OnMessageReactionAdd func(s uint32, bot *Bot, d *MessageReaction) OnMessageReactionRemove func(s uint32, bot *Bot, d *MessageReaction) OnDirectMessageCreate func(s uint32, bot *Bot, d *Message) OnDirectMessageDelete func(s uint32, bot *Bot, d *MessageDelete) OnOpenForumThreadCreate func(s uint32, bot *Bot, d *Thread) OnOpenForumThreadUpdate func(s uint32, bot *Bot, d *Thread) OnOpenForumThreadDelete func(s uint32, bot *Bot, d *Thread) OnOpenForumPostCreate func(s uint32, bot *Bot, d *Post) OnOpenForumPostDelete func(s uint32, bot *Bot, d *Post) OnOpenForumReplyCreate func(s uint32, bot *Bot, d *Reply) OnOpenForumReplyDelete func(s uint32, bot *Bot, d *Reply) OnAudioOrLiveChannelMemberEnter func(s uint32, bot *Bot, d *AudioLiveChannelUsersChange) OnAudioOrLiveChannelMemberExit func(s uint32, bot *Bot, d *AudioLiveChannelUsersChange) OnC2cMessageCreate func(s uint32, bot *Bot, d *Message) OnGroupAtMessageCreate func(s uint32, bot *Bot, d *Message) OnGroupAddRobot func(s uint32, bot *Bot, d *QQRobotStatus) OnGroupDelRobot func(s uint32, bot *Bot, d *QQRobotStatus) OnGroupMsgReject func(s uint32, bot *Bot, d *QQRobotStatus) OnGroupMsgReceive func(s uint32, bot *Bot, d *QQRobotStatus) OnFriendAdd func(s uint32, bot *Bot, d *QQRobotStatus) OnFriendDel func(s uint32, bot *Bot, d *QQRobotStatus) OnC2cMsgReject func(s uint32, bot *Bot, d *QQRobotStatus) OnC2cMsgReceive func(s uint32, bot *Bot, d *QQRobotStatus) OnMessageAuditPass func(s uint32, bot *Bot, d *MessageAudited) OnMessageAuditReject func(s uint32, bot *Bot, d *MessageAudited) OnForumThreadCreate func(s uint32, bot *Bot, d *Thread) OnForumThreadUpdate func(s uint32, bot *Bot, d *Thread) OnForumThreadDelete func(s uint32, bot *Bot, d *Thread) OnForumPostCreate func(s uint32, bot *Bot, d *Post) OnForumPostDelete func(s uint32, bot *Bot, d *Post) OnForumReplyCreate func(s uint32, bot *Bot, d *Reply) OnForumReplyDelete func(s uint32, bot *Bot, d *Reply) OnForumPublishAuditResult func(s uint32, bot *Bot, d *AuditResult) OnAudioStart func(s uint32, bot *Bot, d *AudioAction) OnAudioFinish func(s uint32, bot *Bot, d *AudioAction) OnAudioOnMic func(s uint32, bot *Bot, d *AudioAction) OnAudioOffMic func(s uint32, bot *Bot, d *AudioAction) OnAtMessageCreate func(s uint32, bot *Bot, d *Message) OnPublicMessageDelete func(s uint32, bot *Bot, d *MessageDelete) }
Handler 事件订阅
type InlineKeyboard ¶
type InlineKeyboard struct { Rows []InlineKeyboardRow `json:"rows"` BotAppID int `json:"bot_appid"` }
InlineKeyboard 消息按钮对象
https://bot.q.qq.com/wiki/develop/api/openapi/message/message_keyboard.html
type InlineKeyboardButton ¶
type InlineKeyboardButton struct { ID string `json:"id"` RenderData InlineKeyboardButtonRenderData `json:"render_data"` Action InlineKeyboardButtonAction `json:"action"` }
InlineKeyboardButton https://bot.q.qq.com/wiki/develop/api/openapi/message/message_keyboard.html#button
type InlineKeyboardButtonAction ¶
type InlineKeyboardButtonAction struct { Type InlineKeyboardButtonActionType `json:"type"` Permission InlineKeyboardButtonActionPermission `json:"permission"` ClickLimit int `json:"click_limit"` UnsupportTips string `json:"unsupport_tips"` Data string `json:"data"` AtBotShowChannelList bool `json:"at_bot_show_channel_list"` }
InlineKeyboardButtonAction https://bot.q.qq.com/wiki/develop/api/openapi/message/message_keyboard.html#action
type InlineKeyboardButtonActionPermission ¶
type InlineKeyboardButtonActionPermission struct { Type InlineKeyboardButtonActionPermissionType `json:"type"` SpecifyRoleIDs []string `json:"specify_role_ids"` SpecifyUserIDs []string `json:"specify_user_ids"` }
InlineKeyboardButtonActionPermission https://bot.q.qq.com/wiki/develop/api/openapi/message/message_keyboard.html#permission
type InlineKeyboardButtonActionPermissionType ¶
type InlineKeyboardButtonActionPermissionType int
InlineKeyboardButtonActionPermissionType https://bot.q.qq.com/wiki/develop/api/openapi/message/message_keyboard.html#permissiontype
const ( InlineKeyboardButtonActionPermissionTypeShimeiUser InlineKeyboardButtonActionPermissionType = iota InlineKeyboardButtonActionPermissionTypeAdmin InlineKeyboardButtonActionPermissionTypeAll InlineKeyboardButtonActionPermissionTypeShimeiRole )
type InlineKeyboardButtonActionType ¶
type InlineKeyboardButtonActionType int
InlineKeyboardButtonActionType https://bot.q.qq.com/wiki/develop/api/openapi/message/message_keyboard.html#actiontype
const ( InlineKeyboardButtonActionTypeHTTP InlineKeyboardButtonActionType = iota InlineKeyboardButtonActionTypeCallback InlineKeyboardButtonActionTypeAtBot )
type InlineKeyboardButtonRenderData ¶
type InlineKeyboardButtonRenderData struct { Label string `json:"label"` VisitedLabel string `json:"visited_label"` Style InlineKeyboardButtonRenderDataStyle `json:"style"` }
InlineKeyboardButtonRenderData https://bot.q.qq.com/wiki/develop/api/openapi/message/message_keyboard.html#renderdata
type InlineKeyboardButtonRenderDataStyle ¶
type InlineKeyboardButtonRenderDataStyle int
InlineKeyboardButtonRenderDataStyle https://bot.q.qq.com/wiki/develop/api/openapi/message/message_keyboard.html#renderstyle
const ( InlineKeyboardButtonRenderDataStyleGray InlineKeyboardButtonRenderDataStyle = iota InlineKeyboardButtonRenderDataStyleBlue )
type InlineKeyboardRow ¶
type InlineKeyboardRow struct {
Buttons []InlineKeyboardButton `json:"buttons"`
}
InlineKeyboardRow https://bot.q.qq.com/wiki/develop/api/openapi/message/message_keyboard.html#inlinekeyboardrow
type Matcher ¶
type Matcher struct { // Temp 是否为临时Matcher,临时 Matcher 匹配一次后就会删除当前 Matcher Temp bool // Block 是否阻断后续 Matcher,为 true 时当前Matcher匹配成功后,后续Matcher不参与匹配 Block bool // Break 是否退出后续匹配流程, 只有 rule 返回 false 且此值为真才会退出, 且不对 mid handler 以下的 rule 生效 Break bool // Event 当前匹配到的事件 Event *Event // Type 匹配的事件类型 Type string // Rules 匹配规则 Rules []Rule // Process 处理事件的函数 Process Process // Engine 注册 Matcher 的 Engine,Engine可为一系列 Matcher 添加通用 Rule 和 其他钩子 Engine *Engine // contains filtered or unexported fields }
Matcher 是 ZeroBot 匹配和处理事件的最小单元
func OnAudioOrLiveChannelMemberEnter ¶
OnAudioOrLiveChannelMemberEnter ...
func OnAudioOrLiveChannelMemberExit ¶
OnAudioOrLiveChannelMemberExit ...
func OnForumPublishAuditResult ¶
OnForumPublishAuditResult ...
func OnMessageAuditReject ¶
OnMessageAuditReject ...
func OnMessageCommand ¶
OnMessageCommand ...
func OnMessageCommandGroup ¶
OnMessageCommandGroup ...
func OnMessageFullMatch ¶
OnMessageFullMatch ...
func OnMessageFullMatchGroup ¶
OnMessageFullMatchGroup ...
func OnMessageKeyword ¶
OnMessageKeyword ...
func OnMessageKeywordGroup ¶
OnMessageKeywordGroup ...
func OnMessagePrefix ¶
OnMessagePrefix ...
func OnMessagePrefixGroup ¶
OnMessagePrefixGroup ...
func OnMessageReactionAdd ¶
OnMessageReactionAdd ...
func OnMessageReactionRemove ¶
OnMessageReactionRemove ...
func OnMessageRegex ¶
OnMessageRegex ...
func OnMessageShell ¶
OnMessageShell shell命令触发器
func OnMessageSuffix ¶
OnMessageSuffix ...
func OnMessageSuffixGroup ¶
OnMessageSuffixGroup ...
func OnOpenForumPostCreate ¶
OnOpenForumPostCreate ...
func OnOpenForumPostDelete ¶
OnOpenForumPostDelete ...
func OnOpenForumReplyCreate ¶
OnOpenForumReplyCreate ...
func OnOpenForumReplyDelete ¶
OnOpenForumReplyDelete ...
func OnOpenForumThreadCreate ¶
OnOpenForumThreadCreate ...
func OnOpenForumThreadDelete ¶
OnOpenForumThreadDelete ...
func OnOpenForumThreadUpdate ¶
OnOpenForumThreadUpdate ...
func StoreMatcher ¶
StoreMatcher store a matcher to matcher list.
func StoreTempMatcher ¶
StoreTempMatcher store a matcher only triggered once.
func (*Matcher) FutureEvent ¶
func (m *Matcher) FutureEvent(Type string, rule ...Rule) *FutureEvent
FutureEvent 返回一个 FutureEvent 实例指针,用于获取满足 Rule 的 未来事件
type Member ¶
type Member struct { GuildID string `json:"guild_id"` // MemberWithGuildID only User *User `json:"user"` Nick string `json:"nick"` Roles []string `json:"roles"` JoinedAt time.Time `json:"joined_at"` Deaf bool `json:"deaf"` Mute bool `json:"mute"` Pending bool `json:"pending"` OpUserID string `json:"op_user_id"` // https://bot.q.qq.com/wiki/develop/api/gateway/guild_member.html#%E5%86%85%E5%AE%B9 }
Member 成员对象 Member and MemberWithGuildID
https://bot.q.qq.com/wiki/develop/api/openapi/member/model.html
type Message ¶
type Message struct { ID string `json:"id"` ChannelID string `json:"channel_id"` GuildID string `json:"guild_id"` GroupOpenID string `json:"group_openid"` FileUUID string `json:"file_uuid"` FileInfo string `json:"file_info"` Content string `json:"content"` Timestamp *time.Time `json:"timestamp"` EditedTimestamp *time.Time `json:"edited_timestamp"` FileInfoTTL int `json:"ttl"` MentionEveryone bool `json:"mention_everyone"` Author *User `json:"author"` Attachments []MessageAttachment `json:"attachments"` Embeds []MessageEmbed `json:"embeds"` Member *Member `json:"member"` Ark *MessageArk `json:"ark"` SeqInChannel string `json:"seq_in_channel"` MessageReference *MessageReference `json:"message_reference"` SrcGuildID string `json:"src_guild_id"` Data *struct { MessageAudit *MessageAudited `json:"message_audit,omitempty"` } `json:"data,omitempty"` }
Message 消息对象
type MessageArk ¶
type MessageArk struct { TemplateID int `json:"template_id"` KV []MessageArkKV `json:"kv"` }
MessageArk https://bot.q.qq.com/wiki/develop/api/openapi/message/model.html#messageark
type MessageArkKV ¶
type MessageArkKV struct { Key string `json:"key"` Value string `json:"value"` Obj []MessageArkObj `json:"obj"` }
MessageArkKV https://bot.q.qq.com/wiki/develop/api/openapi/message/model.html#messagearkkv
type MessageArkObj ¶
type MessageArkObj struct {
ObjKV []MessageArkObjKV `json:"obj_kv"`
}
MessageArkObj https://bot.q.qq.com/wiki/develop/api/openapi/message/model.html#messagearkobj
type MessageArkObjKV ¶
MessageArkObjKV https://bot.q.qq.com/wiki/develop/api/openapi/message/model.html#messagearkobjkv
type MessageAttachment ¶
type MessageAttachment struct { ContentType string `json:"content_type,omitempty"` Filename string `json:"filename,omitempty"` Height int `json:"height,omitempty"` ID string `json:"id,omitempty"` Size int `json:"size,omitempty"` URL string `json:"url,omitempty"` Width int `json:"width,omitempty"` }
MessageAttachment https://bot.q.qq.com/wiki/develop/api/openapi/message/model.html#messageattachment
type MessageAudited ¶
type MessageAudited struct { AuditID string `json:"audit_id"` AuditTime time.Time `json:"audit_time"` ChannelID string `json:"channel_id"` CreateTime time.Time `json:"create_time"` GuildID string `json:"guild_id"` MessageID string `json:"message_id"` }
MessageAudited 消息审核对象
type MessageDelete ¶
MessageDelete https://bot.q.qq.com/wiki/develop/api/openapi/message/model.html#messagedelete
func (*MessageDelete) String ¶
func (mdl *MessageDelete) String() string
type MessageEmbed ¶
type MessageEmbed struct { Title string `json:"title"` Prompt string `json:"prompt"` Thumbnail *MessageEmbedThumbnail `json:"thumbnail"` Fields []MessageEmbedField `json:"fields"` }
MessageEmbed https://bot.q.qq.com/wiki/develop/api/openapi/message/model.html#messageembed
type MessageEmbedField ¶
type MessageEmbedField struct {
Name string `json:"name"`
}
MessageEmbedField https://bot.q.qq.com/wiki/develop/api/openapi/message/model.html#messageembedfield
type MessageEmbedThumbnail ¶
type MessageEmbedThumbnail struct {
URL string `json:"url"`
}
MessageEmbedThumbnail https://bot.q.qq.com/wiki/develop/api/openapi/message/model.html#messageembedthumbnail
type MessageKeyboard ¶
type MessageKeyboard struct { ID string `json:"id,omitempty"` Content *InlineKeyboard `json:"content,omitempty"` // 自定义 keyboard 内容,与 id 参数互斥,参数都传值将报错 }
MessageKeyboard https://bot.q.qq.com/wiki/develop/api/openapi/message/model.html#messagekeyboard
type MessageMarkdown ¶
type MessageMarkdown struct { TemplateID int `json:"template_id,omitempty"` CustomTemplateID string `json:"custom_template_id,omitempty"` Params []MessageMarkdownParams `json:"params,omitempty"` Content string `json:"content,omitempty"` // 原生 markdown 内容,与上面三个参数互斥,参数都传值将报错 }
MessageMarkdown https://bot.q.qq.com/wiki/develop/api/openapi/message/model.html#messagemarkdown
type MessageMarkdownParams ¶
MessageMarkdownParams https://bot.q.qq.com/wiki/develop/api/openapi/message/model.html#messagemarkdownparams
type MessageMedia ¶
type MessageMedia struct {
FileInfo string `json:"file_info"`
}
MessageMedia used in MessagePost
type MessagePost ¶
type MessagePost struct { // https://bot.q.qq.com/wiki/develop/api-231017/server-inter/message/send-receive/send.html Type MessageType `json:"msg_type"` Seq int `json:"msg_seq,omitempty"` // 回复消息的序号,与 msg_id 联合使用,避免相同消息id回复重复发送,不填默认是1。相同的 msg_id + msg_seq 重复发送会失败。 Content string `json:"content,omitempty"` Embed *MessageEmbed `json:"embed,omitempty"` // https://bot.q.qq.com/wiki/develop/api/openapi/message/template/embed_message.html Ark *MessageArk `json:"ark,omitempty"` // https://bot.q.qq.com/wiki/develop/api/openapi/message/message_template.html MessageReference *MessageReference `json:"message_reference,omitempty"` Image string `json:"image,omitempty"` ImageFile string `json:"-"` // ImageFile 为图片路径 file:/// or base64:// or base16384:// , 与 Image, ImageBytes 参数二选一, 优先 ImageBytes ImageBytes []byte `json:"-"` // ImageBytes 图片数据 ReplyMessageID string `json:"msg_id,omitempty"` ReplyEventID string `json:"event_id,omitempty"` Markdown *MessageMarkdown `json:"markdown,omitempty"` KeyBoard *MessageKeyboard `json:"keyboard,omitempty"` Media *MessageMedia `json:"media,omitempty"` }
MessagePost 发送消息所需参数
func (*MessagePost) String ¶
func (mp *MessagePost) String() string
type MessageReaction ¶
type MessageReaction struct { UserID string `json:"user_id"` GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` Target *ReactionTarget `json:"target"` Emoji *Emoji `json:"emoji"` }
MessageReaction https://bot.q.qq.com/wiki/develop/api/openapi/reaction/model.html#messagereaction
type MessageReactionUsers ¶
type MessageReactionUsers struct { Users []User `json:"users"` Cookie string `json:"cookie"` IsEnd bool `json:"is_end"` }
MessageReactionUsers https://bot.q.qq.com/wiki/develop/api/openapi/reaction/get_reaction_users.html#%E8%BF%94%E5%9B%9E
type MessageReference ¶
type MessageReference struct { MessageID string `json:"message_id"` IgnoreGetMessageError bool `json:"ignore_get_message_error"` }
MessageReference https://bot.q.qq.com/wiki/develop/api/openapi/message/model.html#messagereference
type MessageSegment ¶
type MessageSegment struct { Type MessageSegmentType Data string }
MessageSegment impl the single message MessageSegment 消息数组
func At ¶
func At(id string) MessageSegment
func AtAll ¶
func AtAll() MessageSegment
func AtChannel ¶
func AtChannel(id string) MessageSegment
AtChannel #频道 https://bot.q.qq.com/wiki/develop/api/openapi/message/message_format.html#%E6%94%AF%E6%8C%81%E7%9A%84%E6%A0%BC%E5%BC%8F
func Face ¶
func Face(id int) MessageSegment
func Record ¶
func Record(url string) MessageSegment
Record QQ 语音 https://bot.q.qq.com/wiki/develop/api-231017/server-inter/message/send-receive/rich-text-media.html
func ReplyTo ¶
func ReplyTo(id string) MessageSegment
Reply 回复 https://github.com/botuniverse/onebot-11/tree/master/message/segment.md#%E5%9B%9E%E5%A4%8D
func Video ¶
func Video(url string) MessageSegment
Video QQ 视频 https://bot.q.qq.com/wiki/develop/api-231017/server-inter/message/send-receive/rich-text-media.html
func (MessageSegment) String ¶
func (m MessageSegment) String() string
String impls the interface fmt.Stringer
type MessageSegmentType ¶
type MessageSegmentType int
const ( MessageSegmentTypeText MessageSegmentType = iota MessageSegmentTypeImage MessageSegmentTypeImageBytes MessageSegmentTypeReply MessageSegmentTypeAudio MessageSegmentTypeVideo )
type MessageSetting ¶
type MessageSetting struct { DisableCreateDm bool `json:"disable_create_dm"` DisablePushMsg bool `json:"disable_push_msg"` ChannelIDs []string `json:"channel_ids"` ChannelPushMaxNum uint32 `json:"channel_push_max_num"` }
MessageSetting 频道消息频率设置对象
https://bot.q.qq.com/wiki/develop/api/openapi/setting/model.html
type MessageType ¶
type MessageType int
const ( MessageTypeText MessageType = iota MessageTypeTextImage MessageTypeMarkdown MessageTypeArk MessageTypeEmbed MessageTypeUnk1 MessageTypeUnk2 MessageTypeMedia )
func (MessageType) String ¶
func (mt2 MessageType) String() string
type Messages ¶
type Messages []MessageSegment
Message impl the array form of message
func ReplyWithMessage ¶
func ReplyWithMessage(messageID string, m ...MessageSegment) Messages
ReplyWithMessage returns a reply message
type OpCode ¶
type OpCode int
OpCode https://bot.q.qq.com/wiki/develop/api/gateway/opcode.html
const ( OpCodeDispatch OpCode = iota // Receive OpCodeHeartbeat // Send/Receive OpCodeIdentify // Send OpCodeEmpty1 OpCodeEmpty2 OpCodeEmpty3 OpCodeResume // Send OpCodeReconnect // Receive OpCodeEmpty4 OpCodeInvalidSession // Receive OpCodeHello // Receive OpCodeHeartbeatACK // Receive/Reply OpCodeHTTPCallbackACK // Reply )
type OpCodeIdentifyMessage ¶
type OpCodeIdentifyMessage struct { Token string `json:"token"` Intents uint32 `json:"intents"` Shard [2]byte `json:"shard"` Properties json.RawMessage `json:"properties"` }
OpCodeIdentifyMessage https://bot.q.qq.com/wiki/develop/api/gateway/reference.html#_2-%E9%89%B4%E6%9D%83%E8%BF%9E%E6%8E%A5
type PinsMessage ¶
type PinsMessage struct { GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` MessageIDs []string `json:"message_ids"` }
PinsMessage 精华消息对象
https://bot.q.qq.com/wiki/develop/api/openapi/pins/model.html#pinsmessage
type Post ¶
type Post struct { GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` AuthorID string `json:"author_id"` PostInfo *PostInfo `json:"post_info"` }
Post 话题频道内对主题的评论称为帖子
https://bot.q.qq.com/wiki/develop/api/openapi/forum/model.html#post
type PostInfo ¶
type PostInfo struct { ThreadID string `json:"thread_id"` PostID string `json:"post_id"` Content string `json:"content"` DateTime time.Time `json:"date_time"` }
PostInfo 帖子事件包含的帖子内容信息
https://bot.q.qq.com/wiki/develop/api/openapi/forum/model.html#postinfo
type PrivateType ¶
type PrivateType int
PrivateType https://bot.q.qq.com/wiki/develop/api/openapi/channel/model.html#privatetype
const ( PrivateTypePublic PrivateType = iota // 公开频道 PrivateTypeOnlyAdmin // 群主管理员可见 PrivateTypeAdminAndShimei // 群主管理员+指定成员,可使用 修改子频道权限接口 指定成员 )
type QQRobotStatus ¶
type QQRobotStatus struct { OpenID string `json:"openid"` GroupOpenID string `json:"group_openid"` OpMemberOpenID string `json:"op_member_openid"` Timestamp int `json:"timestamp"` }
QQRobotStatus https://bot.q.qq.com/wiki/develop/api-231017/server-inter/group.html#%E4%BA%8B%E4%BB%B6
type ReactionTarget ¶
type ReactionTarget struct { ID string `json:"id"` Type ReactionTargetType `json:"type"` // 实际是 string 而非 int }
ReactionTarget https://bot.q.qq.com/wiki/develop/api/openapi/reaction/model.html#reactiontarget
type ReactionTargetType ¶
type ReactionTargetType string
ReactionTargetType https://bot.q.qq.com/wiki/develop/api/openapi/reaction/model.html#reactiontargettype
type RecommendChannel ¶
type RecommendChannel struct { ChannelID string `json:"channel_id"` Introduce string `json:"introduce"` }
RecommendChannel 推荐子频道对象
https://bot.q.qq.com/wiki/develop/api/openapi/announces/model.html#recommendchannel
type Reply ¶
type Reply struct { GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` AuthorID string `json:"author_id"` ReplyInfo *ReplyInfo `json:"reply_info"` }
Reply 话题频道对帖子回复或删除时生产该事件中包含该对象
https://bot.q.qq.com/wiki/develop/api/openapi/forum/model.html#reply
type ReplyInfo ¶
type ReplyInfo struct { ThreadID string `json:"thread_id"` PostID string `json:"post_id"` ReplyID string `json:"reply_id"` Content string `json:"content"` DateTime time.Time `json:"date_time"` }
ReplyInfo 回复事件包含的回复内容信息
https://bot.q.qq.com/wiki/develop/api/openapi/forum/model.html#replyinfo
type Role ¶
type Role struct { ID string `json:"id"` Name string `json:"name"` Color uint32 `json:"color"` Hoist uint32 `json:"hoist"` Number uint32 `json:"number"` MemberLimit uint32 `json:"member_limit"` }
Role 频道身份组对象
https://bot.q.qq.com/wiki/develop/api/openapi/guild/role_model.html
type RoleMembers ¶
RoleMembers 频道身份组成员列表
https://bot.q.qq.com/wiki/develop/api/openapi/member/get_role_members.html#%E8%BF%94%E5%9B%9E
type Rule ¶
Rule filter the event
func CheckChannel ¶
CheckChannel only triggered in specific channel
func CheckGuild ¶
CheckGuild only triggered in specific guild
func CommandGroupRule ¶
CommandGroupRule check if the message is a command and trim the command name
this rule only supports Message
func CommandRule ¶
CommandRule check if the message is a command and trim the command name
this rule only supports Message
func FullMatchGroupRule ¶
FullMatchGroupRule check if src has the same copy of the message
func FullMatchRule ¶
FullMatchRule check if src has the same copy of the message
func KeywordGroupRule ¶
KeywordGroupRule check if the message has a keyword or keywords
func KeywordRule ¶
func MustProvidePhoto ¶
MustProvidePhoto 消息不存在图片阻塞120秒至有图片,超时返回 false
func PrefixGroupRule ¶
PrefixGroupRule check if the text message has the prefix and trim the prefix
检查消息前缀
func ReplyRule ¶
ReplyRule check if the message is replying some message
this rule only supports Message
func SuffixGroupRule ¶
SuffixGroupRule check if the text message has the suffix and trim the suffix
检查消息后缀
type Schedule ¶
type Schedule struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` StartTimestamp string `json:"start_timestamp,omitempty"` EndTimestamp string `json:"end_timestamp,omitempty"` Creator *Member `json:"creator,omitempty"` JumpChannelID string `json:"jump_channel_id,omitempty"` RemindType string `json:"remind_type,omitempty"` // https://bot.q.qq.com/wiki/develop/api/openapi/schedule/model.html#remindtype }
Schedule 日程对象
https://bot.q.qq.com/wiki/develop/api/openapi/schedule/model.html
type ShardWSSGateway ¶
type ShardWSSGateway struct { URL string `json:"url"` Shards int `json:"shards"` SessionStartLimit struct { Total int `json:"total"` Remaining int `json:"remaining"` ResetAfter int `json:"reset_after"` MaxConcurrency int `json:"max_concurrency"` } `json:"session_start_limit"` }
ShardWSSGateway 带分片 WSS 接入点响应数据
https://bot.q.qq.com/wiki/develop/api/openapi/wss/shard_url_get.html#%E8%BF%94%E5%9B%9E
type Single ¶
type Single[K comparable] struct { // contains filtered or unexported fields }
Single 反并发
type SpeakPermission ¶
type SpeakPermission int
SpeakPermission https://bot.q.qq.com/wiki/develop/api/openapi/channel/model.html#speakpermission
type Thread ¶
type Thread struct { GuildID string `json:"guild_id"` ChannelID string `json:"channel_id"` AuthorID string `json:"author_id"` ThreadInfo *ThreadInfo `json:"thread_info"` }
Thread 话题频道内发表的主帖称为主题
https://bot.q.qq.com/wiki/develop/api/openapi/forum/model.html#thread
type ThreadInfo ¶
type ThreadInfo struct { ThreadID string `json:"thread_id"` Title string `json:"title"` Content string `json:"content"` DateTime time.Time `json:"date_time"` }
ThreadInfo 帖子事件包含的主帖内容相关信息
https://bot.q.qq.com/wiki/develop/api/openapi/forum/model.html#threadinfo
type User ¶
type User struct { ID string `json:"id"` Username string `json:"username"` Avatar string `json:"avatar"` Bot bool `json:"bot"` UnionOpenid string `json:"union_openid"` UnionUserAccount string `json:"union_user_account"` UserOpenID string `json:"user_openid"` MemberOpenID string `json:"member_openid"` }
User 用户对象
https://bot.q.qq.com/wiki/develop/api/openapi/user/model.html
type WebsocketPayload ¶
type WebsocketPayload struct { Op OpCode `json:"op"` D json.RawMessage `json:"d,omitempty"` S uint32 `json:"s,omitempty"` T string `json:"t,omitempty"` }
WebsocketPayload payload 指的是在 websocket 连接上传输的数据,网关的上下行消息采用的都是同一个结构
https://bot.q.qq.com/wiki/develop/api/gateway/reference.html
func (*WebsocketPayload) GetEventReady ¶
func (wp *WebsocketPayload) GetEventReady() (er EventReady, seq uint32, err error)
GetEventReady OpCodeDispatch READY
func (*WebsocketPayload) GetHeartbeatInterval ¶
func (wp *WebsocketPayload) GetHeartbeatInterval() (uint32, error)
GetHeartbeatInterval OpCodeHello 获得心跳周期 单位毫秒
func (*WebsocketPayload) WrapData ¶
func (wp *WebsocketPayload) WrapData(v any) (err error)
WrapData 将结构体序列化到 wp.D
Source Files ¶
- api_generated.go
- bot.go
- context.go
- engine.go
- engine_generated.go
- event.go
- future.go
- handler.go
- helper.go
- http.go
- intent.go
- lazy.go
- manager.go
- matcher.go
- message.go
- opcode.go
- openapi.go
- openapi_announces.go
- openapi_audio.go
- openapi_channel.go
- openapi_codegen_getopenapiof.go
- openapi_codegen_patchopenapiof.go
- openapi_codegen_postopenapiof.go
- openapi_codegen_putopenapiof.go
- openapi_dms.go
- openapi_emoji.go
- openapi_forum.go
- openapi_guild.go
- openapi_markdown.go
- openapi_member.go
- openapi_message.go
- openapi_permissions.go
- openapi_pins.go
- openapi_richobj.go
- openapi_role.go
- openapi_schedule.go
- openapi_user.go
- openapi_v2.go
- openapi_v2_files.go
- openapi_v2_message.go
- openapi_wss.go
- payload.go
- rule.go
- rules.go
- shell.go
- single.go