Documentation ¶
Index ¶
- Constants
- func DeepCopy(dst, src any)
- func GenCode(data []byte) string
- type Action
- func (b *Action) GetFriendsList() ([]Friend, error)
- func (b *Action) GetMsg(messageId string) (message *Message, err error)
- func (b *Action) Send(action string, data any) (jsoniter.Any, error)
- func (b *Action) SendMsg(qid any, msg Messages, ty EventMessageType, autoEscape ...bool) (int32, error)
- func (b *Action) SendPrivateMsg(userId int64, msg string) (int32, error)
- func (b *Action) SetFriendAddRequest(flag string, approve bool, remark ...string) error
- func (b *Action) SetGroupAddRequest(flag string, subType GroupRequestEventSubType, approve bool, reason ...string) error
- type Bot
- type Event
- type EventMessage
- type EventMessageContext
- type EventMessageType
- type Friend
- type GroupRequestEventSubType
- type Message
- type MessageEvent
- type MessageType
- type Messages
- func (m *Messages) Add(msg Message) Messages
- func (m *Messages) AtMessage(qid any, name ...string) Messages
- func (m *Messages) ImageMessage(file, url string, src []byte, flash bool) Messages
- func (m *Messages) RawMessage() string
- func (m *Messages) ReplyMessage(messageId string) Messages
- func (m *Messages) TextMessage(text string) Messages
- type Msg
- type OnFriendRequestFunc
- type OnGroupMessageFunc
- type OnGroupRequestFunc
- type OnMessageFunc
- type OnPrivateMessageFunc
- type Option
- type Options
- type RequestEvent
- type Sender
Constants ¶
View Source
const ( Private = EventMessageType("private") Group = EventMessageType("group") )
View Source
const ( TEXT = MessageType(iota) + 1 IMAGE Reply At )
View Source
const ( Add = GroupRequestEventSubType("add") // 加入 Invite = GroupRequestEventSubType("invite") // 邀请 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Action ¶
type Action struct {
// contains filtered or unexported fields
}
func (*Action) GetFriendsList ¶
GetFriendsList 获取好友列表
func (*Action) SendMsg ¶
func (b *Action) SendMsg(qid any, msg Messages, ty EventMessageType, autoEscape ...bool) (int32, error)
SendMsg 发送消息
@param qid 目标,私聊为对方qq号,群聊为群号 @param msg 消息 @param ty 消息类型,私聊为Private,群聊为Group
@return id 消息id @return error
func (*Action) SendPrivateMsg ¶
func (*Action) SetFriendAddRequest ¶
func (*Action) SetGroupAddRequest ¶
type Event ¶
type Event struct { MessageEvent RequestEvent }
type EventMessage ¶
func NewEventMessage ¶
func NewEventMessage() *EventMessage
func (*EventMessage) Close ¶
func (e *EventMessage) Close()
type EventMessageContext ¶
type EventMessageContext struct { MessageId int32 MessageType EventMessageType SenderId int64 Sender Sender GroupId int64 Message *EventMessage }
func NewEventMessageContext ¶
func NewEventMessageContext() *EventMessageContext
func (*EventMessageContext) Close ¶
func (e *EventMessageContext) Close()
func (*EventMessageContext) QuickReply ¶
QuickReply 对消息快速回复 @param at @发送人,仅当消息类型为Group时有效
func (*EventMessageContext) QuickReplyText ¶
QuickReplyText 对消息快速回复 @param at @发送人,仅当消息类型为Group时有效
type EventMessageType ¶
type EventMessageType string
type GroupRequestEventSubType ¶
type GroupRequestEventSubType string
type Message ¶
type Message struct { Type MessageType Image *messageImage At *messageAt Text string }
func ImageMessage ¶
ImageMessage file,url,src 三选一。优先级:src > url > file
func ReplyMessage ¶
func TextMessage ¶
type MessageEvent ¶
type MessageEvent struct {
// contains filtered or unexported fields
}
func (*MessageEvent) OnGroupMessage ¶
func (b *MessageEvent) OnGroupMessage(f OnGroupMessageFunc)
OnGroupMessage 接收群消息
func (*MessageEvent) OnPrivateMessage ¶
func (b *MessageEvent) OnPrivateMessage(f OnPrivateMessageFunc)
OnPrivateMessage 接收私人消息
type MessageType ¶
type MessageType uint8
type Messages ¶
type Messages []Message
func MessageArray ¶
func ParseMessage ¶
func (*Messages) ImageMessage ¶
func (*Messages) RawMessage ¶
func (*Messages) ReplyMessage ¶
func (*Messages) TextMessage ¶
type Msg ¶
type Msg struct { MessageType EventMessageType `json:"message_type"` UserId any `json:"user_id"` GroupId any `json:"group_id"` Message string `json:"message"` AutoEscape *bool `json:"auto_escape,omitempty"` // 消息内容是否作为纯文本发送 ( 即不解析 CQ 码 ) , 只在 message 字段是字符串时有效 }
type OnFriendRequestFunc ¶
type OnGroupMessageFunc ¶
type OnGroupMessageFunc func(messageId int32, senderQid, groupId int64, message *EventMessage)
type OnGroupRequestFunc ¶
type OnGroupRequestFunc func(userId, groupId int64, requestType GroupRequestEventSubType, comment, flag string)
type OnMessageFunc ¶
type OnMessageFunc func(ctx *EventMessageContext)
type OnPrivateMessageFunc ¶
type OnPrivateMessageFunc func(messageId int32, userId int64, message *EventMessage)
type Option ¶
type Option func(options *Options)
func WithHandleThreadNum ¶
WithHandleThreadNum 默认为200,如果数值太小会导致处理出现延时
type RequestEvent ¶
type RequestEvent struct {
// contains filtered or unexported fields
}
func (*RequestEvent) OnFriendRequest ¶
func (r *RequestEvent) OnFriendRequest(f OnFriendRequestFunc)
func (*RequestEvent) OnGroupRequest ¶
func (r *RequestEvent) OnGroupRequest(f OnGroupRequestFunc)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.