bot

package
v0.0.0-...-f63e2ce Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrJsonUnmarshal = errors.New("JsonUnmarshalError")

ErrJsonUnmarshal json序列化中出错

Functions

This section is empty.

Types

type Bot

type Bot struct {
	// contains filtered or unexported fields
}

func New

func New(d driver.Driver) *Bot

func (*Bot) Attach

func (b *Bot) Attach(a listener)

func (*Bot) GetID

func (b *Bot) GetID() int64

GetID 获取当前登陆的qq号

func (*Bot) Run

func (b *Bot) Run() error

func (*Bot) SendGroupMsg

func (b *Bot) SendGroupMsg(group int64, msg message.Msg) (int32, error)

SendGroupMsg 发送群聊消息(不含匿名消息)

func (*Bot) SendPrivateMsg

func (b *Bot) SendPrivateMsg(qq int64, msg message.Msg) (int32, error)

SendPrivateMsg 发送私聊消息

func (*Bot) SetGroupBan

func (b *Bot) SetGroupBan(GroupID, UserID, Duration int64) error

SetGroupBan 群禁言,duration单位为秒,传入0时解除禁言

但是QQ貌似是按照分钟计算的,因此建议传入60的倍数

func (*Bot) Stop

func (b *Bot) Stop() error

type FriendAddHandler

type FriendAddHandler struct {
	Priority int
	F        func(request *FriendRequest) bool
}

type FriendRequest

type FriendRequest struct {
	UserID  int64
	Comment string
	// contains filtered or unexported fields
}

func (*FriendRequest) Agree

func (r *FriendRequest) Agree(remark string)

Agree 同意加好友请求,remark为对好友的备注

func (*FriendRequest) Reject

func (r *FriendRequest) Reject()

type GroupAddHandler

type GroupAddHandler struct {
	Priority int
	F        func(request *GroupRequest) bool
}

GroupAddHandler 加群申请

type GroupBanHandler

type GroupBanHandler struct {
	Priority int
	F        func(GroupID, OperatorID, UserID, Duration int64) bool
}

GroupBanHandler 群禁言,duration单位为秒

type GroupDecreaseHandler

type GroupDecreaseHandler struct {
	Priority int
	F        func(GroupID, OperatorID, UserID int64) bool
}

GroupDecreaseHandler 群成员减少,包含成员主动退群,成员被踢;

主动退群时OperatorID==UserID,不相等则为被踢

type GroupInviteHandler

type GroupInviteHandler struct {
	Priority int
	F        func(request *GroupRequest) bool
}

GroupInviteHandler 加群邀请

type GroupKickMeHandler

type GroupKickMeHandler struct {
	Priority int
	F        func(GroupID, OperatorID int64) bool
}

GroupKickMeHandler 自己被踢出群聊

type GroupLiftBanHandler

type GroupLiftBanHandler struct {
	Priority int
	F        func(GroupID, OperatorID, UserID int64) bool
}

GroupLiftBanHandler 群解除禁言

type GroupMsgHandler

type GroupMsgHandler struct {
	Priority int
	F        func(MsgID int32, GroupID, UserID int64, Msg message.Msg) bool
}

GroupMsgHandler 群聊消息(不含匿名消息)

type GroupRequest

type GroupRequest struct {

	// 邀请/申请加群的人的qq号
	UserID int64
	// 受邀/申请加入的群号
	GroupID int64
	// 验证消息
	Comment string
	// contains filtered or unexported fields
}

GroupRequest 邀请/申请加群都用这个

func (*GroupRequest) Agree

func (r *GroupRequest) Agree()

func (*GroupRequest) Reject

func (r *GroupRequest) Reject(reason string)

type PrivateMsgHandler

type PrivateMsgHandler struct {
	Priority int
	F        func(MsgID int32, UserID int64, Msg message.Msg) bool
}

PrivateMsgHandler 私聊消息

Jump to

Keyboard shortcuts

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