search

package
v0.0.0-...-a0ccaba Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const SearchID = "search" // ID

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Commands map[string][]string `json:"commands"` // 命令关键字
	Reply    Reply               `json:"reply"`    // 回复配置
}

配置

type Reply

type Reply struct {
	SearchFailed     string `json:"searchFailed"`     // 搜索失败的回复
	SendResultFailed string `json:"sendResultFailed"` // 发送搜索结果失败的回复
}

回复配置

type Search interface {
	// 搜索text
	Search(text string) ([]search_utils.SearchResult, error)
}

搜索接口

type SearchBot

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

搜索机器人

func NewSearchBot

func NewSearchBot(config *Config) *SearchBot

新建搜索机器人

func (*SearchBot) HandleGroupMessage

func (b *SearchBot) HandleGroupMessage(qqClient *client.QQClient, msg *message.GroupMessage, cmd map[interface{}]struct{}, keyword string)

处理群聊消息,实现Command接口

func (*SearchBot) HandlePrivateMessage

func (b *SearchBot) HandlePrivateMessage(qqClient *client.QQClient, msg *message.PrivateMessage, cmd map[interface{}]struct{}, keyword string)

处理私聊消息,实现Command接口

func (*SearchBot) SetConfig

func (b *SearchBot) SetConfig(cmd map[string][]interface{}) map[string][]interface{}

部分配置没有设置的话采用默认配置,设置cmd,返回设置好的cmd,实现Command接口

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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