chat

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const DIYDialogueLevelKey = "diylevel"

Variables

This section is empty.

Functions

func AIReply added in v0.3.1

func AIReply(ctx *zero.Ctx, question string) message.Message

func AddDialogueCollection added in v0.1.4

func AddDialogueCollection(groupID int64, dc *DialoguesCollection)

AddDialogueCollection 以 DialoguesCollection 的形式添加问答集,仅在本次运行中生效

func DIYDialogue

func DIYDialogue(ctx *zero.Ctx, question string) message.Message

DIYDialogue Dealer: 用户自定义对话

func DeleteDialogue

func DeleteDialogue(groupID int64, question string) error

DeleteDialogue 根据问题删除一个问答

func GetAllQuestion

func GetAllQuestion(groupID int64) []string

GetAllQuestion 获取指定个群可以触发的所有问答的问题

func GetDialogue

func GetDialogue(ctx *zero.Ctx, groupID int64, question string) message.Message

GetDialogue 根据群号和问题获取answer消息

func GetDialogueByFilesRandom added in v0.1.2

func GetDialogueByFilesRandom(ctx *zero.Ctx, groupID int64, question string) message.Message

GetDialogueByFilesRandom 随机获取一条答句(来自文件)消息

func GetSpecQuestion added in v0.2.0

func GetSpecQuestion(groupID int64, index int) string

GetSpecQuestion 获取GetAllQuestion中的qs[i]问句

func IDoNotKnow

func IDoNotKnow(ctx *zero.Ctx, question string) message.Message

IDoNotKnow Dealer: XX不知道

func LoadDialoguesFromDir added in v0.1.2

func LoadDialoguesFromDir(dir string)

LoadDialoguesFromDir 从文件夹中读取问答集

func PluginName added in v0.1.1

func PluginName(ctx *zero.Ctx, question string) message.Message

PluginName Dealer: 问题为插件名,返回帮助信息

func SetDialogue

func SetDialogue(groupID int64, question string, answer message.Message) error

SetDialogue 新增或修改一个问答

func WhoAreYou

func WhoAreYou(ctx *zero.Ctx, question string) message.Message

WhoAreYou Dealer: 自我介绍

Types

type Dealer

type Dealer func(ctx *zero.Ctx, question string) message.Message

type DialoguesCollection added in v0.1.4

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

DialoguesCollection 一个问答集

func ParseDialoguesFile added in v0.1.2

func ParseDialoguesFile(filename string) (dc *DialoguesCollection, err error)

ParseDialoguesFile 解析问答集文件

func (*DialoguesCollection) AutoSeparateReg added in v0.1.4

func (dc *DialoguesCollection) AutoSeparateReg() error

AutoSeparateReg 自动从全匹配map中分离出正则

func (DialoguesCollection) Length added in v0.1.4

func (dc DialoguesCollection) Length() int

Length 获取问答集的问句个数

func (DialoguesCollection) Load added in v0.1.4

func (dc DialoguesCollection) Load(question string) []string

Load 获取答句列表

func (*DialoguesCollection) Merge added in v0.1.4

func (dc *DialoguesCollection) Merge(another *DialoguesCollection)

Merge 与另一问答集合并

type GroupChatDialogue

type GroupChatDialogue struct {
	GroupID  int64  `gorm:"column:group_id;primaryKey;autoIncrement:false"`
	Question string `gorm:"column:question;primaryKey;autoIncrement:false;size:181"`
	Answer   string `gorm:"column:answer"`
}

Jump to

Keyboard shortcuts

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