Documentation
¶
Index ¶
- Constants
- Variables
- func AdminPermission(ctx *Ctx) bool
- func ExposeCaller[T any](ctx *Ctx) *T
- func GetTriggeredMessages(id message.ID) []message.ID
- func HasPicture(ctx *Ctx) bool
- func MustProvidePicture(ctx *Ctx) bool
- func OnlyGroup(ctx *Ctx) bool
- func OnlyGuild(ctx *Ctx) bool
- func OnlyPrivate(ctx *Ctx) bool
- func OnlyPublic(ctx *Ctx) bool
- func OnlyToMe(ctx *Ctx) bool
- func OwnerPermission(ctx *Ctx) bool
- func ParseShell(s string) []string
- func RangeBot(iter func(id int64, ctx *Ctx) bool)
- func Run(op *Config)
- func RunAndBlock(op *Config, preblock func())
- func SuperUserPermission(ctx *Ctx) bool
- func UserOrGrpAdmin(ctx *Ctx) bool
- type APICaller
- type APIRequest
- type APIResponse
- type APIResult
- type Config
- type Ctx
- func (ctx *Ctx) ArkShareGroup(groupID string) (APIResult[string], error)
- func (ctx *Ctx) ArkSharePeer(userID, groupID string) (APIResult[string], error)
- func (ctx *Ctx) Block()
- func (ctx *Ctx) Break()
- func (ctx *Ctx) CallAction(action string, params Params) (APIResponse, error)
- func (ctx *Ctx) CallActionWithContext(c context.Context, action string, params Params) (APIResponse, error)
- func (ctx *Ctx) CanSendImage() (APIResult[bool], error)
- func (ctx *Ctx) CanSendRecord() (APIResult[bool], error)
- func (ctx *Ctx) CardOrNickName(uid int64) (name string)
- func (ctx *Ctx) CheckSession() Rule
- func (ctx *Ctx) CheckURLSafely(url string) (APIResult[int64], error)
- func (ctx *Ctx) CleanCache() (APIResult[struct{}], error)
- func (ctx *Ctx) ClickInlineKeyboardButton(groupID int64, botAppid string, buttonID, callbackData string) (APIResult[struct{}], error)
- func (ctx *Ctx) CreateCollection() (APIResult[gjson.Result], error)
- func (ctx *Ctx) CreateGroupFileFolder(groupID int64, folderName string) (APIResult[gjson.Result], error)
- func (ctx *Ctx) CreateThisGroupFileFolder(folderName string) (APIResult[gjson.Result], error)
- func (ctx *Ctx) DeleteFriend(userID int64, tempBlock, tempBothDel bool) (APIResult[struct{}], error)
- func (ctx *Ctx) DeleteGroupAlbumMedia(groupID int64, albumID, mediaID string) (APIResult[struct{}], error)
- func (ctx *Ctx) DeleteGroupEssenceMessage(messageID int64) (APIResponse, error)
- func (ctx *Ctx) DeleteGroupFile(groupID int64, fileID string) (APIResult[struct{}], error)
- func (ctx *Ctx) DeleteGroupFileFolder(groupID int64, folderID string) (APIResult[struct{}], error)
- func (ctx *Ctx) DeleteGroupNotice(groupID int64, noticeID string) (APIResult[struct{}], error)
- func (ctx *Ctx) DeleteMessage(messageID interface{}) (APIResult[struct{}], error)
- func (ctx *Ctx) DeleteThisGroupFile(fileID string) (APIResult[struct{}], error)
- func (ctx *Ctx) DeleteThisGroupFileFolder(folderID string) (APIResult[struct{}], error)
- func (ctx *Ctx) DeleteThisGroupNotice(noticeID string) (APIResult[struct{}], error)
- func (ctx *Ctx) DownloadFile(url, name, headers string) (APIResult[string], error)
- func (ctx *Ctx) Echo(response []byte)
- func (ctx *Ctx) ExtractPlainText() string
- func (ctx *Ctx) FetchCustomFace(count int) (APIResult[gjson.Result], error)
- func (ctx *Ctx) ForwardFriendSingleMessage(userID int64, messageID interface{}) (APIResponse, error)
- func (ctx *Ctx) ForwardGroupSingleMessage(groupID int64, messageID interface{}) (APIResponse, error)
- func (ctx *Ctx) FriendPoke(userID int64) (APIResult[struct{}], error)
- func (ctx *Ctx) FutureEvent(typ string, rule ...Rule) *FutureEvent
- func (ctx *Ctx) Get(prompt string) string
- func (ctx *Ctx) GetAICharacters(groupID int64, chatType int) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetAIRecord(character string, groupID int64, text string) (APIResult[string], error)
- func (ctx *Ctx) GetCSRFToken() (APIResult[int64], error)
- func (ctx *Ctx) GetClientKey() (APIResult[string], error)
- func (ctx *Ctx) GetCollectionList() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetCookies(domain string) (APIResult[string], error)
- func (ctx *Ctx) GetCredentials(domain string) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetDoubtFriendsAddRequest() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetEmojiLikeList(messageID interface{}, emojiID string, count int) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetFile(fileID string) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetForwardMessage(id string) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetFriendList() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetFriendMessageHistory(userID, messageSeq string, count int, reverseOrder bool) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetFriendsWithCategory() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetGroupAlbumList(groupID int64) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetGroupAlbumMediaList(groupID int64, albumID string) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetGroupAtAllRemain(groupID int64) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetGroupEssenceMessageList(groupID int64) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetGroupFileURL(groupID, busid int64, fileID string) (APIResult[string], error)
- func (ctx *Ctx) GetGroupFilesByFolder(groupID int64, folderID string) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetGroupFilesystemInfo(groupID int64) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetGroupHonorInfo(groupID int64, hType string) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetGroupIgnoredNotifies(groupID int64) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetGroupInfo(groupID int64, noCache bool) (APIResult[Group], error)
- func (ctx *Ctx) GetGroupInfoEx(groupID int64) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetGroupList() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetGroupMemberInfo(groupID int64, userID int64, noCache bool) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetGroupMemberList(groupID int64) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetGroupMemberListNoCache(groupID int64) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetGroupMessageHistory(groupID, messageID, count int64, reverseOrder bool) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetGroupNotice(groupID int64) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetGroupRootFiles(groupID int64) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetGroupShutList(groupID int64) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetGroupSystemMessage() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetGuildList() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetGuildServiceProfile() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetImage(file string) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetLatestGroupMessageHistory(groupID, count int64, reverseOrder bool) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetLatestThisGroupMessageHistory(count int64, reverseOrder bool) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetLoginInfo() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetMatcher() *Matcher
- func (ctx *Ctx) GetMessage(messageID interface{}, nologreply ...bool) (APIResult[Message], error)
- func (ctx *Ctx) GetMiniAppArk(appID, title, desc, iconURL, webURL string) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetOnlineClients(noCache bool) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetPacketStatus() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetPrivateFileURL(fileID string) (APIResult[string], error)
- func (ctx *Ctx) GetProfileLike() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetRKey() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetRKeyServer() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetRecentContact(count int) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetRecord(file string, outFormat string) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetRobotUinRange() (start, end int64, err error)
- func (ctx *Ctx) GetStatus() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetStrangerInfo(userID int64, noCache bool) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetThisGroupAtAllRemain() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetThisGroupEssenceMessageList() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetThisGroupFileURL(busid int64, fileID string) (APIResult[string], error)
- func (ctx *Ctx) GetThisGroupFilesByFolder(folderID string) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetThisGroupFilesystemInfo() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetThisGroupHonorInfo(hType string) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetThisGroupIgnoredNotifies() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetThisGroupInfo(noCache bool) (APIResult[Group], error)
- func (ctx *Ctx) GetThisGroupInfoEx() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetThisGroupMemberInfo(userID int64, noCache bool) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetThisGroupMemberList() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetThisGroupMemberListNoCache() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetThisGroupMessageHistory(messageID, count int64, reverseOrder bool) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetThisGroupNotice() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetThisGroupRootFiles() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetThisGroupShutList() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetUnidirectionalFriendList() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetUserStatus(userID int64) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetVersionInfo() (APIResult[gjson.Result], error)
- func (ctx *Ctx) GetWordSlices(content string) (APIResult[gjson.Result], error)
- func (ctx *Ctx) GroupKickBatch(groupID int64, userIDs []int64, rejectAddRequest bool) (APIResult[struct{}], error)
- func (ctx *Ctx) GroupPoke(groupID, userID int64) (APIResult[struct{}], error)
- func (ctx *Ctx) LikeGroupAlbumMedia(groupID int64, albumID, mediaID string) (APIResult[struct{}], error)
- func (ctx *Ctx) Logout() (APIResult[struct{}], error)
- func (ctx *Ctx) MarkAllAsRead() (APIResult[struct{}], error)
- func (ctx *Ctx) MarkGroupMessageAsRead(groupID int64) (APIResult[struct{}], error)
- func (ctx *Ctx) MarkMessageAsRead(messageID int64) (APIResponse, error)
- func (ctx *Ctx) MarkPrivateMessageAsRead(userID int64) (APIResult[struct{}], error)
- func (ctx *Ctx) MarkThisMessageAsRead() (APIResponse, error)
- func (ctx *Ctx) MessageString() string
- func (ctx *Ctx) MoveGroupFile(groupID int64, fileID, parentFolderID, targetFolderID string) (APIResult[struct{}], error)
- func (ctx *Ctx) NcGetRKey() (APIResult[gjson.Result], error)
- func (ctx *Ctx) NickName() (name string)
- func (ctx *Ctx) NoTimeout()
- func (ctx *Ctx) OCRImage(file string) (APIResult[gjson.Result], error)
- func (ctx *Ctx) Parse(model interface{}) (err error)
- func (ctx *Ctx) RenameGroupFile(groupID int64, fileID, newName string) (APIResult[struct{}], error)
- func (ctx *Ctx) Restart() (APIResult[struct{}], error)
- func (ctx *Ctx) Send(msg interface{}) message.ID
- func (ctx *Ctx) SendChain(msg ...message.Segment) message.ID
- func (ctx *Ctx) SendForwardMessage(messageType string, userID, groupID int64, messages message.Message) (messageID int64, resID string, err error)
- func (ctx *Ctx) SendGroupAIRecord(character string, groupID int64, text string) (APIResult[string], error)
- func (ctx *Ctx) SendGroupCustomMusic(groupID int64, url, audio, title string) (APIResult[int64], error)
- func (ctx *Ctx) SendGroupForwardMessage(groupID int64, message message.Message) (APIResult[gjson.Result], error)
- func (ctx *Ctx) SendGroupMessage(groupID int64, message interface{}) (APIResult[int64], error)
- func (ctx *Ctx) SendGroupMusic(groupID int64, musicType string, id int64) (APIResult[int64], error)
- func (ctx *Ctx) SendGroupNotice(groupID int64, content, image string, pinned int) (APIResult[struct{}], error)
- func (ctx *Ctx) SendGuildChannelMessage(guildID, channelID string, message interface{}) (APIResult[string], error)
- func (ctx *Ctx) SendLike(userID int64, times int) (APIResult[struct{}], error)
- func (ctx *Ctx) SendPoke(groupID, userID int64) (APIResult[struct{}], error)
- func (ctx *Ctx) SendPrivateForwardMessage(userID int64, message message.Message) (APIResult[gjson.Result], error)
- func (ctx *Ctx) SendPrivateMessage(userID int64, message interface{}) (APIResult[int64], error)
- func (ctx *Ctx) SendThisGroupNotice(content, image string, pinned int) (APIResult[struct{}], error)
- func (ctx *Ctx) SetCustomOnlineStatus(faceID int, faceType int, wording string) (APIResult[struct{}], error)
- func (ctx *Ctx) SetDoubtFriendsAddRequest(flag string, approve bool, remark string) (APIResult[struct{}], error)
- func (ctx *Ctx) SetFriendAddRequest(flag string, approve bool, remark string) (APIResult[struct{}], error)
- func (ctx *Ctx) SetFriendRemark(userID int64, remark string) (APIResult[struct{}], error)
- func (ctx *Ctx) SetGroupAddOption(groupID int64, addOption int) (APIResult[struct{}], error)
- func (ctx *Ctx) SetGroupAddRequest(flag string, subType string, approve bool, reason string) (APIResult[struct{}], error)
- func (ctx *Ctx) SetGroupAdmin(groupID, userID int64, enable bool) (APIResult[struct{}], error)
- func (ctx *Ctx) SetGroupAnonymous(groupID int64, enable bool) (APIResult[struct{}], error)
- func (ctx *Ctx) SetGroupBan(groupID, userID, duration int64) (APIResult[struct{}], error)
- func (ctx *Ctx) SetGroupCard(groupID, userID int64, card string) (APIResult[struct{}], error)
- func (ctx *Ctx) SetGroupEssenceMessage(messageID int64) (APIResponse, error)
- func (ctx *Ctx) SetGroupKick(groupID, userID int64, rejectAddRequest bool) (APIResult[struct{}], error)
- func (ctx *Ctx) SetGroupLeave(groupID int64, isDismiss bool) (APIResult[struct{}], error)
- func (ctx *Ctx) SetGroupName(groupID int64, groupName string) (APIResult[struct{}], error)
- func (ctx *Ctx) SetGroupPortrait(groupID int64, file string) (APIResult[struct{}], error)
- func (ctx *Ctx) SetGroupRemark(groupID int64, remark string) (APIResult[struct{}], error)
- func (ctx *Ctx) SetGroupSearchOption(groupID int64, enabled bool) (APIResult[struct{}], error)
- func (ctx *Ctx) SetGroupSign(groupID int64) (APIResult[struct{}], error)
- func (ctx *Ctx) SetGroupSpecialTitle(groupID, userID int64, specialTitle string) (APIResult[struct{}], error)
- func (ctx *Ctx) SetGroupTodo(groupID, messageID int64) (APIResult[struct{}], error)
- func (ctx *Ctx) SetGroupWholeBan(groupID int64, enable bool) (APIResult[struct{}], error)
- func (ctx *Ctx) SetInputStatus(userID int64, eventType int) (APIResult[struct{}], error)
- func (ctx *Ctx) SetMessageEmojiLike(messageID interface{}, emojiID rune) error
- func (ctx *Ctx) SetMyAvatar(file string) (APIResponse, error)
- func (ctx *Ctx) SetOnlineStatus(status, extStatus, batteryStatus int) (APIResult[struct{}], error)
- func (ctx *Ctx) SetQQProfile(nickname, personalNote string, sex int) (APIResult[struct{}], error)
- func (ctx *Ctx) SetSelfLongNick(longNick string) (APIResult[gjson.Result], error)
- func (ctx *Ctx) SetThisGroupAdmin(userID int64, enable bool) (APIResult[struct{}], error)
- func (ctx *Ctx) SetThisGroupAnonymous(enable bool) (APIResult[struct{}], error)
- func (ctx *Ctx) SetThisGroupBan(userID, duration int64) (APIResult[struct{}], error)
- func (ctx *Ctx) SetThisGroupCard(userID int64, card string) (APIResult[struct{}], error)
- func (ctx *Ctx) SetThisGroupKick(userID int64, rejectAddRequest bool) (APIResult[struct{}], error)
- func (ctx *Ctx) SetThisGroupLeave(isDismiss bool) (APIResult[struct{}], error)
- func (ctx *Ctx) SetThisGroupName(groupName string) (APIResult[struct{}], error)
- func (ctx *Ctx) SetThisGroupPortrait(file string) (APIResult[struct{}], error)
- func (ctx *Ctx) SetThisGroupRemark(remark string) (APIResult[struct{}], error)
- func (ctx *Ctx) SetThisGroupSpecialTitle(userID int64, specialTitle string) (APIResult[struct{}], error)
- func (ctx *Ctx) SetThisGroupTodo(messageID int64) (APIResult[struct{}], error)
- func (ctx *Ctx) SetThisGroupWholeBan(enable bool) (APIResult[struct{}], error)
- func (ctx *Ctx) TransGroupFile(groupID int64, fileID, targetGroupID string) (APIResult[struct{}], error)
- func (ctx *Ctx) TranslateEn2Zh(words []string) (APIResult[[]string], error)
- func (ctx *Ctx) UploadGroupAlbum(groupID int64, albumID, file string) (APIResult[gjson.Result], error)
- func (ctx *Ctx) UploadGroupFile(groupID int64, file, name, folder string) (APIResponse, error)
- func (ctx *Ctx) UploadPrivateFile(userID int64, file, name string) (APIResult[string], error)
- func (ctx *Ctx) UploadThisGroupFile(file, name, folder string) (APIResponse, error)
- type Driver
- type Engine
- func (e *Engine) Delete()
- func (e *Engine) On(typ string, rules ...Rule) *Matcher
- func (e *Engine) OnCommand(commands string, rules ...Rule) *Matcher
- func (e *Engine) OnCommandGroup(commands []string, rules ...Rule) *Matcher
- func (e *Engine) OnFullMatch(src string, rules ...Rule) *Matcher
- func (e *Engine) OnFullMatchGroup(src []string, rules ...Rule) *Matcher
- func (e *Engine) OnKeyword(keyword string, rules ...Rule) *Matcher
- func (e *Engine) OnKeywordGroup(keywords []string, rules ...Rule) *Matcher
- func (e *Engine) OnMessage(rules ...Rule) *Matcher
- func (e *Engine) OnMetaEvent(rules ...Rule) *Matcher
- func (e *Engine) OnNotice(rules ...Rule) *Matcher
- func (e *Engine) OnPrefix(prefix string, rules ...Rule) *Matcher
- func (e *Engine) OnPrefixGroup(prefix []string, rules ...Rule) *Matcher
- func (e *Engine) OnRegex(regexPattern string, rules ...Rule) *Matcher
- func (e *Engine) OnRequest(rules ...Rule) *Matcher
- func (e *Engine) OnShell(command string, model interface{}, rules ...Rule) *Matcher
- func (e *Engine) OnSuffix(suffix string, rules ...Rule) *Matcher
- func (e *Engine) OnSuffixGroup(suffix []string, rules ...Rule) *Matcher
- func (e *Engine) SetBlock(block bool) *Engine
- func (e *Engine) UseMidHandler(rules ...Rule)
- func (e *Engine) UsePostHandler(handler ...Handler)
- func (e *Engine) UsePreHandler(rules ...Rule)
- type Event
- type File
- type FutureEvent
- type Group
- type H
- type Handler
- type Matcher
- func On(typ string, rules ...Rule) *Matcher
- func OnCommand(commands string, rules ...Rule) *Matcher
- func OnCommandGroup(commands []string, rules ...Rule) *Matcher
- func OnFullMatch(src string, rules ...Rule) *Matcher
- func OnFullMatchGroup(src []string, rules ...Rule) *Matcher
- func OnKeyword(keyword string, rules ...Rule) *Matcher
- func OnKeywordGroup(keywords []string, rules ...Rule) *Matcher
- func OnMessage(rules ...Rule) *Matcher
- func OnMetaEvent(rules ...Rule) *Matcher
- func OnNotice(rules ...Rule) *Matcher
- func OnPrefix(prefix string, rules ...Rule) *Matcher
- func OnPrefixGroup(prefix []string, rules ...Rule) *Matcher
- func OnRegex(regexPattern string, rules ...Rule) *Matcher
- func OnRequest(rules ...Rule) *Matcher
- func OnShell(command string, model interface{}, rules ...Rule) *Matcher
- func OnSuffix(suffix string, rules ...Rule) *Matcher
- func OnSuffixGroup(suffix []string, rules ...Rule) *Matcher
- func StoreMatcher(m *Matcher) *Matcher
- func StoreTempMatcher(m *Matcher) *Matcher
- func (m *Matcher) BindEngine(e *Engine) *Matcher
- func (m *Matcher) Delete()
- func (m *Matcher) FirstPriority() *Matcher
- func (m *Matcher) FutureEvent(typ string, rule ...Rule) *FutureEvent
- func (m *Matcher) Handle(handler ...Handler) *Matcher
- func (m *Matcher) SecondPriority() *Matcher
- func (m *Matcher) SetBlock(block bool) *Matcher
- func (m *Matcher) SetPriority(priority int) *Matcher
- func (m *Matcher) ThirdPriority() *Matcher
- type Message
- type Params
- type Parser
- type Pattern
- func (p *Pattern) Add(typ string, optional bool, parse Parser) *Pattern
- func (p *Pattern) Any() *Pattern
- func (p *Pattern) AsRule() Rule
- func (p *Pattern) At(id ...message.ID) *Pattern
- func (p *Pattern) Image() *Pattern
- func (p *Pattern) Reply() *Pattern
- func (p *Pattern) SetOptional(v ...bool) *Pattern
- func (p *Pattern) Text(regex string) *Pattern
- type PatternOption
- type PatternParsed
- type PatternSegment
- type Rule
- func CheckGroup(grpID ...int64) Rule
- func CheckUser(userID ...int64) Rule
- func CommandRule(commands ...string) Rule
- func FullMatchRule(src ...string) Rule
- func GroupHigherPermission(gettarget func(ctx *Ctx) int64) Rule
- func KeywordRule(src ...string) Rule
- func PrefixRule(prefixes ...string) Rule
- func RegexRule(regexPattern string) Rule
- func ReplyRule(messageID int64) Rule
- func ShellRule(cmd string, model interface{}) Rule
- func SuffixRule(suffixes ...string) Rule
- func Type(typ string) Rule
- type State
- type User
Constants ¶
const ( StateKeyPrefixKeep = "__zerobot_keep_" StateKeyEventIndex = StateKeyPrefixKeep + "_zerobot_ev_idx__" )
const (
KeyPattern = "pattern_matched"
)
Variables ¶
var APICallers callerMap
APICallers 所有的APICaller列表, 通过self-ID映射
Functions ¶
func AdminPermission ¶
AdminPermission only triggered by the group admins or higher permission
func ExposeCaller ¶
ExposeCaller as *T, maybe panic if misused
func GetTriggeredMessages ¶
GetTriggeredMessages 获取被 id 消息触发的回复消息 id
func MustProvidePicture ¶
MustProvidePicture 消息不存在图片阻塞120秒至有图片,超时返回 false
func OnlyPrivate ¶
OnlyPrivate requires that the ctx.Event is private message
func OnlyPublic ¶
OnlyPublic requires that the ctx.Event is public/group or public/guild message
func OwnerPermission ¶
OwnerPermission only triggered by the group owner or higher permission
func ParseShell ¶
ParseShell 将指令转换为指令参数. modified from https://github.com/mattn/go-shellwords
func RunAndBlock ¶
func RunAndBlock(op *Config, preblock func())
RunAndBlock 主函数初始化并阻塞
preblock 在所有 Driver 连接后,调用最后一个 Driver 的 Listen 阻塞前执行本函数
func SuperUserPermission ¶
SuperUserPermission only triggered by the bot's owner
Types ¶
type APICaller ¶
type APICaller interface {
CallAPI(c context.Context, request APIRequest) (APIResponse, error)
}
APICaller is the interface of CallAPI
type APIRequest ¶
type APIRequest struct {
Action string `json:"action"`
Params Params `json:"params"`
Echo uint64 `json:"echo,omitempty"` // 该项不用填写,由Driver生成
}
APIRequest is the request sending to the cqhttp https://github.com/botuniverse/onebot-11/blob/master/communication/ws.md
func (*APIRequest) String ¶
func (ar *APIRequest) String() string
type APIResponse ¶
type APIResponse struct {
Status string `json:"status"`
Data gjson.Result `json:"data"`
Message string `json:"message"`
Wording string `json:"wording"`
RetCode int64 `json:"retcode"`
Echo uint64 `json:"echo"`
}
APIResponse is the response of calling API https://github.com/botuniverse/onebot-11/blob/master/communication/ws.md
type APIResult ¶
type APIResult[T any] struct { Value T Resp APIResponse }
APIResult wraps typed business value with raw API response.
type Config ¶
type Config struct {
NickName []string `json:"nickname"` // 机器人名称
CommandPrefix string `json:"command_prefix"` // 触发命令
SuperUsers []int64 `json:"super_users"` // 超级用户
RingLen uint `json:"ring_len"` // 事件环长度 (默认关闭)
Latency time.Duration `json:"latency"` // 事件处理延迟 (延迟 latency 再处理事件,在 ring 模式下不可低于 1ms)
MaxProcessTime time.Duration `json:"max_process_time"` // 事件最大处理时间 (默认4min)
MarkMessage bool `json:"mark_message"` // 自动标记消息为已读
KeepAtMeMessage bool `json:"keep_at_me_message"` // 是否保留at me的原始消息
AddSpaceAfterAt bool `json:"at_space"` // 是否在At消息后没有空格时自动添加空格
Driver []Driver `json:"-"` // 通信驱动
}
Config is config of zero bot
var BotConfig Config
BotConfig 运行中bot的配置,是Run函数的参数的拷贝
type Ctx ¶
Ctx represents the Context which hold the event. 代表上下文
func (*Ctx) ArkShareGroup ¶
ArkShareGroup 获取推荐群聊卡片
func (*Ctx) CallAction ¶
func (ctx *Ctx) CallAction(action string, params Params) (APIResponse, error)
CallAction 调用 cqhttp API
func (*Ctx) CallActionWithContext ¶
func (ctx *Ctx) CallActionWithContext(c context.Context, action string, params Params) (APIResponse, error)
CallActionWithContext 使用 context 调用 cqhttp API
func (*Ctx) CanSendImage ¶
CanSendImage 检查是否可以发送图片
func (*Ctx) CanSendRecord ¶
CanSendRecord 检查是否可以发送语音
func (*Ctx) CardOrNickName ¶
CardOrNickName 从 uid 获取群名片,如果没有则获取昵称
func (*Ctx) CheckURLSafely ¶
CheckURLSafely 检查URL安全性
https://napcat.apifox.cn/228534361e0.md
返回安全等级: 1=安全, 2=未知, 3=危险
func (*Ctx) CleanCache ¶
CleanCache 清理缓存
func (*Ctx) ClickInlineKeyboardButton ¶
func (ctx *Ctx) ClickInlineKeyboardButton(groupID int64, botAppid string, buttonID, callbackData string) (APIResult[struct{}], error)
ClickInlineKeyboardButton 点击内联键盘按钮
func (*Ctx) CreateCollection ¶
CreateCollection 创建收藏
https://napneko.github.io/develop/api/doc#create-collection-%E5%88%9B%E5%BB%BA%E6%94%B6%E8%97%8F
func (*Ctx) CreateGroupFileFolder ¶
func (ctx *Ctx) CreateGroupFileFolder(groupID int64, folderName string) (APIResult[gjson.Result], error)
CreateGroupFileFolder 创建群文件目录
func (*Ctx) CreateThisGroupFileFolder ¶
CreateThisGroupFileFolder 创建本群文件目录
func (*Ctx) DeleteFriend ¶
func (ctx *Ctx) DeleteFriend(userID int64, tempBlock, tempBothDel bool) (APIResult[struct{}], error)
DeleteFriend 删除好友
func (*Ctx) DeleteGroupAlbumMedia ¶
func (ctx *Ctx) DeleteGroupAlbumMedia(groupID int64, albumID, mediaID string) (APIResult[struct{}], error)
DeleteGroupAlbumMedia 删除群相册媒体
func (*Ctx) DeleteGroupEssenceMessage ¶
func (ctx *Ctx) DeleteGroupEssenceMessage(messageID int64) (APIResponse, error)
DeleteGroupEssenceMessage 移出群精华消息 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E7%A7%BB%E5%87%BA%E7%B2%BE%E5%8D%8E%E6%B6%88%E6%81%AF
func (*Ctx) DeleteGroupFile ¶
DeleteGroupFile 删除群文件
func (*Ctx) DeleteGroupFileFolder ¶
DeleteGroupFileFolder 删除群文件目录
func (*Ctx) DeleteGroupNotice ¶
DeleteGroupNotice 删除群公告
func (*Ctx) DeleteMessage ¶
DeleteMessage 撤回消息 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#delete_msg-%E6%92%A4%E5%9B%9E%E6%B6%88%E6%81%AF
func (*Ctx) DeleteThisGroupFile ¶
DeleteThisGroupFile 删除本群文件
func (*Ctx) DeleteThisGroupFileFolder ¶
DeleteThisGroupFileFolder 删除本群文件目录
func (*Ctx) DeleteThisGroupNotice ¶
DeleteThisGroupNotice 删除本群公告
func (*Ctx) DownloadFile ¶
DownloadFile 下载文件到本地临时目录
func (*Ctx) FetchCustomFace ¶
FetchCustomFace 获取自定义表情
func (*Ctx) ForwardFriendSingleMessage ¶
func (ctx *Ctx) ForwardFriendSingleMessage(userID int64, messageID interface{}) (APIResponse, error)
ForwardFriendSingleMessage 转发单条消息到好友
func (*Ctx) ForwardGroupSingleMessage ¶
func (ctx *Ctx) ForwardGroupSingleMessage(groupID int64, messageID interface{}) (APIResponse, error)
ForwardGroupSingleMessage 转发单条消息到群
func (*Ctx) FriendPoke ¶
FriendPoke 私聊戳一戳
https://napneko.github.io/develop/api/doc#friend-poke-%E7%A7%81%E8%81%8A%E6%88%B3%E4%B8%80%E6%88%B3
func (*Ctx) FutureEvent ¶
func (ctx *Ctx) FutureEvent(typ string, rule ...Rule) *FutureEvent
FutureEvent ...
func (*Ctx) GetAICharacters ¶
GetAICharacters 获取AI语音角色列表
func (*Ctx) GetAIRecord ¶
func (ctx *Ctx) GetAIRecord(character string, groupID int64, text string) (APIResult[string], error)
GetAIRecord AI文字转语音
func (*Ctx) GetCSRFToken ¶
GetCSRFToken 获取 CSRF Token
func (*Ctx) GetClientKey ¶
GetClientKey 获取当前登录帐号的 ClientKey
func (*Ctx) GetCollectionList ¶
GetCollectionList 获取收藏
https://napneko.github.io/develop/api/doc#get-collection-list-%E8%8E%B7%E5%8F%96%E6%94%B6%E8%97%8F
func (*Ctx) GetCookies ¶
GetCookies 获取指定域名的 Cookies
func (*Ctx) GetCredentials ¶
GetCredentials 获取登录凭证(Cookies + CSRF Token)
func (*Ctx) GetDoubtFriendsAddRequest ¶
GetDoubtFriendsAddRequest 获取可疑好友申请列表
func (*Ctx) GetEmojiLikeList ¶
func (ctx *Ctx) GetEmojiLikeList(messageID interface{}, emojiID string, count int) (APIResult[gjson.Result], error)
GetEmojiLikeList 获取消息表情点赞列表
func (*Ctx) GetForwardMessage ¶
GetForwardMessage 获取合并转发消息 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_forward_msg-%E8%8E%B7%E5%8F%96%E5%90%88%E5%B9%B6%E8%BD%AC%E5%8F%91%E6%B6%88%E6%81%AF
func (*Ctx) GetFriendList ¶
GetFriendList 获取好友列表 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_friend_list-%E8%8E%B7%E5%8F%96%E5%A5%BD%E5%8F%8B%E5%88%97%E8%A1%A8
func (*Ctx) GetFriendMessageHistory ¶
func (ctx *Ctx) GetFriendMessageHistory(userID, messageSeq string, count int, reverseOrder bool) (APIResult[gjson.Result], error)
GetFriendMessageHistory 获取私聊历史记录
func (*Ctx) GetFriendsWithCategory ¶
GetFriendsWithCategory 获取分类的好友列表
func (*Ctx) GetGroupAlbumList ¶
GetGroupAlbumList 获取群相册列表
func (*Ctx) GetGroupAlbumMediaList ¶
func (ctx *Ctx) GetGroupAlbumMediaList(groupID int64, albumID string) (APIResult[gjson.Result], error)
GetGroupAlbumMediaList 获取群相册媒体列表
func (*Ctx) GetGroupAtAllRemain ¶
GetGroupAtAllRemain 获取群@全体成员剩余次数 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E8%8E%B7%E5%8F%96%E7%BE%A4%E5%85%A8%E4%BD%93%E6%88%90%E5%91%98%E5%89%A9%E4%BD%99%E6%AC%A1%E6%95%B0
func (*Ctx) GetGroupEssenceMessageList ¶
GetGroupEssenceMessageList 获取群精华消息列表 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E8%8E%B7%E5%8F%96%E7%B2%BE%E5%8D%8E%E6%B6%88%E6%81%AF%E5%88%97%E8%A1%A8
func (*Ctx) GetGroupFileURL ¶
GetGroupFileURL 获取群文件资源链接 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%96%87%E4%BB%B6%E8%B5%84%E6%BA%90%E9%93%BE%E6%8E%A5
func (*Ctx) GetGroupFilesByFolder ¶
func (ctx *Ctx) GetGroupFilesByFolder(groupID int64, folderID string) (APIResult[gjson.Result], error)
GetGroupFilesByFolder 获取群子目录文件列表 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E8%8E%B7%E5%8F%96%E7%BE%A4%E5%AD%90%E7%9B%AE%E5%BD%95%E6%96%87%E4%BB%B6%E5%88%97%E8%A1%A8
func (*Ctx) GetGroupFilesystemInfo ¶
GetGroupFilesystemInfo 获取群文件系统信息 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F%E4%BF%A1%E6%81%AF
func (*Ctx) GetGroupHonorInfo ¶
GetGroupHonorInfo 获取群荣誉信息 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_group_honor_info-%E8%8E%B7%E5%8F%96%E7%BE%A4%E8%8D%A3%E8%AA%89%E4%BF%A1%E6%81%AF
func (*Ctx) GetGroupIgnoredNotifies ¶
GetGroupIgnoredNotifies 获取群忽略通知(被忽略的入群申请和邀请)
func (*Ctx) GetGroupInfo ¶
GetGroupInfo 获取群信息 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_group_info-%E8%8E%B7%E5%8F%96%E7%BE%A4%E4%BF%A1%E6%81%AF
func (*Ctx) GetGroupInfoEx ¶
GetGroupInfoEx 获取群详细信息(扩展)
func (*Ctx) GetGroupList ¶
GetGroupList 获取群列表 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_group_list-%E8%8E%B7%E5%8F%96%E7%BE%A4%E5%88%97%E8%A1%A8
func (*Ctx) GetGroupMemberInfo ¶
func (ctx *Ctx) GetGroupMemberInfo(groupID int64, userID int64, noCache bool) (APIResult[gjson.Result], error)
GetGroupMemberInfo 获取群成员信息 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_group_member_info-%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%88%90%E5%91%98%E4%BF%A1%E6%81%AF
func (*Ctx) GetGroupMemberList ¶
GetGroupMemberList 获取群成员列表 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_group_member_list-%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%88%90%E5%91%98%E5%88%97%E8%A1%A8
func (*Ctx) GetGroupMemberListNoCache ¶
GetGroupMemberListNoCache 无缓存获取群员列表 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_group_member_list-%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%88%90%E5%91%98%E5%88%97%E8%A1%A8
func (*Ctx) GetGroupMessageHistory ¶
func (ctx *Ctx) GetGroupMessageHistory(groupID, messageID, count int64, reverseOrder bool) (APIResult[gjson.Result], error)
GetGroupMessageHistory 获取群消息历史记录 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%B6%88%E6%81%AF%E5%8E%86%E5%8F%B2%E8%AE%B0%E5%BD%95 https://napcat.apifox.cn/226657401e0
messageID: 起始消息序号, 可通过 get_msg 获得, 添加count和reverseOrder参数
func (*Ctx) GetGroupNotice ¶
GetGroupNotice 获取群公告列表
func (*Ctx) GetGroupRootFiles ¶
GetGroupRootFiles 获取群根目录文件列表 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%A0%B9%E7%9B%AE%E5%BD%95%E6%96%87%E4%BB%B6%E5%88%97%E8%A1%A8
func (*Ctx) GetGroupShutList ¶
GetGroupShutList 获取群禁言列表
func (*Ctx) GetGroupSystemMessage ¶
GetGroupSystemMessage 获取群系统消息 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E8%8E%B7%E5%8F%96%E7%BE%A4%E7%B3%BB%E7%BB%9F%E6%B6%88%E6%81%AF
func (*Ctx) GetGuildList ¶
GetGuildList 获取频道列表
func (*Ctx) GetGuildServiceProfile ¶
GetGuildServiceProfile 获取频道个人信息
func (*Ctx) GetImage ¶
GetImage 获取图片 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_image-%E8%8E%B7%E5%8F%96%E5%9B%BE%E7%89%87
func (*Ctx) GetLatestGroupMessageHistory ¶
func (ctx *Ctx) GetLatestGroupMessageHistory(groupID, count int64, reverseOrder bool) (APIResult[gjson.Result], error)
GettLatestGroupMessageHistory 获取最新群消息历史记录
func (*Ctx) GetLatestThisGroupMessageHistory ¶
func (ctx *Ctx) GetLatestThisGroupMessageHistory(count int64, reverseOrder bool) (APIResult[gjson.Result], error)
GettLatestThisGroupMessageHistory 获取最新本群消息历史记录
func (*Ctx) GetLoginInfo ¶
GetLoginInfo 获取登录号信息 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_login_info-%E8%8E%B7%E5%8F%96%E7%99%BB%E5%BD%95%E5%8F%B7%E4%BF%A1%E6%81%AF
func (*Ctx) GetMessage ¶
GetMessage 获取消息 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_msg-%E8%8E%B7%E5%8F%96%E6%B6%88%E6%81%AF
func (*Ctx) GetMiniAppArk ¶
func (ctx *Ctx) GetMiniAppArk(appID, title, desc, iconURL, webURL string) (APIResult[gjson.Result], error)
GetMiniAppArk 获取小程序 Ark
func (*Ctx) GetOnlineClients ¶
GetOnlineClients 获取当前账号在线客户端列表 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E8%B4%A6%E5%8F%B7%E5%9C%A8%E7%BA%BF%E5%AE%A2%E6%88%B7%E7%AB%AF%E5%88%97%E8%A1%A8
func (*Ctx) GetPacketStatus ¶
GetPacketStatus 获取Packet状态
func (*Ctx) GetPrivateFileURL ¶
GetPrivateFileURL 获取私聊文件下载链接
func (*Ctx) GetProfileLike ¶
GetProfileLike 获取自身点赞列表
func (*Ctx) GetRKeyServer ¶
GetRKeyServer 获取RKey服务器
func (*Ctx) GetRecentContact ¶
GetRecentContact 获取私聊历史记录
func (*Ctx) GetRecord ¶
GetRecord 获取语音 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_record-%E8%8E%B7%E5%8F%96%E8%AF%AD%E9%9F%B3
func (*Ctx) GetRobotUinRange ¶
GetRobotUinRange 获取机器人账号范围
func (*Ctx) GetStrangerInfo ¶
GetStrangerInfo 获取陌生人信息 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_stranger_info-%E8%8E%B7%E5%8F%96%E9%99%8C%E7%94%9F%E4%BA%BA%E4%BF%A1%E6%81%AF
func (*Ctx) GetThisGroupAtAllRemain ¶
GetThisGroupAtAllRemain 获取本群@全体成员剩余次数 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E8%8E%B7%E5%8F%96%E7%BE%A4%E5%85%A8%E4%BD%93%E6%88%90%E5%91%98%E5%89%A9%E4%BD%99%E6%AC%A1%E6%95%B0
func (*Ctx) GetThisGroupEssenceMessageList ¶
GetThisGroupEssenceMessageList 获取本群精华消息列表
func (*Ctx) GetThisGroupFileURL ¶
GetThisGroupFileURL 获取本群文件资源链接 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%96%87%E4%BB%B6%E8%B5%84%E6%BA%90%E9%93%BE%E6%8E%A5
func (*Ctx) GetThisGroupFilesByFolder ¶
GetThisGroupFilesByFolder 获取本群子目录文件列表 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E8%8E%B7%E5%8F%96%E7%BE%A4%E5%AD%90%E7%9B%AE%E5%BD%95%E6%96%87%E4%BB%B6%E5%88%97%E8%A1%A8
func (*Ctx) GetThisGroupFilesystemInfo ¶
GetThisGroupFilesystemInfo 获取本群文件系统信息 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F%E4%BF%A1%E6%81%AF
func (*Ctx) GetThisGroupHonorInfo ¶
GetThisGroupHonorInfo 获取本群荣誉信息 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_group_honor_info-%E8%8E%B7%E5%8F%96%E7%BE%A4%E8%8D%A3%E8%AA%89%E4%BF%A1%E6%81%AF
func (*Ctx) GetThisGroupIgnoredNotifies ¶
GetThisGroupIgnoredNotifies 获取本群忽略通知
func (*Ctx) GetThisGroupInfo ¶
GetThisGroupInfo 获取本群信息 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_group_info-%E8%8E%B7%E5%8F%96%E7%BE%A4%E4%BF%A1%E6%81%AF
func (*Ctx) GetThisGroupInfoEx ¶
GetThisGroupInfoEx 获取本群详细信息(扩展)
func (*Ctx) GetThisGroupMemberInfo ¶
GetThisGroupMemberInfo 获取本群成员信息 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_group_member_info-%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%88%90%E5%91%98%E4%BF%A1%E6%81%AF
func (*Ctx) GetThisGroupMemberList ¶
GetThisGroupMemberList 获取本群成员列表
func (*Ctx) GetThisGroupMemberListNoCache ¶
GetThisGroupMemberListNoCache 无缓存获取本群员列表
func (*Ctx) GetThisGroupMessageHistory ¶
func (ctx *Ctx) GetThisGroupMessageHistory(messageID, count int64, reverseOrder bool) (APIResult[gjson.Result], error)
GetThisGroupMessageHistory 获取本群消息历史记录
messageID: 起始消息序号, 可通过 get_msg 获得
func (*Ctx) GetThisGroupNotice ¶
GetThisGroupNotice 获取本群公告列表
func (*Ctx) GetThisGroupRootFiles ¶
GetThisGroupRootFiles 获取本群根目录文件列表 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E8%8E%B7%E5%8F%96%E7%BE%A4%E6%A0%B9%E7%9B%AE%E5%BD%95%E6%96%87%E4%BB%B6%E5%88%97%E8%A1%A8
func (*Ctx) GetThisGroupShutList ¶
GetThisGroupShutList 获取本群禁言列表
func (*Ctx) GetUnidirectionalFriendList ¶
GetUnidirectionalFriendList 获取单向好友列表
func (*Ctx) GetUserStatus ¶
GetUserStatus 获取用户在线状态
https://napcat.apifox.cn/226659292e0.md
返回 data: status(在线状态), ext_status(扩展状态)
func (*Ctx) GetVersionInfo ¶
GetVersionInfo 获取运行状态 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#get_status-%E8%8E%B7%E5%8F%96%E8%BF%90%E8%A1%8C%E7%8A%B6%E6%80%81
func (*Ctx) GetWordSlices ¶
GetWordSlices 获取中文分词 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E8%8E%B7%E5%8F%96%E4%B8%AD%E6%96%87%E5%88%86%E8%AF%8D
func (*Ctx) GroupKickBatch ¶
func (ctx *Ctx) GroupKickBatch(groupID int64, userIDs []int64, rejectAddRequest bool) (APIResult[struct{}], error)
GroupKickBatch 批量踢出群成员
func (*Ctx) GroupPoke ¶
GroupPoke 群聊戳一戳
https://napneko.github.io/develop/api/doc#group-poke-%E7%BE%A4%E8%81%8A%E6%88%B3%E4%B8%80%E6%88%B3
func (*Ctx) LikeGroupAlbumMedia ¶
func (ctx *Ctx) LikeGroupAlbumMedia(groupID int64, albumID, mediaID string) (APIResult[struct{}], error)
LikeGroupAlbumMedia 点赞群相册媒体
func (*Ctx) MarkAllAsRead ¶
MarkAllAsRead 标记所有已读
func (*Ctx) MarkGroupMessageAsRead ¶
MarkGroupMessageAsRead 设置群聊已读
func (*Ctx) MarkMessageAsRead ¶
func (ctx *Ctx) MarkMessageAsRead(messageID int64) (APIResponse, error)
MarkMessageAsRead 标记消息已读 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E6%A0%87%E8%AE%B0%E6%B6%88%E6%81%AF%E5%B7%B2%E8%AF%BB
func (*Ctx) MarkPrivateMessageAsRead ¶
MarkPrivateMessageAsRead 设置私聊已读
func (*Ctx) MarkThisMessageAsRead ¶
func (ctx *Ctx) MarkThisMessageAsRead() (APIResponse, error)
MarkThisMessageAsRead 标记本消息已读 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E6%A0%87%E8%AE%B0%E6%B6%88%E6%81%AF%E5%B7%B2%E8%AF%BB
func (*Ctx) MoveGroupFile ¶
func (ctx *Ctx) MoveGroupFile(groupID int64, fileID, parentFolderID, targetFolderID string) (APIResult[struct{}], error)
MoveGroupFile 移动群文件
func (*Ctx) OCRImage ¶
OCRImage 图片OCR https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E5%9B%BE%E7%89%87ocr
func (*Ctx) RenameGroupFile ¶
RenameGroupFile 重命名群文件
func (*Ctx) SendForwardMessage ¶
func (ctx *Ctx) SendForwardMessage(messageType string, userID, groupID int64, messages message.Message) (messageID int64, resID string, err error)
SendForwardMessage 发送合并转发
func (*Ctx) SendGroupAIRecord ¶
func (ctx *Ctx) SendGroupAIRecord(character string, groupID int64, text string) (APIResult[string], error)
SendGroupAIRecord 群聊发送AI语音
func (*Ctx) SendGroupCustomMusic ¶
func (ctx *Ctx) SendGroupCustomMusic(groupID int64, url, audio, title string) (APIResult[int64], error)
SendGroupCustomMusic 发送群聊自定义音乐卡片
func (*Ctx) SendGroupForwardMessage ¶
func (ctx *Ctx) SendGroupForwardMessage(groupID int64, message message.Message) (APIResult[gjson.Result], error)
SendGroupForwardMessage 发送合并转发(群) https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E5%9B%BE%E7%89%87ocr
func (*Ctx) SendGroupMessage ¶
SendGroupMessage 发送群消息 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#send_group_msg-%E5%8F%91%E9%80%81%E7%BE%A4%E6%B6%88%E6%81%AF
func (*Ctx) SendGroupNotice ¶
func (ctx *Ctx) SendGroupNotice(groupID int64, content, image string, pinned int) (APIResult[struct{}], error)
SendGroupNotice 发送群公告
func (*Ctx) SendGuildChannelMessage ¶
func (ctx *Ctx) SendGuildChannelMessage(guildID, channelID string, message interface{}) (APIResult[string], error)
SendGuildChannelMessage 发送频道消息
func (*Ctx) SendLike ¶
SendLike 发送好友赞 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#send_like-%E5%8F%91%E9%80%81%E5%A5%BD%E5%8F%8B%E8%B5%9E
func (*Ctx) SendPrivateForwardMessage ¶
func (ctx *Ctx) SendPrivateForwardMessage(userID int64, message message.Message) (APIResult[gjson.Result], error)
SendPrivateForwardMessage 发送合并转发(私聊) https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E5%9B%BE%E7%89%87ocr
func (*Ctx) SendPrivateMessage ¶
SendPrivateMessage 发送私聊消息 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#send_private_msg-%E5%8F%91%E9%80%81%E7%A7%81%E8%81%8A%E6%B6%88%E6%81%AF
func (*Ctx) SendThisGroupNotice ¶
SendThisGroupNotice 发送本群公告
func (*Ctx) SetCustomOnlineStatus ¶
func (ctx *Ctx) SetCustomOnlineStatus(faceID int, faceType int, wording string) (APIResult[struct{}], error)
SetCustomOnlineStatus 设置自定义在线状态
func (*Ctx) SetDoubtFriendsAddRequest ¶
func (ctx *Ctx) SetDoubtFriendsAddRequest(flag string, approve bool, remark string) (APIResult[struct{}], error)
SetDoubtFriendsAddRequest 处理可疑好友申请
func (*Ctx) SetFriendAddRequest ¶
func (ctx *Ctx) SetFriendAddRequest(flag string, approve bool, remark string) (APIResult[struct{}], error)
SetFriendAddRequest 处理加好友请求 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_friend_add_request-%E5%A4%84%E7%90%86%E5%8A%A0%E5%A5%BD%E5%8F%8B%E8%AF%B7%E6%B1%82
func (*Ctx) SetFriendRemark ¶
SetFriendRemark 设置好友备注
func (*Ctx) SetGroupAddOption ¶
SetGroupAddOption 设置群加群选项
func (*Ctx) SetGroupAddRequest ¶
func (ctx *Ctx) SetGroupAddRequest(flag string, subType string, approve bool, reason string) (APIResult[struct{}], error)
SetGroupAddRequest 处理加群请求/邀请 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_add_request-%E5%A4%84%E7%90%86%E5%8A%A0%E7%BE%A4%E8%AF%B7%E6%B1%82%E9%82%80%E8%AF%B7
func (*Ctx) SetGroupAdmin ¶
SetGroupAdmin 群组设置管理员 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_whole_ban-%E7%BE%A4%E7%BB%84%E5%85%A8%E5%91%98%E7%A6%81%E8%A8%80
func (*Ctx) SetGroupAnonymous ¶
SetGroupAnonymous 群组匿名 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_anonymous-%E7%BE%A4%E7%BB%84%E5%8C%BF%E5%90%8D
func (*Ctx) SetGroupBan ¶
SetGroupBan 群组单人禁言 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_ban-%E7%BE%A4%E7%BB%84%E5%8D%95%E4%BA%BA%E7%A6%81%E8%A8%80
func (*Ctx) SetGroupCard ¶
SetGroupCard 设置群名片(群备注) https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_card-%E8%AE%BE%E7%BD%AE%E7%BE%A4%E5%90%8D%E7%89%87%E7%BE%A4%E5%A4%87%E6%B3%A8
func (*Ctx) SetGroupEssenceMessage ¶
func (ctx *Ctx) SetGroupEssenceMessage(messageID int64) (APIResponse, error)
SetGroupEssenceMessage 设置群精华消息 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E8%AE%BE%E7%BD%AE%E7%B2%BE%E5%8D%8E%E6%B6%88%E6%81%AF
func (*Ctx) SetGroupKick ¶
func (ctx *Ctx) SetGroupKick(groupID, userID int64, rejectAddRequest bool) (APIResult[struct{}], error)
SetGroupKick 群组踢人 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_kick-%E7%BE%A4%E7%BB%84%E8%B8%A2%E4%BA%BA
func (*Ctx) SetGroupLeave ¶
SetGroupLeave 退出群组 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_leave-%E9%80%80%E5%87%BA%E7%BE%A4%E7%BB%84
func (*Ctx) SetGroupName ¶
SetGroupName 设置群名 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_name-%E8%AE%BE%E7%BD%AE%E7%BE%A4%E5%90%8D
func (*Ctx) SetGroupPortrait ¶
SetGroupPortrait 设置群头像 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E8%AE%BE%E7%BD%AE%E7%BE%A4%E5%A4%B4%E5%83%8F
func (*Ctx) SetGroupRemark ¶
SetGroupRemark 设置群备注
func (*Ctx) SetGroupSearchOption ¶
SetGroupSearchOption 设置群搜索选项
func (*Ctx) SetGroupSign ¶
SetGroupSign 群签到
https://napneko.github.io/develop/api/doc#set-group-sign-%E7%BE%A4%E7%AD%BE%E5%88%B0
func (*Ctx) SetGroupSpecialTitle ¶
func (ctx *Ctx) SetGroupSpecialTitle(groupID, userID int64, specialTitle string) (APIResult[struct{}], error)
SetGroupSpecialTitle 设置群组专属头衔 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_special_title-%E8%AE%BE%E7%BD%AE%E7%BE%A4%E7%BB%84%E4%B8%93%E5%B1%9E%E5%A4%B4%E8%A1%94
func (*Ctx) SetGroupTodo ¶
SetGroupTodo 设置群待办
func (*Ctx) SetGroupWholeBan ¶
SetGroupWholeBan 群组全员禁言 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_whole_ban-%E7%BE%A4%E7%BB%84%E5%85%A8%E5%91%98%E7%A6%81%E8%A8%80
func (*Ctx) SetInputStatus ¶
SetInputStatus 设置输入状态
https://napcat.apifox.cn/226659225e0.md
eventType: 事件类型
func (*Ctx) SetMessageEmojiLike ¶
SetMessageEmojiLike 发送表情回应
https://llonebot.github.io/zh-CN/develop/extends_api
emoji_id 参考 https://bot.q.qq.com/wiki/develop/api-v2/openapi/emoji/model.html#EmojiType
func (*Ctx) SetMyAvatar ¶
func (ctx *Ctx) SetMyAvatar(file string) (APIResponse, error)
SetMyAvatar 设置我的头像
func (*Ctx) SetOnlineStatus ¶
SetOnlineStatus 设置在线状态
func (*Ctx) SetQQProfile ¶
SetQQProfile 设置QQ资料(昵称、个性签名、性别)
https://napcat.apifox.cn/226657374e0.md
sex: 0=未知, 1=男, 2=女
func (*Ctx) SetSelfLongNick ¶
SetSelfLongNick 设置签名
https://napneko.github.io/develop/api/doc#set-self-longnick-%E8%AE%BE%E7%BD%AE%E7%AD%BE%E5%90%8D
func (*Ctx) SetThisGroupAdmin ¶
SetThisGroupAdmin 本群组设置管理员 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_whole_ban-%E7%BE%A4%E7%BB%84%E5%85%A8%E5%91%98%E7%A6%81%E8%A8%80
func (*Ctx) SetThisGroupAnonymous ¶
SetThisGroupAnonymous 群组匿名 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_anonymous-%E7%BE%A4%E7%BB%84%E5%8C%BF%E5%90%8D
func (*Ctx) SetThisGroupBan ¶
SetThisGroupBan 本群组单人禁言 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_ban-%E7%BE%A4%E7%BB%84%E5%8D%95%E4%BA%BA%E7%A6%81%E8%A8%80
func (*Ctx) SetThisGroupCard ¶
SetThisGroupCard 设置本群名片(群备注) https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_card-%E8%AE%BE%E7%BD%AE%E7%BE%A4%E5%90%8D%E7%89%87%E7%BE%A4%E5%A4%87%E6%B3%A8
func (*Ctx) SetThisGroupKick ¶
SetThisGroupKick 本群组踢人 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_kick-%E7%BE%A4%E7%BB%84%E8%B8%A2%E4%BA%BA
func (*Ctx) SetThisGroupLeave ¶
SetThisGroupLeave 退出本群组 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_leave-%E9%80%80%E5%87%BA%E7%BE%A4%E7%BB%84
func (*Ctx) SetThisGroupName ¶
SetThisGroupName 设置本群名 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_name-%E8%AE%BE%E7%BD%AE%E7%BE%A4%E5%90%8D
func (*Ctx) SetThisGroupPortrait ¶
SetThisGroupPortrait 设置本群头像 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E8%AE%BE%E7%BD%AE%E7%BE%A4%E5%A4%B4%E5%83%8F
func (*Ctx) SetThisGroupRemark ¶
SetThisGroupRemark 设置本群备注
func (*Ctx) SetThisGroupSpecialTitle ¶
func (ctx *Ctx) SetThisGroupSpecialTitle(userID int64, specialTitle string) (APIResult[struct{}], error)
SetThisGroupSpecialTitle 设置本群组专属头衔 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_special_title-%E8%AE%BE%E7%BD%AE%E7%BE%A4%E7%BB%84%E4%B8%93%E5%B1%9E%E5%A4%B4%E8%A1%94
func (*Ctx) SetThisGroupTodo ¶
SetThisGroupTodo 设置本群待办
func (*Ctx) SetThisGroupWholeBan ¶
SetThisGroupWholeBan 本群组全员禁言 https://github.com/botuniverse/onebot-11/blob/master/api/public.md#set_group_whole_ban-%E7%BE%A4%E7%BB%84%E5%85%A8%E5%91%98%E7%A6%81%E8%A8%80
func (*Ctx) TransGroupFile ¶
func (ctx *Ctx) TransGroupFile(groupID int64, fileID, targetGroupID string) (APIResult[struct{}], error)
TransGroupFile 传输群文件
func (*Ctx) TranslateEn2Zh ¶
TranslateEn2Zh 英译中
https://napneko.github.io/develop/api/doc#translate-en2zh-%E8%8B%B1%E8%AF%91%E4%B8%AD
func (*Ctx) UploadGroupAlbum ¶
func (ctx *Ctx) UploadGroupAlbum(groupID int64, albumID, file string) (APIResult[gjson.Result], error)
UploadGroupAlbum 上传图片到群相册
func (*Ctx) UploadGroupFile ¶
func (ctx *Ctx) UploadGroupFile(groupID int64, file, name, folder string) (APIResponse, error)
UploadGroupFile 上传群文件 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E4%B8%8A%E4%BC%A0%E7%BE%A4%E6%96%87%E4%BB%B6
msg: FILE_NOT_FOUND FILE_SYSTEM_UPLOAD_API_ERROR ...
func (*Ctx) UploadPrivateFile ¶
UploadPrivateFile 上传私聊文件
func (*Ctx) UploadThisGroupFile ¶
func (ctx *Ctx) UploadThisGroupFile(file, name, folder string) (APIResponse, error)
UploadThisGroupFile 上传本群文件 https://github.com/Mrs4s/go-cqhttp/blob/master/docs/cqhttp.md#%E4%B8%8A%E4%BC%A0%E7%BE%A4%E6%96%87%E4%BB%B6
msg: FILE_NOT_FOUND FILE_SYSTEM_UPLOAD_API_ERROR ...
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is the pre_handler, post_handler manager
func (*Engine) OnCommandGroup ¶
OnCommandGroup 命令触发器组
func (*Engine) OnFullMatch ¶
OnFullMatch 完全匹配触发器
func (*Engine) OnFullMatchGroup ¶
OnFullMatchGroup 完全匹配触发器组
func (*Engine) OnKeywordGroup ¶
OnKeywordGroup 关键词触发器组
func (*Engine) OnMetaEvent ¶
OnMetaEvent 元事件触发器
func (*Engine) OnPrefixGroup ¶
OnPrefixGroup 前缀触发器组
func (*Engine) OnSuffixGroup ¶
OnSuffixGroup 后缀触发器组
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 {
Time int64 `json:"time"`
PostType string `json:"post_type"`
DetailType string `json:"-"`
MessageType string `json:"message_type"`
SubType string `json:"sub_type"`
MessageID interface{} `json:"-"` // int64 in qq or string in guild
RawMessageID json.RawMessage `json:"message_id"` // int64 in qq or string in guild
GroupID int64 `json:"group_id"`
ChannelID string `json:"channel_id"`
GuildID string `json:"guild_id"`
UserID int64 `json:"user_id"`
TinyID string `json:"tiny_id"`
TargetID int64 `json:"target_id"`
SelfID int64 `json:"self_id"`
SelfTinyID string `json:"self_tiny_id"`
RawMessage string `json:"raw_message"` // raw_message is always string
Anonymous interface{} `json:"anonymous"`
AnonymousFlag string `json:"anonymous_flag"` // This field is deprecated and will get removed, see #11
Event string `json:"event"`
NoticeType string `json:"notice_type"` // This field is deprecated and will get removed, see #11
OperatorID int64 `json:"operator_id"` // This field is used for Notice Event
File *File `json:"file"`
RequestType string `json:"request_type"`
Flag string `json:"flag"`
Comment string `json:"comment"` // This field is used for Request Event
Message message.Message `json:"-"` // Message parsed
Sender *User `json:"sender"`
NativeMessage json.RawMessage `json:"message"`
IsToMe bool `json:"-"`
RawEvent gjson.Result `json:"-"` // raw event
}
Event is the event emitted form cqhttp
type File ¶
type File struct {
ID string `json:"id"`
Name string `json:"name"`
Size int64 `json:"size"`
BusID int64 `json:"busid,omitempty"`
}
File 文件
type FutureEvent ¶
FutureEvent 是 ZeroBot 交互式的核心,用于异步获取指定事件
func NewFutureEvent ¶
func NewFutureEvent(typ 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 Group ¶
type Group struct {
ID int64 `json:"group_id"`
Name string `json:"group_name"`
MemberCount int64 `json:"member_count"`
MaxMemberCount int64 `json:"max_member_count"`
}
Group 群
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
// NoTimeout 处理是否不设超时
NoTimeout bool
// Priority 优先级,越小优先级越高
Priority int
// Event 当前匹配到的事件
Event *Event
// Type 匹配的事件类型
Type Rule
// Rules 匹配规则
Rules []Rule
// Handler 处理事件的函数
Handler []Handler
// Engine 注册 Matcher 的 Engine,Engine可为一系列 Matcher 添加通用 Rule 和 其他钩子
Engine *Engine
}
Matcher 是 ZeroBot 匹配和处理事件的最小单元
func OnCommandGroup ¶
OnCommandGroup 命令触发器组
func OnFullMatchGroup ¶
OnFullMatchGroup 完全匹配触发器组
func OnKeywordGroup ¶
OnKeywordGroup 关键词触发器组
func OnPrefixGroup ¶
OnPrefixGroup 前缀触发器组
func OnSuffixGroup ¶
OnSuffixGroup 后缀触发器组
func StoreMatcher ¶
StoreMatcher store a matcher to matcher list.
func StoreTempMatcher ¶
StoreTempMatcher store a matcher only triggered once.
func (*Matcher) BindEngine ¶
BindEngine bind the matcher to a engine
func (*Matcher) FirstPriority ¶
FirstPriority 设置当前 Matcher 优先级 - 0
func (*Matcher) FutureEvent ¶
func (m *Matcher) FutureEvent(typ string, rule ...Rule) *FutureEvent
FutureEvent 返回一个 FutureEvent 实例指针,用于获取满足 Rule 的 未来事件
此 FutureEvent 必然比 Matcher 之优先级少 1
func (*Matcher) SecondPriority ¶
SecondPriority 设置当前 Matcher 优先级 - 1
func (*Matcher) SetPriority ¶
SetPriority 设置当前 Matcher 优先级
func (*Matcher) ThirdPriority ¶
ThirdPriority 设置当前 Matcher 优先级 - 2
type Message ¶
type Message struct {
Elements message.Message
MessageID message.ID
Sender *User
MessageType string
}
Message 消息
type Parser ¶
type Parser func(msg *message.Segment) PatternParsed
func NewAnyParser ¶
func NewAnyParser() Parser
func NewAtParser ¶
func NewImageParser ¶
func NewImageParser() Parser
func NewReplyParser ¶
func NewReplyParser() Parser
func NewTextParser ¶
type Pattern ¶
type Pattern struct {
// contains filtered or unexported fields
}
func NewPattern ¶
func NewPattern(option *PatternOption) *Pattern
NewPattern new pattern defaults:
CleanRedundantAt: true FuzzyAt: false
func (*Pattern) At ¶
At use regex to match an 'at' segment, if id is not empty, only match specific target
func (*Pattern) Image ¶
Image use regex to match an 'at' segment, if id is not empty, only match specific target
func (*Pattern) SetOptional ¶
SetOptional set previous segment is optional, is v is empty, optional will be true if Pattern is empty, panic
type PatternOption ¶
PatternOption pattern option
type PatternParsed ¶
type PatternParsed struct {
// contains filtered or unexported fields
}
PatternParsed PatternRule parse result
type PatternSegment ¶
type PatternSegment struct {
// contains filtered or unexported fields
}
type Rule ¶
Rule filter the event
func CommandRule ¶
CommandRule check if the message is a command and trim the command name
func FullMatchRule ¶
FullMatchRule check if src has the same copy of the message
func KeywordRule ¶
KeywordRule check if the message has a keyword or keywords
type User ¶
type User struct {
// Private sender
// https://github.com/botuniverse/onebot-11/blob/master/event/message.md#%E7%A7%81%E8%81%8A%E6%B6%88%E6%81%AF
ID int64 `json:"user_id"`
TinyID string `json:"tiny_id,omitempty"` // TinyID 在 guild 下为 ID 的 string
NickName string `json:"nickname,omitempty"`
Sex string `json:"sex,omitempty"` // "male"、"female"、"unknown"
Age int `json:"age"`
Area string `json:"area,omitempty"`
// Group member
// https://github.com/botuniverse/onebot-11/blob/master/event/message.md#%E7%BE%A4%E6%B6%88%E6%81%AF
Card string `json:"card,omitempty"`
Title string `json:"title,omitempty"`
Level string `json:"level,omitempty"`
Role string `json:"role,omitempty"` // "owner"、"admin"、"member"
// Group anonymous
AnonymousID int64 `json:"anonymous_id,omitempty" anonymous:"id"`
AnonymousName string `json:"anonymous_name,omitempty" anonymous:"name"`
AnonymousFlag string `json:"anonymous_flag,omitempty" anonymous:"flag"`
}
User is a user on QQ.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package driver provides the default driver of zerobot
|
Package driver provides the default driver of zerobot |
|
manager
Package manager provides a simple group plugin Manager.
|
Package manager provides a simple group plugin Manager. |
|
kv
Package kv provides a simple wrap of goleveldb for multi bucket database
|
Package kv provides a simple wrap of goleveldb for multi bucket database |
|
rate
Package rate provides a rate limiter hooker, this package is based on golang.org/x/time/rate
|
Package rate provides a rate limiter hooker, this package is based on golang.org/x/time/rate |
|
utils
|
|