leafBot

package module
v1.0.22 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2021 License: AGPL-3.0 Imports: 31 Imported by: 0

README

LeafBot

LeafBot

✨ 基于 go-cqhttp,使用OneBot标准的插件 ✨

cqhttp


已添加windows的gui界面,前提是基于chorme引擎

特别感谢wdvxdr1123大佬的CQ码解析和消息部分
安装
    go get github.com/3343780376/leafBot

功能

已实现功能
  • 戳一戳实现查看服务器状态
  • 微博热搜
  • 自动回复
  • 黑名单管理
  • 每日一图
  • 闪照拦截
  • 二维码生成
  • 翻译插件
  • 点歌插件
  • setu
  • 入群欢迎
  • 插件管理
预计实现功能
  • 群管插件,例如禁言,关键词撤回,自动踢人

  • 群荣誉提醒

  • p站log实现

  • github自动操作以及搜索

  • bilibili的av号和bv号解析

  • 天气卡片

更多功能功能提交issue
特别感谢

wdvxdr1123/ZeroBot

Mrs4s/go-cqhttp

示例

Documentation

Index

Constants

View Source
const (
	JSON  = "json"
	HJSON = "hjson"
	YAML  = "yaml"
)

Variables

View Source
var (
	MessageChan = make(chan Event, 10)
	NoticeChan  = make(chan Event, 10)
	Request     = make(chan Event, 10)
)

var *

  • @Description: 通向前端的通道
  • @return unc
View Source
var (
	ConnectHandles      ConnectChain
	DisConnectHandles   DisConnectChain
	MessageHandles      MessageChain
	RequestHandles      RequestChain
	NoticeHandles       NoticeChain
	CommandHandles      CommandChain
	MetaHandles         MetaChain
	PretreatmentHandles PretreatmentChain
)
View Source
var (
	DefaultConfig = new(Config)
)
View Source
var ISGUI = true
View Source
var (
	NoticeTypeApi = ConstNoticeType{
		GroupUpload:   "group_upload",
		GroupAdmin:    "group_admin",
		GroupDecrease: "group_decrease",
		GroupIncrease: "group_increase",
		GroupBan:      "group_ban",
		FriendAdd:     "friend_add",
		GroupRecall:   "group_recall",
		FriendRecall:  "friend_recall",
		Notify:        "notify",
		OfflineFile:   "offline_file",
		GroupCard:     "group_card"}
)

Functions

func BanPluginByID

func BanPluginByID(id string)

BanPluginByID *

  • @Description: 根据id禁用插件
  • @param id

func BanPluginByName

func BanPluginByName(name string) int

BanPluginByName *

  • @Description: 禁用某个插件
  • @param name 插件名
  • @return int 禁用的插件个数

func CallApi added in v1.0.13

func CallApi(ctx *gin.Context)

func GetConfig added in v1.0.13

func GetConfig(ctx *gin.Context)

func GetFriendList added in v1.0.13

func GetFriendList(ctx *gin.Context)

func GetGroupList added in v1.0.13

func GetGroupList(ctx *gin.Context)

func GetHandleList

func GetHandleList() map[string][]BaseHandle

func GetLogLevel

func GetLogLevel(level string) log.Level

GetLogLevel

@Description:
@param level string
@return log.Level

func InitBots

func InitBots()

InitBots

@Description:

func InitPluginManager

func InitPluginManager()

func InitWindow added in v1.0.13

func InitWindow()

func LoadConfig

func LoadConfig()

func OnCommand

func OnCommand(command string) *commandHandle

OnCommand *

  • @Description: command触发handle

  • @param 该插件响应的命令

  • @return *commandHandle

  • example leafBot.OnCommand("天气"). SetPluginName("天气插件"). AddHandle( func(event LeafBot.Event,bot *leafBot.Bot,args []string){

    })

func OnConnect

func OnConnect() *connectHandle

OnConnect *

  • @Description: 在bot进行连接使响应
  • @return *connectHandle
  • example

func OnDisConnect

func OnDisConnect() *disConnectHandle

OnDisConnect *

  • @Description: 在bot断开连接时进行响应
  • @return *disConnectHandle
  • example

func OnEndWith added in v1.0.1

func OnEndWith(str string) *messageHandle

func OnMessage

func OnMessage(messageType string) *messageHandle

OnMessage *

  • @Description: message事件触发handle
  • @param messageType message事件的子类型
  • @return *messageHandle
  • example

func OnMeta

func OnMeta() *metaHandle

OnMeta *

  • @Description: 元事件触发handle
  • @return *metaHandle
  • example

func OnNotice

func OnNotice(noticeType string) *noticeHandle

OnNotice *

  • @Description: notice触发handle

  • @param noticeType notice事件类型

  • @return *noticeHandle

  • example 响应戳一戳事件的示例 leafBot.OnNotice(leafBot.NoticeTypeApi.Notify). SetPluginName("poke"). AddRule( func(event leafBot.Event, bot *leafBot.Bot) bool { if event.SubType != "poke" || event.UserId == event.SelfId || int(event.TargetId) != event.SelfId { return false } return true }).SetWeight(10). AddHandle( func(event leafBot.Event, bot *leafBot.Bot) {

    })

func OnRegex added in v1.0.21

func OnRegex(regex string) *commandHandle

func OnRequest

func OnRequest(requestType string) *requestHandle

OnRequest *

  • @Description: request事件触发handle
  • @param requestType request事件的子类型
  • @return *requestHandle
  • example

func OnStartWith added in v1.0.1

func OnStartWith(str string) *messageHandle

func OnlyGroupMessage

func OnlyGroupMessage(event Event, bot *Bot) bool

func OnlySuperUser

func OnlySuperUser(event Event, bot *Bot, _ *State) bool

OnlySuperUser *

  • @Description: 加了该rule的插件只会对配置文件中配置的管理员用户进行响应
  • @param event leafBot event
  • @param bot bot实例对象
  • @return bool 是否通过该rule验证
  • example

func OnlyToMe

func OnlyToMe(event Event, _ *Bot, _ *State) bool

OnlyToMe *

  • @Description: 添加了该rule的插件需要在群里艾特或者私聊才会进行响应
  • @param event leafBot event
  • @param bot bot实例对象
  • @return bool 返回是否验证通过该rule
  • example

func StartPlugin

func StartPlugin(name string) int

StartPlugin *

  • @Description: 启用某个插件
  • @param name 插件名
  • @return int 启用插件个数

func StartPluginByID

func StartPluginByID(id string)

Types

type Api

type Api interface {
	SendGroupMsg(groupId int, message interface{}) int32
	SendPrivateMsg(userId int, message interface{}) int32
	DeleteMsg(messageId int32)
	GetMsg(messageId int32) GetMessage
	SetGroupBan(groupId int, userId int, duration int)
	SetGroupCard(groupId int, userId int, card string)
	SendMsg(messageType string, userId int, groupId int, message interface{}) int32
	SendLike(userId int, times int)
	SetGroupKick(groupId int, userId int, rejectAddRequest bool)
	SetGroupAnonymousBan(groupId int, flag string, duration int)
	SetGroupWholeBan(groupId int, enable bool)
	SetGroupAdmin(groupId int, UserId int, enable bool)
	SetGroupAnonymous(groupId int, enable bool)
	SetGroupName(groupId int, groupName string)
	SetGroupLeave(groupId int, isDisMiss bool)
	SetGroupSpecialTitle(groupId int, userId int, specialTitle string, duration int)
	SetFriendAddRequest(flag string, approve bool, remark string)
	SetGroupAddRequest(flag string, subType string, approve bool, reason string)
	GetLoginInfo() LoginInfo
	GetStrangerInfo(userId int, noCache bool) Senders
	GetFriendList() []FriendList
	GetGroupInfo(groupId int, noCache bool) GroupInfo
	GetGroupList() []GroupInfo
	GetGroupMemberInfo(groupId int, UserId int, noCache bool) GroupMemberInfo
	GetGroupMemberList(groupId int) []GroupMemberInfo
	GetGroupHonorInfo(groupId int, honorType string) GroupHonorInfo
	GetCookies(domain string) Cookie
	GetCsrfToken() CsrfToken
	GetCredentials(domain string) Credentials
	GetRecord(file, outFormat string) Record
	GetImage(file string) Image
	CanSendImage() Bool
	CanSendRecord() Bool
	GetStatus() OnlineStatus
	SetRestart(delay int)
	CleanCache()
}

type BaseHandle

type BaseHandle struct {
	ID         string
	Name       string
	Enable     bool
	IsAdmin    bool
	HandleType string
}

type Bool

type Bool struct {
	Yes bool `json:"yes"`
}

type Bot

type Bot struct {
	Name string `json:"name"`

	SelfId int         `json:"self_id"`
	Client *connection `json:"con"`
}

func GetBotById

func GetBotById(id int) *Bot

GetBotById

@Description:
@param id int
@return *Bot

func (*Bot) CallApi

func (b *Bot) CallApi(Action string, param interface{}) interface{}

func (*Bot) CanSendImage

func (b *Bot) CanSendImage() Bool

CanSendImage

@Description:
@receiver b
@return Bool

func (*Bot) CanSendRecord

func (b *Bot) CanSendRecord() Bool

CanSendRecord

@Description:
@receiver b
@return Bool

func (*Bot) CheckUrlSafely added in v1.0.12

func (b *Bot) CheckUrlSafely(url string) int

func (*Bot) CleanCache

func (b *Bot) CleanCache()

CleanCache

@Description:
@receiver b

func (*Bot) CloseMessageChan

func (b *Bot) CloseMessageChan(id int)

CloseMessageChan

@Description: 关闭session,即从等待队列中删除
@receiver b
@param id int

func (*Bot) DeleteEssenceMsg added in v1.0.12

func (b *Bot) DeleteEssenceMsg(messageId int)

func (*Bot) DeleteMsg

func (b *Bot) DeleteMsg(messageId int32)

DeleteMsg

@Description:
@receiver b
@param messageId int32

func (*Bot) DownloadFile

func (b *Bot) DownloadFile(url string, threadCount int, headers []string) DownloadFilePath

DownloadFile

@Description:
@receiver b
@param url string
@param threadCount int
@param headers []string
@return DownloadFilePath

func (*Bot) GetCookies

func (b *Bot) GetCookies(domain string) Cookie

GetCookies

@Description:
@receiver b
@param domain string
@return Cookie

func (*Bot) GetCredentials

func (b *Bot) GetCredentials(domain string) Credentials

GetCredentials

@Description:
@receiver b
@param domain string
@return Credentials

func (*Bot) GetCsrfToken

func (b *Bot) GetCsrfToken() CsrfToken

GetCsrfToken

@Description:
@receiver b
@return CsrfToken

func (*Bot) GetEssenceMsgList added in v1.0.12

func (b *Bot) GetEssenceMsgList(groupId int)

func (*Bot) GetForwardMsg

func (b *Bot) GetForwardMsg(messageId int) []ForwardMsg

GetForwardMsg

@Description:
@receiver b
@param messageId int
@return []ForwardMsg

func (*Bot) GetFriendList

func (b *Bot) GetFriendList() []FriendList

GetFriendList

@Description:
@receiver b
@return []FriendList

func (*Bot) GetGroupAtAllRemain

func (b *Bot) GetGroupAtAllRemain(groupId int) GroupAtAllRemain

GetGroupAtAllRemain

@Description:
@receiver b
@param groupId int
@return GroupAtAllRemain

func (*Bot) GetGroupFileSystemInfo

func (b *Bot) GetGroupFileSystemInfo(groupId int) GroupFileSystemInfo

GetGroupFileSystemInfo

@Description:
@receiver b
@param groupId int
@return GroupFileSystemInfo

func (*Bot) GetGroupFileUrl

func (b *Bot) GetGroupFileUrl(groupId int, fileId string, busid int) FileUrl

GetGroupFileUrl

@Description:
@receiver b
@param groupId int
@param fileId string
@param busid int
@return FileUrl

func (*Bot) GetGroupFilesByFolder

func (b *Bot) GetGroupFilesByFolder(groupId int, folderId string) GroupFilesByFolder

GetGroupFilesByFolder

@Description:
@receiver b
@param groupId int
@param folderId string
@return GroupFilesByFolder

func (*Bot) GetGroupHonorInfo

func (b *Bot) GetGroupHonorInfo(groupId int, honorType string) GroupHonorInfo

GetGroupHonorInfo

@Description:
@receiver b
@param groupId int
@param honorType string
@return GroupHonorInfo

func (*Bot) GetGroupInfo

func (b *Bot) GetGroupInfo(groupId int, noCache bool) GroupInfo

GetGroupInfo

@Description:
@receiver b
@param groupId int
@param noCache bool
@return GroupInfo

func (*Bot) GetGroupList

func (b *Bot) GetGroupList() []GroupInfo

GetGroupList

@Description:
@receiver b
@return []GroupInfo

func (*Bot) GetGroupMemberInfo

func (b *Bot) GetGroupMemberInfo(groupId int, userId int, noCache bool) GroupMemberInfo

GetGroupMemberInfo

@Description:
@receiver b
@param groupId int
@param userId int
@param noCache bool
@return GroupMemberInfo

func (*Bot) GetGroupMemberList

func (b *Bot) GetGroupMemberList(groupId int) []GroupMemberInfo

GetGroupMemberList

@Description:
@receiver b
@param groupId int
@return []GroupMemberInfo

func (*Bot) GetGroupMsgHistory

func (b *Bot) GetGroupMsgHistory(messageSeq int64, groupId int) MessageHistory

GetGroupMsgHistory

@Description:
@receiver b
@param messageSeq int64
@param groupId int
@return MessageHistory

func (*Bot) GetGroupRootFiles

func (b *Bot) GetGroupRootFiles(groupId int) GroupRootFiles

GetGroupRootFiles

@Description:
@receiver b
@param groupId int
@return GroupRootFiles

func (*Bot) GetGroupSystemMsg

func (b *Bot) GetGroupSystemMsg() GroupSystemMsg

GetGroupSystemMsg

@Description:
@receiver b
@return GroupSystemMsg

func (*Bot) GetImage

func (b *Bot) GetImage(file string) Image

GetImage

@Description:
@receiver b
@param file string
@return Image

func (*Bot) GetLoginInfo

func (b *Bot) GetLoginInfo() LoginInfo

GetLoginInfo

@Description:
@receiver b
@return LoginInfo

func (*Bot) GetMoreEvent

func (b *Bot) GetMoreEvent(rules ...Rule) (int, chan Event)

GetMoreEvent

@Description: 获取一个通道不断从用户获取消息
@receiver b
@param rules ...Rule
@return int  int 对应session在队列中的编号,后面关闭需要该编号
@return chan  Event  事件通道

func (*Bot) GetMsg

func (b *Bot) GetMsg(messageId int32) GetMessage

GetMsg

@Description:
@receiver b
@param messageId int32
@return GetMessage

func (*Bot) GetMsgSpecial

func (b *Bot) GetMsgSpecial(messageId int) MsgData

GetMsgSpecial

@Description:
@receiver b
@param messageId int
@return MsgData

func (*Bot) GetOneEvent

func (b *Bot) GetOneEvent(rules ...Rule) (Event, error)

GetOneEvent

@Description: 向session队列里面添加一个对象,等待用户的响应,设置超时时间
@receiver b
@param rules ...Rule
@return Event  Event
@return error  error

func (*Bot) GetOnlineClients

func (b *Bot) GetOnlineClients(noCache bool) Clients

GetOnlineClients

@Description:
@receiver b
@param noCache bool
@return Clients

func (*Bot) GetRecord

func (b *Bot) GetRecord(file, outFormat string) Record

GetRecord

@Description:
@receiver b
@param file file
@param outFormat string
@return Record

func (*Bot) GetStatus

func (b *Bot) GetStatus() OnlineStatus

GetStatus

@Description:
@receiver b
@return OnlineStatus

func (*Bot) GetStrangerInfo

func (b *Bot) GetStrangerInfo(userId int, noCache bool) Senders

GetStrangerInfo

@Description:
@receiver b
@param userId int
@param noCache bool
@return Senders

func (*Bot) GetVipInfoTest

func (b *Bot) GetVipInfoTest(UserId int) VipInfo

GetVipInfoTest

@Description:
@receiver b
@param UserId int
@return VipInfo

func (*Bot) GetWordSlices

func (b *Bot) GetWordSlices(content string) []string

GetWordSlices

@Description:
@receiver b
@param content string
@return []string

func (*Bot) OcrImage

func (b *Bot) OcrImage(image string) OcrImage

OcrImage

@Description:
@receiver b
@param image string
@return OcrImage

func (*Bot) ReloadEventFilter

func (b *Bot) ReloadEventFilter()

ReloadEventFilter

@Description:
@receiver b

func (*Bot) Send

func (b *Bot) Send(event Event, message interface{}) int

Send

@Description:
@receiver b
@param event Event
@param message string
@return int

func (*Bot) SendAt

func (b *Bot) SendAt(event Event, message interface{}) int

SendAt

@Description:
@receiver b
@param event Event
@param message string
@return int

func (*Bot) SendGroupForwardMsg

func (b *Bot) SendGroupForwardMsg(groupId int, messages interface{})

SendGroupForwardMsg

@Description:
@receiver b
@param groupId int
@param messages []Node

func (*Bot) SendGroupMsg

func (b *Bot) SendGroupMsg(groupId int, message interface{}) int32

SendGroupMsg *

  • @Description:
  • @receiver b
  • @param groupId
  • @param message
  • @return int32

func (*Bot) SendGroupNotice

func (b *Bot) SendGroupNotice(groupId int, content string)

SendGroupNotice

@Description:
@receiver b
@param groupId int
@param content string

func (*Bot) SendLike

func (b *Bot) SendLike(userId int, times int)

SendLike

@Description:
@receiver b
@param userId int
@param times int

func (*Bot) SendMsg

func (b *Bot) SendMsg(messageType string, userId int, groupId int, message interface{}) int32

SendMsg

@Description:
@receiver b
@param messageType string
@param userId int
@param groupId int
@param message string
@param autoEscape bool
@return int32

func (*Bot) SendPrivateMsg

func (b *Bot) SendPrivateMsg(userId int, message interface{}) int32

SendPrivateMsg

@Description:
@receiver b
@param userId int
@param message string
@param autoEscape bool
@return int32

func (*Bot) SetEssenceMsg added in v1.0.12

func (b *Bot) SetEssenceMsg(messageId int)

func (*Bot) SetFriendAddRequest

func (b *Bot) SetFriendAddRequest(flag string, approve bool, remark string)

SetFriendAddRequest

@Description:
@receiver b
@param flag string
@param approve bool
@param remark string

func (*Bot) SetGroupAddRequest

func (b *Bot) SetGroupAddRequest(flag string, subType string, approve bool, reason string)

SetGroupAddRequest

@Description:
@receiver b
@param flag string
@param subType string
@param approve bool
@param reason string

func (*Bot) SetGroupAdmin

func (b *Bot) SetGroupAdmin(groupId int, userId int, enable bool)

SetGroupAdmin

@Description:
@receiver b
@param groupId int
@param userId int
@param enable bool

func (*Bot) SetGroupAnonymous

func (b *Bot) SetGroupAnonymous(groupId int, enable bool)

SetGroupAnonymous

@Description:
@receiver b
@param groupId int
@param enable bool

func (*Bot) SetGroupAnonymousBan

func (b *Bot) SetGroupAnonymousBan(groupId int, flag string, duration int)

SetGroupAnonymousBan

@Description:
@receiver b
@param groupId int
@param flag string
@param duration int

func (*Bot) SetGroupBan

func (b *Bot) SetGroupBan(groupId int, userId int, duration int)

SetGroupBan

@Description:
@receiver b
@param groupId int
@param userId int
@param duration int

func (*Bot) SetGroupCard

func (b *Bot) SetGroupCard(groupId int, userId int, card string)

SetGroupCard

@Description:
@receiver b
@param groupId int
@param userId int
@param card string

func (*Bot) SetGroupKick

func (b *Bot) SetGroupKick(groupId int, userId int, rejectAddRequest bool)

SetGroupKick

@Description:
@receiver b
@param groupId int
@param userId int
@param rejectAddRequest bool

func (*Bot) SetGroupLeave

func (b *Bot) SetGroupLeave(groupId int, isDisMiss bool)

SetGroupLeave

@Description:
@receiver b
@param groupId int
@param isDisMiss bool

func (*Bot) SetGroupName

func (b *Bot) SetGroupName(groupId int, groupName string)

SetGroupName

@Description:
@receiver b
@param groupId int
@param groupName string

func (*Bot) SetGroupNameSpecial

func (b *Bot) SetGroupNameSpecial(groupId int, groupName string)

SetGroupNameSpecial

@Description:
@receiver b
@param groupId int
@param groupName string

func (*Bot) SetGroupPortrait

func (b *Bot) SetGroupPortrait(groupId int, file string, cache int)

SetGroupPortrait

@Description:
@receiver b
@param groupId int
@param file string
@param cache int

func (*Bot) SetGroupSpecialTitle

func (b *Bot) SetGroupSpecialTitle(groupId int, userId int, specialTitle string, duration int)

SetGroupSpecialTitle

@Description:
@receiver b
@param groupId int
@param userId int
@param specialTitle string
@param duration int

func (*Bot) SetGroupWholeBan

func (b *Bot) SetGroupWholeBan(groupId int, enable bool)

SetGroupWholeBan

@Description:
@receiver b
@param groupId int
@param enable bool

func (*Bot) SetRestart

func (b *Bot) SetRestart(delay int)

SetRestart

@Description:
@receiver b
@param delay int

func (*Bot) UploadGroupFile

func (b *Bot) UploadGroupFile(groupId int, file string, name string, folder string)

UploadGroupFile

@Description:
@receiver b
@param groupId int
@param file string
@param name string
@param folder string

type Clients

type Clients struct {
	Clients []Device `json:"clients"` //在线客户端列表
}

type CommandChain

type CommandChain []*commandHandle

func (CommandChain) Len

func (c CommandChain) Len() int

func (CommandChain) Less

func (c CommandChain) Less(i, j int) bool

func (CommandChain) Swap

func (c CommandChain) Swap(i, j int)

type CommandInt

type CommandInt interface {
	SetPluginName(name string) *commandHandle
	AddAllies(allies string) *commandHandle
	AddRule(rule Rule) *commandHandle
	SetWeight(weight int) *commandHandle
	SetBlock(IsBlock bool) *commandHandle
	AddHandle(func(event Event, bot *Bot, args []string))
	SetCD(types string, long int) *commandHandle
}

type Config

type Config struct {
	Bots      []*Bot `json:"bots"`
	Admin     int    `json:"admin"`
	Host      string `json:"host"`
	Port      int    `json:"port"`
	LogLevel  string `json:"log_level"`
	SuperUser []int  `json:"super_user"`
	Plugins   struct {
		FlashGroupID    int    `json:"flash_group_id"`
		AlApiToken      string `json:"al_api_token"`
		EnableReplyTome bool   `json:"enable_reply_tome"`
		Welcome         []struct {
			GroupId int    `json:"group_id"`
			Message string `json:"message"`
		} `json:"welcome"`
		GithubToken string `json:"github_token"`
	} `json:"plugins"`
}

type Connect

type Connect struct {
	SelfID     int
	Host       string
	ClientRole string
}

type ConnectChain

type ConnectChain []*connectHandle

type ConnectInt

type ConnectInt interface {
	SetPluginName(name string) *connectHandle
	AddHandle(func(connect Connect, bot *Bot))
}

type ConstMessageType

type ConstMessageType struct {
	Group   string
	Private string
}

type ConstNoticeType

type ConstNoticeType struct {
	GroupUpload   string //群文件上传
	GroupAdmin    string //群管理员变动
	GroupDecrease string //群成员减少
	GroupIncrease string //群成员增加
	GroupBan      string //群禁言
	FriendAdd     string //好友添加
	GroupRecall   string //群消息撤回
	FriendRecall  string //好友消息撤回
	Notify        string //群内戳一戳,群红包运气王,群成员荣誉变更,好友戳一戳
	GroupCard     string //群成员名片更新
	OfflineFile   string //接收到离线文件
}

type Content

type Content struct {
	Type string `json:"type"`
	Data string `json:"data"`
}
type Cookie struct {
	Cookies string `json:"cookies"`
}

type Credentials

type Credentials struct {
	Cookie
	CsrfToken
}

type CsrfToken

type CsrfToken struct {
	Token string `json:"token"`
}

type CurrentTalkativeS

type CurrentTalkativeS struct {
	UserId   int    `json:"user_id"`
	NickName string `json:"nick_name"`
	Avatar   string `json:"avatar"`
	DayCount int    `json:"day_count"`
}

type Device

type Device struct {
	AppId      int64  `json:"app_id"`      //客户端ID
	DeviceName string `json:"device_name"` //设备名称
	DeviceKind string `json:"device_kind"` //设备类型
}

type DisConnectChain

type DisConnectChain []*disConnectHandle

type DisConnectInt

type DisConnectInt interface {
	SetPluginName(name string) *disConnectHandle
	AddHandle(func(selfId int))
}

type DownloadFilePath

type DownloadFilePath struct {
	File string `json:"file"`
}

type Event

type Event struct {
	Anonymous     anonymous        `json:"anonymous"`
	Font          int              `json:"font"`
	GroupId       int              `json:"group_id"`
	Message       message2.Message `json:"message"`
	MessageType   string           `json:"message_type"`
	PostType      string           `json:"post_type"`
	RawMessage    string           `json:"raw_message"`
	SelfId        int              `json:"self_id"`
	Sender        Senders          `json:"sender"`
	SubType       string           `json:"sub_type"`
	UserId        int              `json:"user_id"`
	Time          int              `json:"time"`
	NoticeType    string           `json:"notice_type"`
	RequestType   string           `json:"request_type"`
	Comment       string           `json:"comment"`
	Flag          string           `json:"flag"`
	OperatorId    int              `json:"operator_id"`
	File          Files            `json:"file"`
	Duration      int64            `json:"duration"`
	TargetId      int64            `json:"target_id"` //运气王id
	HonorType     string           `json:"honor_type"`
	MetaEventType string           `json:"meta_event_type"`
	Status        Status           `json:"status"`
	Interval      int              `json:"interval"`
	CardNew       string           `json:"card_new"` //新名片
	CardOld       string           `json:"card_old"` //旧名片
	MessageIds
}

func (Event) GetImages added in v1.0.15

func (e Event) GetImages() []message.MessageSegment

func (Event) GetMsg

func (e Event) GetMsg() message.Message

GetMsg *

  • @Description:
  • @receiver e
  • @return message.Message

func (Event) GetPlainText added in v1.0.15

func (e Event) GetPlainText() string

type File

type File struct {
	FileId        string `json:"file_id"`        //文件ID
	FileName      string `json:"file_name"`      //文件名
	Busid         int    `json:"busid"`          //文件类型
	FileSize      int64  `json:"file_size"`      //文件大小
	UploadTime    int64  `json:"upload_time"`    //上传时间
	DeadTime      int64  `json:"dead_time"`      //过期时间,永久文件恒为0
	ModifyTime    int64  `json:"modify_time"`    //最后修改时间
	DownloadTimes int32  `json:"download_times"` //下载次数
	Uploader      int64  `json:"uploader"`       //上传者ID
	UploaderName  string `json:"uploader_name"`  //上传者名字
}

type FileUrl

type FileUrl struct {
	Url string `json:"url"`
}

type Files

type Files struct {
	Id      string `json:"id"`
	Name    string `json:"name"`
	Size    int64  `json:"size"`
	Busid   int64  `json:"busid"`
	FileUrl string `json:"url"`
}

type Folder

type Folder struct {
	FolderId       string `json:"folder_id"`        //文件夹ID
	FolderName     string `json:"folder_name"`      //文件名
	CreateTime     int    `json:"create_time"`      //创建时间
	Creator        int    `json:"creator"`          //创建者
	CreatorName    string `json:"creator_name"`     //创建者名字
	TotalFileCount int32  `json:"total_file_count"` //子文件数量
}

type ForwardMsg

type ForwardMsg struct {
	Content string  `json:"content"`
	Sender  Senders `json:"sender"`
	Time    int     `json:"time"`
}

type FriendList

type FriendList struct {
	UserId   int    `json:"user_id"`
	NickName string `json:"nick_name"`
	Remark   string `json:"remark"`
}

type GetMessage

type GetMessage struct {
	Time      int32            `json:"time"`
	Group     bool             `json:"group"`
	MessageId int32            `json:"message_id"`
	RealId    int32            `json:"real_id"`
	Sender    Senders          `json:"sender"`
	Message   message2.Message `json:"message"`
}

type GroupAtAllRemain

type GroupAtAllRemain struct {
	CanAtAll                 bool `json:"can_at_all"`                    //是否可以@全体成员
	RemainAtAllCountForGroup int  `json:"remain_at_all_count_for_group"` //群内所有管理当天剩余@全体成员次数
	RemainAtAllCountForUin   int  `json:"remain_at_all_count_for_uin"`   //BOT当天剩余@全体成员次数
}

type GroupFileSystemInfo

type GroupFileSystemInfo struct {
	FileCount  int `json:"file_count"`  //文件总数
	LimitCount int `json:"limit_count"` //文件上限
	UsedSpace  int `json:"used_space"`  //已使用空间
	TotalSpace int `json:"total_space"` //空间上限
}

type GroupFilesByFolder

type GroupFilesByFolder struct {
	Files   []File   `json:"files"`
	Folders []Folder `json:"folders"`
}

type GroupHonorInfo

type GroupHonorInfo struct {
	GroupId          int                  `json:"group_id"`
	CurrentTalkative CurrentTalkativeS    `json:"current_talkative"`
	TalkativeList    []GroupHonorInfoList `json:"talkative_list"`
	PerformerList    []GroupHonorInfoList `json:"performer_list"`
	LegendList       []GroupHonorInfoList `json:"legend_list"`
	StrongNewbieList []GroupHonorInfoList `json:"strong_newbie_list"`
	EmotionList      []GroupHonorInfoList `json:"emotion_list"`
}

type GroupHonorInfoList

type GroupHonorInfoList struct {
	UserId      int    `json:"user_id"`
	NickName    string `json:"nick_name"`
	Avatar      string `json:"avatar"`
	Description string `json:"description"`
}

type GroupInfo

type GroupInfo struct {
	GroupId        int    `json:"group_id"`
	GroupName      string `json:"group_name"`
	MemberCount    int    `json:"member_count"`
	MaxMemberCount int    `json:"max_member_count"`
}

type GroupMemberInfo

type GroupMemberInfo struct {
	GroupId         int  `json:"group_id"`
	JoinTime        int  `json:"join_time"`
	LastSentTime    int  `json:"last_sent_time"`
	Unfriendly      bool `json:"unfriendly"`
	TitleExpireTime int  `json:"title_expire_time"`
	CardChangeable  bool `json:"card_changeable"`
	Senders
}

type GroupRootFiles

type GroupRootFiles struct {
	Files   []File   `json:"files"`
	Folders []Folder `json:"folders"`
}

type GroupSystemMsg

type GroupSystemMsg struct {
	InvitedRequests []InvitedRequest `json:"invited_requests"` //邀请消息列表
	JoinRequests    []JoinRequest    `json:"join_requests"`    //进群消息列表
}

type Image

type Image struct {
	File string `json:"file"`
}

type IncreaseApi

type IncreaseApi interface {
	DownloadFile(url string, threadCount int, headers []string) DownloadFilePath
	GetGroupMsgHistory(messageSeq int64, groupId int) MessageHistory
	GetOnlineClients(noCache bool) Clients
	GetVipInfoTest(UserId int) VipInfo
	SendGroupNotice(groupId int, content string)
	ReloadEventFilter()
	UploadGroupFile(groupId int, file string, name string, folder string) error
	GetStatus() Status
	SetEssenceMsg(messageId int)
	DeleteEssenceMsg(messageId int)
	GetEssenceMsgList(groupId int)
	CheckUrlSafely(url string) int
}

IncreaseApi /*

@Description:

type InvitedRequest

type InvitedRequest struct {
	RequestId   int    `json:"request_id"`   //请求ID
	InvitorUin  int    `json:"invitor_uin"`  //邀请者
	InvitorNick string `json:"invitor_nick"` //邀请者昵称
	GroupId     int    `json:"group_id"`     //群号
	GroupName   string `json:"group_name"`   //群名
	Checked     bool   `json:"checked"`      //是否已被处理
	Actor       int64  `json:"actor"`        //处理者, 未处理为0
}

type JoinRequest

type JoinRequest struct {
	RequestId     int    `json:"request_id"`     //请求ID
	RequesterUin  int    `json:"requester_uin"`  //请求者ID
	RequesterNick string `json:"requester_nick"` //请求者昵称
	Message       string `json:"message"`        //验证消息
	GroupId       int    `json:"group_id"`       //群号
	GroupName     string `json:"group_name"`     //群名
	Checked       bool   `json:"checked"`        //是否已被处理
	Actor         int    `json:"actor"`          //处理者, 未处理为0
}

type LoginInfo

type LoginInfo struct {
	UserId   int    `json:"user_id"`
	NickName string `json:"nick_name"`
}

type M

type M interface {
	// contains filtered or unexported methods
}

M

通过id从插件列表获取插件
所有的插件队列都实现了该接口

type MessageChain

type MessageChain []*messageHandle

func (MessageChain) Len

func (m MessageChain) Len() int

func (MessageChain) Less

func (m MessageChain) Less(i, j int) bool

func (MessageChain) Swap

func (m MessageChain) Swap(i, j int)

type MessageHistory

type MessageHistory struct {
	Messages []string `json:"messages"`
}

type MessageIds

type MessageIds struct {
	MessageID int32 `json:"message_id"`
}

type MessageInt

type MessageInt interface {
	SetPluginName(name string) *messageHandle
	AddRule(rule Rule) *messageHandle
	SetWeight(weight int) *messageHandle
	AddHandle(func(event Event, bot *Bot))
}

type MetaChain

type MetaChain []*metaHandle

func (MetaChain) Len

func (m MetaChain) Len() int

func (MetaChain) Less

func (m MetaChain) Less(i, j int) bool

func (MetaChain) Swap

func (m MetaChain) Swap(i, j int)

type MetaInt

type MetaInt interface {
	SetPluginName(name string) *metaHandle
	AddRule(rule Rule) *metaHandle
	SetWeight(weight int) *metaHandle
	AddHandle(func(event Event, bot *Bot))
}

type MsgData

type MsgData struct {
	MessageId int     `json:"message_id"`
	RealId    int     `json:"real_id"`
	Sender    Senders `json:"sender"`
	Time      int     `json:"time"`
	Message   string  `json:"message"`
}

type Node

type Node struct {
	Id      int     `json:"id"`
	Name    string  `json:"name"`
	Uin     int     `json:"uin"`
	Content Content `json:"content"`
}

type NoticeChain

type NoticeChain []*noticeHandle

func (NoticeChain) Len

func (n NoticeChain) Len() int

func (NoticeChain) Less

func (n NoticeChain) Less(i, j int) bool

func (NoticeChain) Swap

func (n NoticeChain) Swap(i, j int)

type NoticeInt

type NoticeInt interface {
	SetPluginName(name string) *noticeHandle
	AddRule(rule Rule) *noticeHandle
	SetWeight(weight int) *noticeHandle
	AddHandle(func(event Event, bot *Bot))
}

type OcrImage

type OcrImage struct {
	Texts    []TextDetection `json:"texts"`
	Language string          `json:"language"`
}

type OnlineStatus

type OnlineStatus struct {
	Online bool `json:"online"`
	Good   bool `json:"good"`
}

type PretreatmentChain

type PretreatmentChain []*PretreatmentHandle

func (PretreatmentChain) Len

func (p PretreatmentChain) Len() int

func (PretreatmentChain) Less

func (p PretreatmentChain) Less(i, j int) bool

func (PretreatmentChain) Swap

func (p PretreatmentChain) Swap(i, j int)

type PretreatmentHandle

type PretreatmentHandle struct {
	BaseHandle
	// contains filtered or unexported fields
}

func OnPretreatment

func OnPretreatment() *PretreatmentHandle

OnPretreatment *

  • @Description: 预处理事件
  • @return *PretreatmentHandle
  • example

func (*PretreatmentHandle) AddHandle

func (p *PretreatmentHandle) AddHandle(f func(event Event, bot *Bot) bool)

AddHandle *

  • @Description:
  • @receiver p
  • @param f

func (*PretreatmentHandle) AddRule

func (p *PretreatmentHandle) AddRule(rule Rule) *PretreatmentHandle

AddRule *

  • @Description:
  • @receiver p
  • @param rule
  • @return PretreatmentHandle

func (*PretreatmentHandle) SetPluginName

func (p *PretreatmentHandle) SetPluginName(name string) *PretreatmentHandle

func (*PretreatmentHandle) SetWeight

func (p *PretreatmentHandle) SetWeight(weight int) *PretreatmentHandle

SetWeight *

  • @Description:
  • @receiver p
  • @param weight
  • @return PretreatmentHandle

type PretreatmentInt

type PretreatmentInt interface {
	SetPluginName(name string) *PretreatmentHandle
	AddRule(rule Rule) *PretreatmentHandle
	SetWeight(weight int) *PretreatmentHandle
	AddHandle(func(event Event, bot *Bot) bool)
}

type QuickUseApi

type QuickUseApi interface {
	CallApi(Action string, param interface{}) interface{}
	Send(event Event, message interface{}) int
	SendAt(event Event, message interface{}) int
}

type Record

type Record struct {
	File      string `json:"file"`
	OutFormat string `json:"out_format"`
}

type RequestChain

type RequestChain []*requestHandle

func (RequestChain) Len

func (r RequestChain) Len() int

func (RequestChain) Less

func (r RequestChain) Less(i, j int) bool

func (RequestChain) Swap

func (r RequestChain) Swap(i, j int)

type RequestInt

type RequestInt interface {
	SetPluginName(name string) *requestHandle
	AddRule(rule Rule) *requestHandle
	SetWeight(weight int) *requestHandle
	AddHandle(func(event Event, bot *Bot))
}

type Rule

type Rule func(Event, *Bot, *State) bool

type Senders

type Senders struct {
	Age      int    `json:"age"`
	Area     string `json:"area"`
	Card     string `json:"card"`
	Level    string `json:"level"`
	NickName string `json:"nickname"`
	Role     string `json:"role"`
	Sex      string `json:"sex"`
	Title    string `json:"title"`
	UserId   int    `json:"user_id"`
}

type SpecialApi

type SpecialApi interface {
	SetGroupNameSpecial(groupId int, groupName string)
	SetGroupPortrait(groupId int, file string, cache int)
	GetMsgSpecial(messageId int) MsgData
	GetForwardMsg(messageId int) []ForwardMsg
	SendGroupForwardMsg(groupId int, messages interface{})
	GetWordSlices(content string) []string
	OcrImage(image string) OcrImage
	GetGroupSystemMsg() GroupSystemMsg
	GetGroupFileSystemInfo(groupId int) GroupFileSystemInfo
	GetGroupRootFiles(groupId int) GroupRootFiles
	GetGroupFilesByFolder(groupId int, folderId string) GroupFilesByFolder
	GetGroupFileUrl(groupId int, fileId string, busid int) FileUrl
	GetGroupAtAllRemain(groupId int) GroupAtAllRemain
}

type State added in v1.0.21

type State struct {
	Args        []string
	Cmd         string
	Allies      []string
	RegexResult []string
	Data        map[string]interface{}
}

State @Description: sdk处理消息后将内容传递给plugin

type Status

type Status struct {
	AppEnabled     bool        `json:"app_enabled"`
	AppGood        bool        `json:"app_good"`
	AppInitialized bool        `json:"app_initialized"`
	Good           bool        `json:"good"`
	Online         bool        `json:"online"`
	PluginsGood    interface{} `json:"plugins_good"`
	Stat           struct {
		PacketReceived  int `json:"packet_received"`
		PacketSent      int `json:"packet_sent"`
		PacketLost      int `json:"packet_lost"`
		MessageReceived int `json:"message_received"`
		MessageSent     int `json:"message_sent"`
		DisconnectTimes int `json:"disconnect_times"`
		LostTimes       int `json:"lost_times"`
		LastMessageTime int `json:"last_message_time"`
	} `json:"stat"`
}

type TextDetection

type TextDetection struct {
	Text        string      `json:"text"`
	Confidence  int         `json:"confidence"`
	Coordinates interface{} `json:"coordinates"`
}

type UseApi

type UseApi struct {
	Action string      `json:"action"`
	Params interface{} `json:"params"`
	Echo   string      `json:"echo"`
}

type VipInfo

type VipInfo struct {
	UserId         int64   `json:"user_id"`          //QQ 号
	Nickname       string  `json:"nickname"`         //用户昵称
	Level          int64   `json:"level"`            //QQ 等级
	LevelSpeed     float64 `json:"level_speed"`      //等级加速度
	VipLevel       string  `json:"vip_level"`        //会员等级
	VipGrowthSpeed int64   `json:"vip_growth_speed"` //会员成长速度
	VipGrowthTotal int64   `json:"vip_growth_total"` //会员成长总值
}

Directories

Path Synopsis
gui
groupWelcome
Package groupWelcome /**
Package groupWelcome /**
ph

Jump to

Keyboard shortcuts

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