Documentation ¶
Index ¶
- Constants
- type App
- type At
- type AtAll
- type Bot
- func (b *Bot) About() (string, error)
- func (b *Bot) BotList() ([]int64, error)
- func (b *Bot) BotProfile() (*Profile, error)
- func (b *Bot) FileDelete(param FileParam) error
- func (b *Bot) FileMkdir(param FileParam) (*FileInfo, error)
- func (b *Bot) FileMove(param FileParam) error
- func (b *Bot) FileRename(param FileParam) error
- func (b *Bot) FriendList() ([]*Friend, error)
- func (b *Bot) FriendProfile(qq int64) (*Profile, error)
- func (b *Bot) GetFileInfo(param FileParam) (*FileInfo, error)
- func (b *Bot) GetFileList(param FileParam) ([]*FileInfo, error)
- func (b *Bot) GetGroupConfig(group int64) (*GroupConfig, error)
- func (b *Bot) GetMemberInfo(group, qq int64) (*Member, error)
- func (b *Bot) GroupList() ([]*Group, error)
- func (b *Bot) Kick(group, qq int64, block bool, msg string) error
- func (b *Bot) LatestMemberList(group int64, qqs []int64) ([]*Member, error)
- func (b *Bot) ListenBotGroupPermissionChangeEvent(l func(message *BotGroupPermissionChangeEvent) bool)
- func (b *Bot) ListenBotInvitedJoinGroupRequestEvent(l func(message *BotInvitedJoinGroupRequestEvent) bool)
- func (b *Bot) ListenBotJoinGroupEvent(l func(message *BotJoinGroupEvent) bool)
- func (b *Bot) ListenBotLeaveEventActive(l func(message *BotLeaveEventActive) bool)
- func (b *Bot) ListenBotLeaveEventDisband(l func(message *BotLeaveEventDisband) bool)
- func (b *Bot) ListenBotLeaveEventKick(l func(message *BotLeaveEventKick) bool)
- func (b *Bot) ListenBotMuteEvent(l func(message *BotMuteEvent) bool)
- func (b *Bot) ListenBotUnmuteEvent(l func(message *BotUnmuteEvent) bool)
- func (b *Bot) ListenFriendMessage(l func(message *FriendMessage) bool)
- func (b *Bot) ListenFriendRecallEvent(l func(message *FriendRecallEvent) bool)
- func (b *Bot) ListenFriendSyncMessage(l func(message *FriendSyncMessage) bool)
- func (b *Bot) ListenGroupAllowAnonymousChatEvent(l func(message *GroupAllowAnonymousChatEvent) bool)
- func (b *Bot) ListenGroupAllowConfessTalkEvent(l func(message *GroupAllowConfessTalkEvent) bool)
- func (b *Bot) ListenGroupAllowMemberInviteEvent(l func(message *GroupAllowMemberInviteEvent) bool)
- func (b *Bot) ListenGroupEntranceAnnouncementChangeEvent(l func(message *GroupEntranceAnnouncementChangeEvent) bool)
- func (b *Bot) ListenGroupMessage(l func(message *GroupMessage) bool)
- func (b *Bot) ListenGroupMuteAllEvent(l func(message *GroupMuteAllEvent) bool)
- func (b *Bot) ListenGroupNameChangeEvent(l func(message *GroupNameChangeEvent) bool)
- func (b *Bot) ListenGroupRecallEvent(l func(message *GroupRecallEvent) bool)
- func (b *Bot) ListenGroupSyncMessage(l func(message *GroupSyncMessage) bool)
- func (b *Bot) ListenMemberCardChangeEvent(l func(message *MemberCardChangeEvent) bool)
- func (b *Bot) ListenMemberHonorChangeEvent(l func(message *MemberHonorChangeEvent) bool)
- func (b *Bot) ListenMemberJoinEvent(l func(message *MemberJoinEvent) bool)
- func (b *Bot) ListenMemberJoinRequestEvent(l func(message *MemberJoinRequestEvent) bool)
- func (b *Bot) ListenMemberLeaveEventKick(l func(message *MemberLeaveEventKick) bool)
- func (b *Bot) ListenMemberLeaveEventQuit(l func(message *MemberLeaveEventQuit) bool)
- func (b *Bot) ListenMemberMuteEvent(l func(message *MemberMuteEvent) bool)
- func (b *Bot) ListenMemberPermissionChangeEvent(l func(message *MemberPermissionChangeEvent) bool)
- func (b *Bot) ListenMemberSpecialTitleChangeEvent(l func(message *MemberSpecialTitleChangeEvent) bool)
- func (b *Bot) ListenMemberUnmuteEvent(l func(message *MemberUnmuteEvent) bool)
- func (b *Bot) ListenNewFriendRequestEvent(l func(message *NewFriendRequestEvent) bool)
- func (b *Bot) ListenNudgeEvent(l func(message *NudgeEvent) bool)
- func (b *Bot) ListenOtherClientMessage(l func(message *OtherClientMessage) bool)
- func (b *Bot) ListenStrangerMessage(l func(message *StrangerMessage) bool)
- func (b *Bot) ListenStrangerSyncMessage(l func(message *StrangerSyncMessage) bool)
- func (b *Bot) ListenTempMessage(l func(message *TempMessage) bool)
- func (b *Bot) ListenTempSyncMessage(l func(message *TempSyncMessage) bool)
- func (b *Bot) MemberAdmin(group, qq int64, assign bool) error
- func (b *Bot) MemberList(group int64) ([]*Member, error)
- func (b *Bot) MemberProfile(group, qq int64) (*Profile, error)
- func (b *Bot) MessageFromId(messageId, target int64) (any, error)
- func (b *Bot) Mute(group, qq, time int64) error
- func (b *Bot) MuteAll(group int64) error
- func (b *Bot) Quit(group int64) error
- func (b *Bot) Recall(target, messageId int64) error
- func (b *Bot) ResponseBotInvitedJoinGroup(request *BotInvitedJoinGroupRequestEvent, operate int, message string) error
- func (b *Bot) ResponseMemberJoin(request *MemberJoinRequestEvent, operate int, message string) error
- func (b *Bot) ResponseNewFriend(request *NewFriendRequestEvent, operate int, message string) error
- func (b *Bot) RoamingMessages(timeStart, timeEnd, qq int64) ([]any, error)
- func (b *Bot) Run(f func())
- func (b *Bot) SendFriendMessage(qq, quote int64, messageChain MessageChain) (int64, error)
- func (b *Bot) SendGroupMessage(group, quote int64, messageChain MessageChain) (int64, error)
- func (b *Bot) SendNudge(qq, subject int64, kind Kind) error
- func (b *Bot) SendTempMessage(qq, group, quote int64, messageChain MessageChain) (int64, error)
- func (b *Bot) SetEssence(group, messageId int64) error
- func (b *Bot) SetLimiter(limiterType string, l *rate.Limiter)
- func (b *Bot) Unmute(group, qq int64) error
- func (b *Bot) UnmuteAll(group int64) error
- func (b *Bot) UpdateGroupConfig(group int64, groupConfig *GroupConfig) error
- func (b *Bot) UpdateMemberInfo(group, qq int64, name, specialTitle string) error
- func (b *Bot) UserProfile(qq int64) (*Profile, error)
- type BotGroupPermissionChangeEvent
- type BotInvitedJoinGroupRequestEvent
- type BotJoinGroupEvent
- type BotLeaveEventActive
- type BotLeaveEventDisband
- type BotLeaveEventKick
- type BotMuteEvent
- type BotUnmuteEvent
- type Dice
- type Face
- type File
- type FileDownloadInfo
- type FileInfo
- type FileParam
- type FlashImage
- type ForwardMessage
- type ForwardMessageNode
- type Friend
- type FriendMessage
- type FriendRecallEvent
- type FriendSyncMessage
- type Group
- type GroupAllowAnonymousChatEvent
- type GroupAllowConfessTalkEvent
- type GroupAllowMemberInviteEvent
- type GroupConfig
- type GroupEntranceAnnouncementChangeEvent
- type GroupMessage
- type GroupMuteAllEvent
- type GroupNameChangeEvent
- type GroupRecallEvent
- type GroupSyncMessage
- type HonorAction
- type Image
- type Json
- type Kind
- type MarketFace
- type Member
- type MemberCardChangeEvent
- type MemberHonorChangeEvent
- type MemberJoinEvent
- type MemberJoinRequestEvent
- type MemberLeaveEventKick
- type MemberLeaveEventQuit
- type MemberMuteEvent
- type MemberPermissionChangeEvent
- type MemberSpecialTitleChangeEvent
- type MemberUnmuteEvent
- type MessageChain
- type MiraiCode
- type MusicShare
- type NewFriendRequestEvent
- type NudgeEvent
- type OtherClient
- type OtherClientMessage
- type Perm
- type Plain
- type Poke
- type PokeName
- type Profile
- type Quote
- type Sex
- type SingleMessage
- type Source
- type StrangerMessage
- type StrangerSyncMessage
- type TempMessage
- type TempSyncMessage
- type Voice
- type WsChannel
- type Xml
Constants ¶
const ( // WsChannelMessage 推送消息 WsChannelMessage = "model" // WsChannelEvent 推送事件 WsChannelEvent = "event" // WsChannelAll 推送消息及事件 WsChannelAll = "all" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
func (*App) FillMessageType ¶
func (m *App) FillMessageType()
type At ¶
type At struct { Type string `json:"type"` Target int64 `json:"target"` // 群员QQ号 Display string `json:"display,omitempty"` // At时显示的文字,发送消息时无效,自动使用群名片 }
At @消息
func (*At) FillMessageType ¶
func (m *At) FillMessageType()
type AtAll ¶
type AtAll struct {
Type string `json:"type"`
}
AtAll @全体消息
func (*AtAll) FillMessageType ¶
func (m *AtAll) FillMessageType()
type Bot ¶
type Bot struct { QQ int64 // contains filtered or unexported fields }
func Connect ¶
func Connect(host string, port int, channel WsChannel, verifyKey string, qq int64, concurrentEvent bool) (*Bot, error)
Connect 连接mirai-api-http
concurrentEvent 参数如果是true,表示采用并发方式处理事件和消息,由调用者自行解决并发问题。 如果是false表示用单线程处理事件和消息,调用者无需关心并发问题。
func (*Bot) FriendProfile ¶
FriendProfile 获取好友资料
func (*Bot) GetFileInfo ¶
GetFileInfo 获取文件信息
func (*Bot) GetFileList ¶
GetFileList 查看文件列表
func (*Bot) GetGroupConfig ¶
func (b *Bot) GetGroupConfig(group int64) (*GroupConfig, error)
GetGroupConfig 获取群设置
func (*Bot) GetMemberInfo ¶
GetMemberInfo 获取群员设置
func (*Bot) LatestMemberList ¶
LatestMemberList 获取最新群成员列表,qqs为空表示获取所有
func (*Bot) ListenBotGroupPermissionChangeEvent ¶
func (b *Bot) ListenBotGroupPermissionChangeEvent(l func(message *BotGroupPermissionChangeEvent) bool)
ListenBotGroupPermissionChangeEvent 监听Bot在群里的权限被改变
func (*Bot) ListenBotInvitedJoinGroupRequestEvent ¶
func (b *Bot) ListenBotInvitedJoinGroupRequestEvent(l func(message *BotInvitedJoinGroupRequestEvent) bool)
ListenBotInvitedJoinGroupRequestEvent 监听Bot被邀请入群申请
func (*Bot) ListenBotJoinGroupEvent ¶
func (b *Bot) ListenBotJoinGroupEvent(l func(message *BotJoinGroupEvent) bool)
ListenBotJoinGroupEvent 监听Bot加入了一个新群
func (*Bot) ListenBotLeaveEventActive ¶
func (b *Bot) ListenBotLeaveEventActive(l func(message *BotLeaveEventActive) bool)
ListenBotLeaveEventActive 监听Bot主动退出一个群
func (*Bot) ListenBotLeaveEventDisband ¶
func (b *Bot) ListenBotLeaveEventDisband(l func(message *BotLeaveEventDisband) bool)
ListenBotLeaveEventDisband 监听Bot因群主解散群而退出群
func (*Bot) ListenBotLeaveEventKick ¶
func (b *Bot) ListenBotLeaveEventKick(l func(message *BotLeaveEventKick) bool)
ListenBotLeaveEventKick 监听Bot被踢出一个群
func (*Bot) ListenBotMuteEvent ¶
func (b *Bot) ListenBotMuteEvent(l func(message *BotMuteEvent) bool)
ListenBotMuteEvent 监听Bot被禁言
func (*Bot) ListenBotUnmuteEvent ¶
func (b *Bot) ListenBotUnmuteEvent(l func(message *BotUnmuteEvent) bool)
ListenBotUnmuteEvent 监听Bot被取消禁言
func (*Bot) ListenFriendMessage ¶
func (b *Bot) ListenFriendMessage(l func(message *FriendMessage) bool)
ListenFriendMessage 监听好友消息
func (*Bot) ListenFriendRecallEvent ¶
func (b *Bot) ListenFriendRecallEvent(l func(message *FriendRecallEvent) bool)
ListenFriendRecallEvent 监听好友消息撤回
func (*Bot) ListenFriendSyncMessage ¶
func (b *Bot) ListenFriendSyncMessage(l func(message *FriendSyncMessage) bool)
ListenFriendSyncMessage 监听同步好友消息
func (*Bot) ListenGroupAllowAnonymousChatEvent ¶
func (b *Bot) ListenGroupAllowAnonymousChatEvent(l func(message *GroupAllowAnonymousChatEvent) bool)
ListenGroupAllowAnonymousChatEvent 监听匿名聊天
func (*Bot) ListenGroupAllowConfessTalkEvent ¶
func (b *Bot) ListenGroupAllowConfessTalkEvent(l func(message *GroupAllowConfessTalkEvent) bool)
ListenGroupAllowConfessTalkEvent 监听坦白说
func (*Bot) ListenGroupAllowMemberInviteEvent ¶
func (b *Bot) ListenGroupAllowMemberInviteEvent(l func(message *GroupAllowMemberInviteEvent) bool)
ListenGroupAllowMemberInviteEvent 监听允许群员邀请好友加群
func (*Bot) ListenGroupEntranceAnnouncementChangeEvent ¶
func (b *Bot) ListenGroupEntranceAnnouncementChangeEvent(l func(message *GroupEntranceAnnouncementChangeEvent) bool)
ListenGroupEntranceAnnouncementChangeEvent 监听某群入群公告改变
func (*Bot) ListenGroupMessage ¶
func (b *Bot) ListenGroupMessage(l func(message *GroupMessage) bool)
ListenGroupMessage 监听群消息
func (*Bot) ListenGroupMuteAllEvent ¶
func (b *Bot) ListenGroupMuteAllEvent(l func(message *GroupMuteAllEvent) bool)
ListenGroupMuteAllEvent 监听全员禁言
func (*Bot) ListenGroupNameChangeEvent ¶
func (b *Bot) ListenGroupNameChangeEvent(l func(message *GroupNameChangeEvent) bool)
ListenGroupNameChangeEvent 监听某个群名改变
func (*Bot) ListenGroupRecallEvent ¶
func (b *Bot) ListenGroupRecallEvent(l func(message *GroupRecallEvent) bool)
ListenGroupRecallEvent 监听群消息撤回
func (*Bot) ListenGroupSyncMessage ¶
func (b *Bot) ListenGroupSyncMessage(l func(message *GroupSyncMessage) bool)
ListenGroupSyncMessage 监听同步群消息
func (*Bot) ListenMemberCardChangeEvent ¶
func (b *Bot) ListenMemberCardChangeEvent(l func(message *MemberCardChangeEvent) bool)
ListenMemberCardChangeEvent 监听群名片改动
func (*Bot) ListenMemberHonorChangeEvent ¶
func (b *Bot) ListenMemberHonorChangeEvent(l func(message *MemberHonorChangeEvent) bool)
ListenMemberHonorChangeEvent 监听群员称号改变
func (*Bot) ListenMemberJoinEvent ¶
func (b *Bot) ListenMemberJoinEvent(l func(message *MemberJoinEvent) bool)
ListenMemberJoinEvent 监听新人入群的事件
func (*Bot) ListenMemberJoinRequestEvent ¶
func (b *Bot) ListenMemberJoinRequestEvent(l func(message *MemberJoinRequestEvent) bool)
ListenMemberJoinRequestEvent 监听用户入群申请(Bot需要有管理员权限)
func (*Bot) ListenMemberLeaveEventKick ¶
func (b *Bot) ListenMemberLeaveEventKick(l func(message *MemberLeaveEventKick) bool)
ListenMemberLeaveEventKick 监听成员被踢出群
func (*Bot) ListenMemberLeaveEventQuit ¶
func (b *Bot) ListenMemberLeaveEventQuit(l func(message *MemberLeaveEventQuit) bool)
ListenMemberLeaveEventQuit 监听成员主动离群
func (*Bot) ListenMemberMuteEvent ¶
func (b *Bot) ListenMemberMuteEvent(l func(message *MemberMuteEvent) bool)
ListenMemberMuteEvent 监听群成员被禁言事件
func (*Bot) ListenMemberPermissionChangeEvent ¶
func (b *Bot) ListenMemberPermissionChangeEvent(l func(message *MemberPermissionChangeEvent) bool)
ListenMemberPermissionChangeEvent 监听成员权限改变的事件
func (*Bot) ListenMemberSpecialTitleChangeEvent ¶
func (b *Bot) ListenMemberSpecialTitleChangeEvent(l func(message *MemberSpecialTitleChangeEvent) bool)
ListenMemberSpecialTitleChangeEvent 监听群头衔改动
func (*Bot) ListenMemberUnmuteEvent ¶
func (b *Bot) ListenMemberUnmuteEvent(l func(message *MemberUnmuteEvent) bool)
ListenMemberUnmuteEvent 监听群成员被取消禁言事件
func (*Bot) ListenNewFriendRequestEvent ¶
func (b *Bot) ListenNewFriendRequestEvent(l func(message *NewFriendRequestEvent) bool)
ListenNewFriendRequestEvent 监听添加好友申请
func (*Bot) ListenNudgeEvent ¶
func (b *Bot) ListenNudgeEvent(l func(message *NudgeEvent) bool)
ListenNudgeEvent 监听戳一戳事件
func (*Bot) ListenOtherClientMessage ¶
func (b *Bot) ListenOtherClientMessage(l func(message *OtherClientMessage) bool)
ListenOtherClientMessage 监听其他客户端消息
func (*Bot) ListenStrangerMessage ¶
func (b *Bot) ListenStrangerMessage(l func(message *StrangerMessage) bool)
ListenStrangerMessage 监听陌生人消息
func (*Bot) ListenStrangerSyncMessage ¶
func (b *Bot) ListenStrangerSyncMessage(l func(message *StrangerSyncMessage) bool)
ListenStrangerSyncMessage 监听同步好友消息
func (*Bot) ListenTempMessage ¶
func (b *Bot) ListenTempMessage(l func(message *TempMessage) bool)
ListenTempMessage 监听群临时消息
func (*Bot) ListenTempSyncMessage ¶
func (b *Bot) ListenTempSyncMessage(l func(message *TempSyncMessage) bool)
ListenTempSyncMessage 监听同步群临时消息
func (*Bot) MemberAdmin ¶
MemberAdmin 修改群员管理员(需要有群主限权),assign-是否设置为管理员
func (*Bot) MemberList ¶
MemberList 获取群成员列表
func (*Bot) MemberProfile ¶
MemberProfile 获取群成员资料
func (*Bot) MessageFromId ¶
MessageFromId 通过messageId获取消息,target-好友或QQ群,视情况返回 FriendMessage, GroupMessage, TempMessage, StrangerMessage
func (*Bot) ResponseBotInvitedJoinGroup ¶
func (b *Bot) ResponseBotInvitedJoinGroup(request *BotInvitedJoinGroupRequestEvent, operate int, message string) error
ResponseBotInvitedJoinGroup 处理Bot被邀请入群申请,operate:0-同意,1-拒绝
func (*Bot) ResponseMemberJoin ¶
func (b *Bot) ResponseMemberJoin(request *MemberJoinRequestEvent, operate int, message string) error
ResponseMemberJoin 处理用户入群申请,Bot需要有管理员权限。operate:0-同意,1-拒绝,2-忽略,3-拒绝并拉黑,4-忽略并拉黑
func (*Bot) ResponseNewFriend ¶
func (b *Bot) ResponseNewFriend(request *NewFriendRequestEvent, operate int, message string) error
ResponseNewFriend 处理添加好友申请。operate:0-同意,1-拒绝,2-拒绝并拉黑
func (*Bot) RoamingMessages ¶
RoamingMessages 获取漫游消息,timeStart和timeEnd为开始和结束的时间戳,单位为秒。qq为查询的对象QQ,目前仅支持好友漫游消息。
返回数组的元素为 FriendMessage, GroupMessage, TempMessage, StrangerMessage
func (*Bot) Run ¶
func (b *Bot) Run(f func())
Run 如果不是并发方式启动,则此方法会将函数放入事件队列。如果是并发方式启动,则此方法等同于go f()。
func (*Bot) SendFriendMessage ¶
func (b *Bot) SendFriendMessage(qq, quote int64, messageChain MessageChain) (int64, error)
SendFriendMessage 发送好友消息,qq-目标好友的QQ号,quote-引用回复的消息,messageChain-发送的内容,返回消息id
func (*Bot) SendGroupMessage ¶
func (b *Bot) SendGroupMessage(group, quote int64, messageChain MessageChain) (int64, error)
SendGroupMessage 发送群消息,group-群号,quote-引用回复的消息,messageChain-发送的内容,返回消息id
func (*Bot) SendTempMessage ¶
func (b *Bot) SendTempMessage(qq, group, quote int64, messageChain MessageChain) (int64, error)
SendTempMessage 发送临时会话消息,qq-临时会话对象QQ号,group-临时会话群号,quote-引用回复的消息,messageChain-发送的内容,返回消息id
func (*Bot) SetEssence ¶
SetEssence 设置群精华消息(需要有相关限权)
func (*Bot) SetLimiter ¶
SetLimiter 设置限流器,limiterType为"wait"表示等待,为"drop"表示丢弃
func (*Bot) UpdateGroupConfig ¶
func (b *Bot) UpdateGroupConfig(group int64, groupConfig *GroupConfig) error
UpdateGroupConfig 修改群设置(需要有相关限权)
func (*Bot) UpdateMemberInfo ¶
UpdateMemberInfo 修改群员设置(需要有相关限权),name-群昵称,specialTitle-群头衔,这两项都是选填
type BotGroupPermissionChangeEvent ¶
type BotGroupPermissionChangeEvent struct { Origin Perm `json:"origin"` // Bot的原权限 Current Perm `json:"current"` // Bot的新权限 Group Group `json:"group"` }
BotGroupPermissionChangeEvent Bot在群里的权限被改变. 操作人一定是群主
type BotInvitedJoinGroupRequestEvent ¶
type BotInvitedJoinGroupRequestEvent struct { EventId int64 `json:"eventId"` // 事件标识,响应该事件时的标识 QQ int64 `json:"fromId"` // 邀请人QQ号 Group int64 `json:"groupId"` // 被邀请进入群的群号 GroupName string `json:"groupName"` // 被邀请进入群的群名称 Nick string `json:"nick"` // 邀请人(好友)的昵称 Message string `json:"message"` // 邀请消息 }
BotInvitedJoinGroupRequestEvent Bot被邀请入群申请
type BotJoinGroupEvent ¶
type BotJoinGroupEvent struct { Group Group `json:"group"` Invitor *Member `json:"invitor,omitempty"` // 邀请者,可能为空 }
BotJoinGroupEvent Bot加入了一个新群
type BotLeaveEventActive ¶
type BotLeaveEventActive struct {
Group Group `json:"group"`
}
BotLeaveEventActive Bot主动退出一个群
type BotLeaveEventDisband ¶
BotLeaveEventDisband Bot因群主解散群而退出群, 操作人一定是群主
type BotLeaveEventKick ¶
type BotLeaveEventKick struct {
Group Group `json:"group"`
}
BotLeaveEventKick Bot被踢出一个群
type BotMuteEvent ¶
type BotMuteEvent struct { DurationSeconds int64 `json:"durationSeconds"` // 禁言时长,单位为秒 Operator Member `json:"operator"` }
BotMuteEvent Bot被禁言
type BotUnmuteEvent ¶
type BotUnmuteEvent struct {
Operator Member `json:"operator"`
}
BotUnmuteEvent Bot被取消禁言
type Face ¶
type Face struct { Type string `json:"type"` FaceId int32 `json:"faceId,omitempty"` // QQ表情编号,可选,优先高于name Name string `json:"name,omitempty"` // QQ表情拼音,可选 }
Face QQ表情
func (*Face) FillMessageType ¶
func (m *Face) FillMessageType()
type File ¶
type File struct { Type string `json:"type"` Id string `json:"id"` // 文件识别id Name string `json:"name"` // 文件名 Size int64 `json:"size"` // 文件大小 }
File 文件
func (*File) FillMessageType ¶
func (m *File) FillMessageType()
type FileDownloadInfo ¶
type FileInfo ¶
type FileInfo struct { Name string `json:"name"` Id string `json:"id"` Path string `json:"path"` Parent any `json:"parent"` Contact Group `json:"contact"` IsFile bool `json:"isFile"` IsDictionary bool `json:"isDictionary"` IsDirectory bool `json:"isDirectory"` Sha1 string `json:"sha1"` Md5 string `json:"md5"` DownloadTimes int `json:"downloadTimes"` UploaderId int `json:"uploaderId"` UploadTime int `json:"uploadTime"` LastModifyTime int `json:"lastModifyTime"` DownloadInfo *FileDownloadInfo `json:"downloadInfo"` // 只有 WithDownloadInfo 为 true 时才会有 }
type FileParam ¶
type FileParam struct { Id string `json:"id"` // 文件夹id, 空串为根目录 Path string `json:"path,omitempty"` // 文件夹路径, 文件夹允许重名, 不保证准确, 准确定位使用 id Target int64 `json:"target,omitempty"` // 群号或好友QQ号 Group int64 `json:"group,omitempty"` // 群号 QQ int64 `json:"qq,omitempty"` // 好友QQ号 WithDownloadInfo bool `json:"withDownloadInfo,omitempty"` // 是否携带下载信息。额外请求,无必要不要携带 Offset int `json:"offset,omitempty"` // 分页偏移 Size int `json:"size,omitempty"` // 分页大小 DirectoryName string `json:"directoryName,omitempty"` // 新建文件夹名 MoveTo string `json:"moveTo,omitempty"` // 移动目标文件夹id MoveToPath string `json:"moveToPath,omitempty"` // 移动目标文件路径, 文件夹允许重名, 不保证准确, 准确定位使用 MoveTo RenameTo string `json:"renameTo,omitempty"` // 新文件名 }
type FlashImage ¶
type FlashImage struct { Type string `json:"type"` ImageId string `json:"imageId,omitempty"` Url string `json:"url,omitempty"` Path string `json:"path,omitempty"` Base64 string `json:"base64,omitempty"` }
FlashImage 闪照,参数同Image
func (*FlashImage) FillMessageType ¶
func (m *FlashImage) FillMessageType()
func (*FlashImage) String ¶
func (m *FlashImage) String() string
type ForwardMessage ¶
type ForwardMessage struct { Type string `json:"type"` // Display 转发消息的卡片显示文本,值为表示使用客户端默认值。发送时可以直接填nil,表示全用默认值。 // // 参考 https://docs.mirai.mamoe.net/mirai-api-http/api/MessageType.html#forwardmessage Display map[string]any `json:"display,omitempty"` NodeList []*ForwardMessageNode `json:"nodeList"` // 消息节点 }
ForwardMessage 转发消息
func (*ForwardMessage) FillMessageType ¶
func (m *ForwardMessage) FillMessageType()
func (*ForwardMessage) String ¶
func (m *ForwardMessage) String() string
type ForwardMessageNode ¶
type ForwardMessageNode struct { SenderId int64 `json:"senderId,omitempty"` // 消息节点 Time int64 `json:"time,omitempty"` // 发送时间 SenderName string `json:"senderName,omitempty"` // 显示名称 MessageChain []any `json:"messageChain,omitempty"` // 消息数组 MessageId int64 `json:"messageId,omitempty"` // 可以只使用消息messageId,从当前对话上下文缓存中读取一条消息作为节点 // MessageRef 引用缓存中其他对话上下文的消息作为节点 // // 参考 https://docs.mirai.mamoe.net/mirai-api-http/api/MessageType.html#forwardmessage MessageRef map[string]any `json:"messageRef,omitempty"` }
type Friend ¶
type Friend struct { Id int64 `json:"id"` // QQ号 Nickname string `json:"nickname"` // 昵称 Remark string `json:"remark"` // 备注 }
Friend 好友
type FriendMessage ¶
type FriendMessage struct { Sender Friend MessageChain MessageChain }
FriendMessage 好友消息
type FriendRecallEvent ¶
type FriendRecallEvent struct { AuthorId int64 `json:"authorId"` // 原消息发送者的QQ号 MessageId int64 `json:"messageId"` // 原消息messageId Time int64 `json:"time"` // 原消息发送时间 Operator int64 `json:"operator"` // 好友QQ号或BotQQ号 }
FriendRecallEvent 好友消息撤回
type FriendSyncMessage ¶
type FriendSyncMessage struct { Subject Friend MessageChain MessageChain }
FriendSyncMessage 同步好友消息
type Group ¶
type Group struct { Id int64 `json:"id"` // 群号 Name string `json:"name"` // 群名称 Permission Perm `json:"permission"` // Bot在群中的权限 }
Group 群
type GroupAllowAnonymousChatEvent ¶
type GroupAllowAnonymousChatEvent struct { Origin bool `json:"origin"` Current bool `json:"current"` Group Group `json:"group"` Operator Member `json:"operator"` }
GroupAllowAnonymousChatEvent 匿名聊天
type GroupAllowConfessTalkEvent ¶
type GroupAllowConfessTalkEvent struct { Origin bool `json:"origin"` Current bool `json:"current"` Group Group `json:"group"` IsByBot bool `json:"isByBot"` // 是否Bot进行该操作 }
GroupAllowConfessTalkEvent 坦白说
type GroupAllowMemberInviteEvent ¶
type GroupAllowMemberInviteEvent struct { Origin bool `json:"origin"` Current bool `json:"current"` Group Group `json:"group"` Operator Member `json:"operator"` }
GroupAllowMemberInviteEvent 允许群员邀请好友加群
type GroupConfig ¶
type GroupConfig struct { Name string `json:"name"` Announcement string `json:"announcement"` ConfessTalk bool `json:"confessTalk"` AllowMemberInvite bool `json:"allowMemberInvite"` AutoApprove bool `json:"autoApprove"` AnonymousChat bool `json:"anonymousChat"` // MuteAll 是否禁言,修改群设置时不要填这个字段,而应该用 Bot.MuteAll(group) 方法 MuteAll bool `json:"muteAll,omitempty"` }
GroupConfig 群设置
type GroupEntranceAnnouncementChangeEvent ¶
type GroupEntranceAnnouncementChangeEvent struct { Origin string `json:"origin"` // 原公告 Current string `json:"current"` // 新公告 Group Group `json:"group"` Operator Member `json:"operator"` }
GroupEntranceAnnouncementChangeEvent 某群入群公告改变
type GroupMessage ¶
type GroupMessage struct { Sender Member MessageChain MessageChain }
GroupMessage 群消息
type GroupMuteAllEvent ¶
type GroupMuteAllEvent struct { Origin bool `json:"origin"` Current bool `json:"current"` Group Group `json:"group"` Operator Member `json:"operator"` }
GroupMuteAllEvent 全员禁言
type GroupNameChangeEvent ¶
type GroupNameChangeEvent struct { Origin string `json:"origin"` // 原群名 Current string `json:"current"` // 新群名 Group Group `json:"group"` Operator Member `json:"operator"` }
GroupNameChangeEvent 某个群名改变
type GroupRecallEvent ¶
type GroupRecallEvent struct { AuthorId int64 `json:"authorId"` // 原消息发送者的QQ号 MessageId int64 `json:"messageId"` // 原消息messageId Time int64 `json:"time"` // 原消息发送时间 Group Group `json:"group"` // 消息撤回所在的群 Operator Member `json:"operator"` // 撤回消息的操作人,当null时为bot操作 }
GroupRecallEvent 群消息撤回
type GroupSyncMessage ¶
type GroupSyncMessage struct { Subject Group MessageChain MessageChain }
GroupSyncMessage 同步群消息
type HonorAction ¶
type HonorAction string
const ( HonorActionAchieve HonorAction = "achieve" // 获得称号 HonorActionLose HonorAction = "lose" // 失去称号 )
type Image ¶
type Image struct { Type string `json:"type"` ImageId string `json:"imageId,omitempty"` // 图片的imageId,群图片与好友图片格式不同。不为空时将忽略url属性 Url string `json:"url,omitempty"` // 图片的URL,发送时可作网络图片的链接;接收时为腾讯图片服务器的链接,可用于图片下载 Path string `json:"path,omitempty"` // 图片的路径,发送本地图片,路径相对于 JVM 工作路径(默认是当前路径,可通过 -Duser.dir=...指定),也可传入绝对路径。 Base64 string `json:"base64,omitempty"` // 图片的 Base64 编码 }
Image 图片(参数优先级imageId > url > path > base64)
func (*Image) FillMessageType ¶
func (m *Image) FillMessageType()
type Json ¶
func (*Json) FillMessageType ¶
func (m *Json) FillMessageType()
type MarketFace ¶
type MarketFace struct { Type string `json:"type"` Id int32 `json:"id"` // 商城表情唯一标识 Name string `json:"name"` // 表情显示名称 }
MarketFace 商城表情(目前商城表情仅支持接收和转发,不支持构造发送)
func (*MarketFace) FillMessageType ¶
func (m *MarketFace) FillMessageType()
func (*MarketFace) String ¶
func (m *MarketFace) String() string
type Member ¶
type Member struct { Id int64 `json:"id"` // QQ号 MemberName string `json:"memberName"` // 群名片 SpecialTitle string `json:"specialTitle"` // 群头衔 Permission Perm `json:"permission"` // 在群中的权限 JoinTimestamp int64 `json:"joinTimestamp"` // 入群时间时间戳 LastSpeakTimestamp int64 `json:"lastSpeakTimestamp"` // 最近发言时间戳 MuteTimeRemaining int64 `json:"muteTimeRemaining"` // 剩余禁言时长 Group Group `json:"group"` // 群信息 }
Member 群成员
type MemberCardChangeEvent ¶
type MemberCardChangeEvent struct { Origin string `json:"origin"` Current string `json:"current"` Member Member `json:"member"` // 名片改动的群员的信息 }
MemberCardChangeEvent 群名片改动
type MemberHonorChangeEvent ¶
type MemberHonorChangeEvent struct { Member Member `json:"member"` Action HonorAction `json:"action"` // 称号变化行为 Honor string `json:"honor"` // 称号名称 }
MemberHonorChangeEvent 群员称号改变
type MemberJoinEvent ¶
type MemberJoinEvent struct { Member Member `json:"member"` Invitor *Member `json:"invitor"` // 邀请人,可能为空 }
MemberJoinEvent 新人入群的事件
type MemberJoinRequestEvent ¶
type MemberJoinRequestEvent struct { EventId int64 `json:"eventId"` // 事件标识,响应该事件时的标识 QQ int64 `json:"fromId"` // 申请人QQ号 Group int64 `json:"groupId"` // 申请人申请入群的群号 GroupName string `json:"groupName"` // 申请人申请入群的群名称 Nick string `json:"nick"` // 申请人的昵称或群名片 Message string `json:"message"` // 申请消息 InvitorId int64 `json:"invitorId"` // 邀请人,可能没有 }
MemberJoinRequestEvent 用户入群申请(Bot需要有管理员权限)
type MemberLeaveEventKick ¶
type MemberLeaveEventKick struct { Member Member `json:"member"` Operator Member `json:"operator"` }
MemberLeaveEventKick 成员被踢出群(该成员不是Bot)
type MemberLeaveEventQuit ¶
type MemberLeaveEventQuit struct {
Member Member `json:"member"`
}
MemberLeaveEventQuit 成员主动离群(该成员不是Bot)
type MemberMuteEvent ¶
type MemberMuteEvent struct { DurationSeconds int64 `json:"durationSeconds"` Member Member `json:"member"` Operator Member `json:"operator"` }
MemberMuteEvent 群成员被禁言事件(该成员不是Bot)
type MemberPermissionChangeEvent ¶
type MemberPermissionChangeEvent struct { Origin Perm `json:"origin"` Current Perm `json:"current"` Member Member `json:"member"` }
MemberPermissionChangeEvent 成员权限改变的事件(该成员不是Bot)
type MemberSpecialTitleChangeEvent ¶
type MemberSpecialTitleChangeEvent struct { Origin string `json:"origin"` Current string `json:"current"` Member Member `json:"member"` }
MemberSpecialTitleChangeEvent 群头衔改动(只有群主有操作限权)
type MemberUnmuteEvent ¶
MemberUnmuteEvent 群成员被取消禁言事件(该成员不是Bot)
type MessageChain ¶
type MessageChain []SingleMessage
func (*MessageChain) UnmarshalJSON ¶
func (c *MessageChain) UnmarshalJSON(data []byte) error
type MiraiCode ¶
func (*MiraiCode) FillMessageType ¶
func (m *MiraiCode) FillMessageType()
type MusicShare ¶
type MusicShare struct {}
MusicShare 音乐分享
func (*MusicShare) FillMessageType ¶
func (m *MusicShare) FillMessageType()
func (*MusicShare) String ¶
func (m *MusicShare) String() string
type NewFriendRequestEvent ¶
type NewFriendRequestEvent struct { EventId int64 `json:"eventId"` // 事件标识,响应该事件时的标识 QQ int64 `json:"fromId"` // 申请人QQ号 Group int64 `json:"groupId"` // 申请人如果通过某个群添加好友,该项为该群群号;否则为0 Nick string `json:"nick"` // 申请人的昵称或群名片 Message string `json:"message"` // 申请消息 }
NewFriendRequestEvent 添加好友申请
type NudgeEvent ¶
type NudgeEvent struct { FromId int64 `json:"fromId"` // 动作发出者的QQ号 Subject struct { Id int64 `json:"id"` // 来源的QQ号(好友)或群号 Kind Kind `json:"kind"` // 来源的类型 } `json:"subject"` Action string `json:"action"` // 动作类型 Suffix string `json:"suffix"` // 自定义动作内容 Target int64 `json:"target"` // 动作目标的QQ号 }
NudgeEvent 戳一戳事件
type OtherClient ¶
type OtherClientMessage ¶
type OtherClientMessage struct { Sender OtherClient MessageChain MessageChain }
OtherClientMessage 其他客户端消息
type Profile ¶
type Profile struct { Nickname string `json:"nickname"` // 昵称 Email string `json:"email"` // 邮箱 Age int `json:"age"` // 年龄 Level int `json:"level"` // 等级 Sign string `json:"sign"` // 个性签名 Sex Sex `json:"sex"` // 性别 }
Profile 用户资料
type Quote ¶
type Quote struct { Type string `json:"type"` Id int64 `json:"id"` // 被引用回复的原消息的messageId GroupId int64 `json:"groupId"` // 被引用回复的原消息所接收的群号,当为好友消息时为0 SenderId int64 `json:"senderId"` // 被引用回复的原消息的发送者的QQ号 TargetId int64 `json:"targetId"` // 被引用回复的原消息的接收者的QQ号(或群号) Origin []any `json:"origin"` // 被引用回复的原消息的消息链对象 }
Quote 引用回复
func (*Quote) FillMessageType ¶
func (m *Quote) FillMessageType()
type SingleMessage ¶
type SingleMessage interface {
FillMessageType()
}
type Source ¶
type Source struct { Type string `json:"type"` Id int64 `json:"id"` // 消息的识别号,用于引用回复 Time int64 `json:"time"` // 时间戳 }
Source 永远为chain的第一个元素
func (*Source) FillMessageType ¶
func (m *Source) FillMessageType()
type StrangerMessage ¶
type StrangerMessage struct { Sender Friend MessageChain MessageChain }
StrangerMessage 陌生人消息
type StrangerSyncMessage ¶
type StrangerSyncMessage struct { Subject Friend MessageChain MessageChain }
StrangerSyncMessage 同步好友消息
type TempMessage ¶
type TempMessage struct { Sender Member MessageChain MessageChain }
TempMessage 群临时消息
type TempSyncMessage ¶
type TempSyncMessage struct { Subject Member MessageChain MessageChain }
TempSyncMessage 同步群临时消息
type Voice ¶
type Voice struct { Type string `json:"type"` VoiceId string `json:"voiceId,omitempty"` // 语音的voiceId,不为空时将忽略url属性 Url string `json:"url,omitempty"` // 语音的URL,发送时可作网络语音的链接;接收时为腾讯语音服务器的链接,可用于语音下载 Path string `json:"path,omitempty"` // 语音的路径,发送本地语音,路径相对于 JVM 工作路径(默认是当前路径,可通过 -Duser.dir=...指定),也可传入绝对路径。 Base64 string `json:"base64,omitempty"` // 语音的 Base64 编码 Length string `json:"length,omitempty"` // 返回的语音长度, 发送消息时可以不传 }
Voice 语音(参数优先级imageId > url > path > base64)
func (*Voice) FillMessageType ¶
func (m *Voice) FillMessageType()