utils

package
v0.0.0-...-f191df0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MESSAGE_BLOCK  uint = 0
	MESSAGE_IGNORE uint = 1
)

Variables

View Source
var ChannelPluginSet map[string]ChannelPlugin
View Source
var PluginSet map[string]Plugin

Functions

func ChannelRegister

func ChannelRegister(k string, v ChannelPlugin)

func Register

func Register(k string, v Plugin)

Types

type ChannelMsg

type ChannelMsg struct {
	Text  string
	At    bool
	Image string
	File  string
}

type ChannelPlugin

type ChannelPlugin interface {
	ChannelDo(ctx *context.Context, botId, botChannelId int64, guildId, channelId, userId uint64, rawMsg, card string, super, userRole bool, rs, rd, rf int) (retStuct RetChannelStuct)
}

type InputStruct

type InputStruct struct {
	BotId     int64
	GroupId   int64
	UserId    int64
	RawMsg    string
	UserRole  bool
	BotRole   bool
	SuperRole bool
	RS        int
	RD        int
	RF        int
}

* userId 用户Id * groupId 群Id * rawMsg 群消息 * userRole 用户角色,是否是管理员 * botRole 机器人角色, 是否是管理员 * retval 返回值,用于判断是否处理下一个插件 * replyMsg 待发送消息 * rs 成功防屏蔽码 * rd 删除防屏蔽码 * rf 失败防屏蔽码

type Msg

type Msg struct {
	Text  string
	At    bool
	Image string
}

type Plugin

type Plugin interface {
	Do(ctx *context.Context, botId, groupId, userId int64, messageId *onebot.MessageReceipt, rawMsg, card string, botRole, userRole, super bool, rs, rd, rf int) (retStuct RetStuct)
}

type ReqType

type ReqType int
const (
	GroupBan    ReqType = iota // 群禁言
	RelieveBan                 // 禁言解除
	GroupKick                  // 群踢人
	GroupSignIn                // 群打卡
	GroupMsg                   // 群消息
	GroupLeave                 // 退群
	DeleteMsg                  // 消息撤回
	Undefined                  // 未定义
)

type RetChannelStuct

type RetChannelStuct struct {
	RetVal    uint
	ReplyMsg  *ChannelMsg
	ReqType   ReqType
	MessageId uint64
}

type RetStuct

type RetStuct struct {
	RetVal         uint
	ReplyMsg       *Msg
	ReqType        ReqType
	Duration       int32
	BanId          int64
	RejectAddAgain bool
	MessageId      *onebot.MessageReceipt
}

Jump to

Keyboard shortcuts

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