message

package
Version: v0.2.1-snap.0...-e1d2b68 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EventBotOnline Bot登录成功
	EventBotOnline = "BotOnlineEvent"
	// EventBotOfflineActive Bot主动离线
	EventBotOfflineActive = "BotOfflineEventActive"
	// EventBotOfflineForce Bot被挤下线
	EventBotOfflineForce = "BotOfflineEventForce"
	// EventBotOfflineDropped Bot被服务器断开或因网络问题而掉线
	EventBotOfflineDropped = "BotOfflineEventDropped"
	// EventBotRelogin Bot主动重新登录
	EventBotRelogin = "BotReloginEvent"
	// EventBotGroupPermissionChange Bot在群里的权限被改变. 操作人一定是群主
	EventBotGroupPermissionChange = "BotGroupPermissionChangeEvent"
	// EventBotMute Bot被禁言
	EventBotMute = "BotMuteEvent"
	// EventBotUnmute Bot被取消禁言
	EventBotUnmute = "BotUnmuteEvent"
	// EventBotJoinGroup Bot加入了一个新群
	EventBotJoinGroup = "BotJoinGroupEvent"
	// EventBotLeaveActive Bot主动退出一个群
	EventBotLeaveActive = "BotLeaveEventActive"
	// EventBotLeaveKick Bot被踢出一个群
	EventBotLeaveKick = "BotLeaveEventKick"
)

*

  • Bot Event
View Source
const (
	// EventReceiveFriendMessage 好友消息
	EventReceiveFriendMessage = "FriendMessage"
	// EventReceiveGroupMessage 群组消息
	EventReceiveGroupMessage = "GroupMessage"
	// EventReceiveTempMessage 临时消息
	EventReceiveTempMessage = "TempMessage"
)

*

  • Message Event Type
View Source
const (
	// EventGroupNameChange 某个群名改变
	EventGroupNameChange = "GroupNameChangeEvent"
	// EventGroupEntranceAnnouncementChange 某群入群公告改变
	EventGroupEntranceAnnouncementChange = "GroupEntranceAnnouncementChangeEvent"
	// EventGroupAllowAnonymousChat 匿名聊天
	EventGroupAllowAnonymousChat = "GroupAllowAnonymousChatEvent"
	// EventGroupAllowConfessTalk 坦白说
	EventGroupAllowConfessTalk = "GroupAllowConfessTalkEvent"
	// EventGroupAllowMemberInvite 允许群员邀请好友加群
	EventGroupAllowMemberInvite = "GroupAllowMemberInviteEvent"
)
View Source
const (
	// EventMemberJoinRequest 用户入群申请(Bot需要有管理员权限)
	EventMemberJoinRequest = "MemberJoinRequestEvent"
	// EventMemberJoin 新人入群的事件
	EventMemberJoin = "MemberJoinEvent"
	// EventMemberLeaveKick 成员被踢出群(该成员不是Bot)
	EventMemberLeaveKick = "MemberLeaveEventKick"
	// EventMemberLeaveQuit 成员主动离群(该成员不是Bot)
	EventMemberLeaveQuit = "MemberLeaveEventQuit"

	// EventGroupMuteAll 全员禁言
	EventGroupMuteAll = "GroupMuteAllEvent"
	// EventGroupRecall 群消息撤回
	EventGroupRecall = "GroupRecallEvent"
	// EventMemberMute 群成员被禁言事件(该成员不可能是Bot,见BotMuteEvent)
	EventMemberMute = "MemberMuteEvent"
	// EventMemberUnMute 群成员被取消禁言事件(该成员不可能是Bot,见BotUnmuteEvent)
	EventMemberUnMute = "MemberUnmuteEvent"

	// EventMemberCardChange 群名片改动
	EventMemberCardChange = "MemberCardChangeEvent"
	// EventMemberSpecialTitleChange 群头衔改动(只有群主有操作限权)
	EventMemberSpecialTitleChange = "MemberSpecialTitleChangeEvent"
	// EventMemberPermissionChange 成员权限改变的事件(该成员不可能是Bot,见BotGroupPermissionChangeEvent)
	EventMemberPermissionChange = "MemberPermissionChangeEvent"

	// EventBotInvitedJoinGroupRequest Bot被邀请入群申请
	EventBotInvitedJoinGroupRequest = "BotInvitedJoinGroupRequestEvent"
)

*

  • Group Member / Message Event
View Source
const (
	// EventNewFriendRequest 添加好友申请
	EventNewFriendRequest = "NewFriendRequestEvent"
	// EventFriendRecall 好友消息撤回
	EventFriendRecall = "FriendRecallEvent"
)

*

  • Friend Event
View Source
const (
	// MsgTypeSource -
	MsgTypeSource = "Source"
	// MsgTypeQuote 引用
	MsgTypeQuote = "Quote"
	// MsgTypeAt At
	MsgTypeAt = "At"
	// MsgTypeAtAll At所有人
	MsgTypeAtAll = "AtAll"
	// MsgTypeFace 表情
	MsgTypeFace = "Face"
	// MsgTypePlain 文本
	MsgTypePlain = "Plain"
	// MsgTypeImage 图片
	MsgTypeImage = "Image"
	// MsgTypeFlashImage 闪照
	MsgTypeFlashImage = "FlashImage"
	// MsgTypeXML XML
	MsgTypeXML = "Xml"
	// MsgTypeJSON JSON
	MsgTypeJSON = "Json"
	// MsgTypeApp App
	MsgTypeApp = "App"
	// MsgTypePoke 戳一戳
	MsgTypePoke = "Poke"
)
View Source
const (
	// OWNER 群主
	OWNER = iota + 1
	// ADMINISTRATOR 管理员
	ADMINISTRATOR
	// MEMBER 普通成员
	MEMBER
)

*

  • Permission

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

type Chain struct {
	Msg []Message
}

Chain 消息链

func GenChain

func GenChain(args ...Message) Chain

GenChain 生成消息链

type ComplexEvent

type ComplexEvent struct {
	// Base
	Type string `json:"type"`
	// Message
	MessageChain []Message `json:"messageChain"`
	// Sender
	Sender Sender `json:"sender"`
	// Common
	Member   Member   `json:"member"`
	Operator Operator `json:"operator"`
	Group    Group    `json:"group"`
	// Card | SpecialTitle
	Origin  string
	New     string
	Current string
	// TODO: 强烈建议 MiraiHttpApi 修改 Origin,New,Current 为 string
	// // GroupMute
	// Origin  bool
	// New     bool
	// Current bool
	// GroupRecall
	AuthorID  int64 `json:"authorId"`
	MessageID int64 `json:"messageId"`
	Time      int64 `json:"time"`
	// MemberMuteEvent
	DurationSeconds int `json:"durationSeconds"`

	// MemberJoinRequestEvent
	EventID   int64  `json:"eventId"`
	FromID    int64  `json:"fromId"`
	GroupID   int64  `json:"groupId"`
	GroupName string `json:"groupName"`
	Nickname  string `json:"nick"`
	Message   string `json:"message"`
}

ComplexEvent -

type Friend

type Friend struct {
	// ID QQ号
	ID int64 `json:"id"`
	// NickName (FriendMessage)发送者昵称
	NickName string `json:"nickname"`
	// Remark (FriendMessage)发送者备注
	Remark string `json:"remark"`
}

Friend -

type Group

type Group struct {
	// ID 消息来源群号
	ID int64 `json:"id,omitempty"`
	// Name 消息来源群名
	Name string `json:"name,omitempty"`
	// Permisson bot在群中的角色
	Permisson string `json:"permisson,omitempty"`
}

Group QQ群

type GroupConfig

type GroupConfig struct {
	Name              string
	Announcement      string
	ConfessTalk       bool
	AllowMemberInvite bool
	AutoApprove       bool
	AnonymousChat     bool
}

GroupConfig -

type Member

type Member struct {
	ID         int64  `json:"id"`
	MemberName string `json:"memberName"`
	Permission string `json:"permission"`
	Group      Group  `json:"group"`
}

Member 成员(被操作对象)

type MemberInfo

type MemberInfo struct {
	Name         string
	SpecialTitle string
}

MemberInfo -

type Message

type Message struct {
	Type string `json:"type,omitempty"`
	ID   int64  `json:"id,omitempty"`   //(Source,Quote)Source中表示消息id,Quote中表示被引用回复的原消息的id
	Time int64  `json:"time,omitempty"` //(Source) 发送时间

	GroupID  int64     `json:"groupId,omitempty"`  //(Quote)Quote中表示被引用回复的原消息的群号
	SenderID int64     `json:"senderId,omitempty"` //(Quote)Quote中表示被引用回复的原消息的发送者QQ号
	TargetID int64     `json:"targetId,omitempty"` //(Quote)Quote中表示被引用回复的原消息的接收者群号或QQ号
	Origin   []Message `json:"origin,omitempty"`   //(Quote)Quote中表示被引用回复的原消息的消息链对象

	Target  int64  `json:"target,omitempty"`  //(At)@的群员QQ号
	Display string `json:"display,omitempty"` //(At)@的显示文本

	FaceID int    `json:"faceId,omitempty"` //(Face)QQ表情的ID,发送时优先级比Name高
	Name   string `json:"name,omitempty"`   //(Face,Poke)Face中为QQ表情的拼音,Poke中为戳一戳的类型

	Text string `json:"text,omitempty"` //(Plain)纯文本

	ImageID   string `json:"imageId,omitempty"` //(Image,FlashImage)图片ID,注意消息类型,群图片和好友图片格式不一样,发送时优先级比ImageUrl高
	ImageURL  string `json:"url,omitempty"`     //(Image,FlashImage)图片url,发送时可使用网络图片的链接,优先级比ImagePath高;接收时为腾讯图片服务器的链接
	ImagePath string `json:"path,omitempty"`    //(Image,FlashImage)图片的路径,发送本地图片,相对路径于plugins/MiraiAPIHTTP/images

	XML     string `json:"xml,omitempty"`     //(Xml) xml消息本体
	JSON    string `json:"json,omitempty"`    //(Json) json消息本体
	Content string `json:"content,omitempty"` //(App) 不知道干嘛的,mirai也没有说明,估计是小程序连接?
}

Message 消息

func AtMessage

func AtMessage(target int64) Message

AtMessage At消息

func FaceMessage

func FaceMessage(faceID int) Message

FaceMessage 表情消息

func FlashImageMessage

func FlashImageMessage(t, v string) Message

FlashImageMessage 闪照消息

func ImageMessage

func ImageMessage(t, v string) Message

ImageMessage 图片消息

func PlainMessage

func PlainMessage(text string) Message

PlainMessage 文本消息

func PokeMessage

func PokeMessage(name string) Message

PokeMessage 戳一戳消息

func RichMessage

func RichMessage(t, content string) Message

RichMessage 特殊消息

type Operator

type Operator struct {
	// ID QQ号
	ID int64 `json:"id,omitempty"`
	// Group (GroupMessage)消息来源群信息
	Group Group `json:"group,omitempty"`
	// MemberName 群名片
	MemberName string `json:"memberName"`
	// Permission 权限
	Permission string `json:"permission"`
}

Operator 操作者

type Sender

type Sender struct {
	Friend
	// MemberName (GroupMessage)发送者群昵称
	MemberName string `json:"memberName"`
	// Permission (GroupMessage)发送者在群中的角色
	Permission string `json:"permission"`
	// Group (GroupMessage)消息来源群信息
	Group Group `json:"group"`
}

Sender 消息发送者

Jump to

Keyboard shortcuts

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