coolq

package
v0.9.39 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2021 License: AGPL-3.0 Imports: 32 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ForceFragmented = false
View Source
var IgnoreInvalidCQCode = false
View Source
var SplitUrl = false
View Source
var Version = "unknown"

Functions

func CQCodeEscapeText added in v0.9.16

func CQCodeEscapeText(raw string) string

func CQCodeEscapeValue added in v0.9.18

func CQCodeEscapeValue(value string) string

func CQCodeUnescapeText added in v0.9.16

func CQCodeUnescapeText(content string) string

func CQCodeUnescapeValue added in v0.9.18

func CQCodeUnescapeValue(content string) string

func SetMessageFormat added in v0.9.18

func SetMessageFormat(f string)

SetMessageFormat 设置消息上报格式,默认为string

func ToFormattedMessage added in v0.9.18

func ToFormattedMessage(e []message.IMessageElement, id int64, raw ...bool) (r interface{})

ToFormattedMessage 将给定[]message.IMessageElement转换为通过coolq.SetMessageFormat所定义的消息上报格式

func ToGlobalId

func ToGlobalId(code int64, msgId int32) int32

func ToStringMessage

func ToStringMessage(e []message.IMessageElement, code int64, raw ...bool) (r string)

func XmlEscape added in v0.9.31

func XmlEscape(c string) string

Types

type CQBot

type CQBot struct {
	Client *client.QQClient
	// contains filtered or unexported fields
}

func NewQQBot

func NewQQBot(cli *client.QQClient, conf *global.JSONConfig) *CQBot

func (*CQBot) CQCanSendImage

func (bot *CQBot) CQCanSendImage() MSG

func (*CQBot) CQCanSendRecord

func (bot *CQBot) CQCanSendRecord() MSG

func (*CQBot) CQDownloadFile added in v0.9.38

func (bot *CQBot) CQDownloadFile(url string, headers map[string]string, threadCount int) MSG

func (*CQBot) CQGetAtAllRemain added in v0.9.35

func (bot *CQBot) CQGetAtAllRemain(groupId int64) MSG

func (*CQBot) CQGetForwardMessage added in v0.9.3

func (bot *CQBot) CQGetForwardMessage(resId string) MSG

func (*CQBot) CQGetGroupFileSystemInfo added in v0.9.30

func (bot *CQBot) CQGetGroupFileSystemInfo(groupId int64) MSG

func (*CQBot) CQGetGroupFileUrl added in v0.9.30

func (bot *CQBot) CQGetGroupFileUrl(groupId int64, fileId string, busId int32) MSG

func (*CQBot) CQGetGroupFilesByFolderId added in v0.9.30

func (bot *CQBot) CQGetGroupFilesByFolderId(groupId int64, folderId string) MSG

func (*CQBot) CQGetGroupMessageHistory added in v0.9.39

func (bot *CQBot) CQGetGroupMessageHistory(groupId int64, seq int64) MSG

func (*CQBot) CQGetGroupRootFiles added in v0.9.30

func (bot *CQBot) CQGetGroupRootFiles(groupId int64) MSG

func (*CQBot) CQGetGroupSystemMessages added in v0.9.30

func (bot *CQBot) CQGetGroupSystemMessages() MSG

func (*CQBot) CQGetImage

func (bot *CQBot) CQGetImage(file string) MSG

func (*CQBot) CQGetMessage added in v0.9.29

func (bot *CQBot) CQGetMessage(messageId int32) MSG

func (*CQBot) CQGetOnlineClients added in v0.9.39

func (bot *CQBot) CQGetOnlineClients(noCache bool) MSG

func (*CQBot) CQGetVersionInfo

func (bot *CQBot) CQGetVersionInfo() MSG

func (*CQBot) CQGetVipInfo added in v0.9.24

func (bot *CQBot) CQGetVipInfo(userId int64) MSG

func (*CQBot) CQGetWordSlices added in v0.9.27

func (bot *CQBot) CQGetWordSlices(content string) MSG

func (*CQBot) CQOcrImage added in v0.9.26

func (bot *CQBot) CQOcrImage(imageId string) MSG

func (*CQBot) CQReloadEventFilter added in v0.9.25

func (bot *CQBot) CQReloadEventFilter() MSG

func (*CQBot) CQSendGroupForwardMessage added in v0.9.4

func (bot *CQBot) CQSendGroupForwardMessage(groupId int64, m gjson.Result) MSG

func (*CQBot) CQSetGroupAnonymousBan added in v0.9.36

func (bot *CQBot) CQSetGroupAnonymousBan(groupId int64, flag string, duration int32) MSG

func (*CQBot) CQSetGroupMemo added in v0.9.24

func (bot *CQBot) CQSetGroupMemo(groupId int64, msg string) MSG

func (*CQBot) CQSetGroupName

func (bot *CQBot) CQSetGroupName(groupId int64, name string) MSG

func (*CQBot) CQSetGroupPortrait added in v0.9.26

func (bot *CQBot) CQSetGroupPortrait(groupId int64, file, cache string) MSG

func (*CQBot) ConvertObjectMessage added in v0.9.4

func (bot *CQBot) ConvertObjectMessage(m gjson.Result, group bool) (r []message.IMessageElement)

func (*CQBot) ConvertStringMessage

func (bot *CQBot) ConvertStringMessage(msg string, group bool) (r []message.IMessageElement)

func (*CQBot) GetMessage added in v0.9.29

func (bot *CQBot) GetMessage(mid int32) MSG

func (*CQBot) InsertGroupMessage

func (bot *CQBot) InsertGroupMessage(m *message.GroupMessage) int32

func (*CQBot) InsertPrivateMessage added in v0.9.29

func (bot *CQBot) InsertPrivateMessage(m *message.PrivateMessage) int32

func (*CQBot) OnEventPush

func (bot *CQBot) OnEventPush(f func(m MSG))

func (*CQBot) Release

func (bot *CQBot) Release()

func (*CQBot) SendGroupMessage

func (bot *CQBot) SendGroupMessage(groupId int64, m *message.SendingMessage) int32

func (*CQBot) SendPrivateMessage

func (bot *CQBot) SendPrivateMessage(target int64, m *message.SendingMessage) int32

func (*CQBot) ToElement

func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (m interface{}, err error)

ToElement 将解码后的CQCode转换为Element. 返回 interface{} 存在三种类型 message.IMessageElement []message.IMessageElement nil

func (*CQBot) UploadLocalImageAsGroup added in v0.9.37

func (bot *CQBot) UploadLocalImageAsGroup(groupCode int64, img *LocalImageElement) (*message.GroupImageElement, error)

func (*CQBot) UploadLocalImageAsPrivate added in v0.9.37

func (bot *CQBot) UploadLocalImageAsPrivate(userId int64, img *LocalImageElement) (*message.FriendImageElement, error)

func (*CQBot) UploadLocalVideo added in v0.9.38

func (bot *CQBot) UploadLocalVideo(target int64, v *LocalVideoElement) (*message.ShortVideoElement, error)

type CloudMusicElement added in v0.9.28

type CloudMusicElement struct {
	MusicElement
}

type GiftElement added in v0.9.27

type GiftElement struct {
	Target int64
	GiftId message.GroupGift
}

func (*GiftElement) Type added in v0.9.27

func (e *GiftElement) Type() message.ElementType

type LocalImageElement added in v0.9.37

type LocalImageElement struct {
	message.ImageElement
	Stream io.ReadSeeker
	File   string
}

type LocalVideoElement added in v0.9.38

type LocalVideoElement struct {
	message.ShortVideoElement
	File string
	// contains filtered or unexported fields
}

type LocalVoiceElement added in v0.9.37

type LocalVoiceElement struct {
	message.VoiceElement
	Stream io.ReadSeeker
}

type MSG

type MSG map[string]interface{}

func Failed

func Failed(code int, msg ...string) MSG

func OK

func OK(data interface{}) MSG

func ToArrayMessage added in v0.9.18

func ToArrayMessage(e []message.IMessageElement, code int64, raw ...bool) (r []MSG)

func (MSG) ToJson

func (m MSG) ToJson() string

type MiguMusicElement added in v0.9.30

type MiguMusicElement struct {
	MusicElement
}

type MusicElement added in v0.9.28

type MusicElement struct {
	Title      string
	Summary    string
	Url        string
	PictureUrl string
	MusicUrl   string
}

func (*MusicElement) Type added in v0.9.28

func (e *MusicElement) Type() message.ElementType

type PokeElement added in v0.9.25

type PokeElement struct {
	Target int64
}

func (*PokeElement) Type added in v0.9.25

func (e *PokeElement) Type() message.ElementType

type QQMusicElement added in v0.9.28

type QQMusicElement struct {
	MusicElement
}

Jump to

Keyboard shortcuts

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