mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 05:30:07 +08:00
恢复注册方式 (#491)
This commit is contained in:
parent
5d94980e7c
commit
6c2fc1b4c2
@ -152,7 +152,7 @@ func newttsmode() *ttsmode {
|
||||
tts := &ttsmode{}
|
||||
tts.Lock()
|
||||
defer tts.Unlock()
|
||||
m, ok := control.Lookup(ttsServiceName)
|
||||
m, ok := control.Lookup("tts")
|
||||
tts.mode = make(map[int64]int64, 2*len(soundList))
|
||||
tts.mode[-2905] = 1
|
||||
if ok {
|
||||
@ -229,7 +229,7 @@ func (tts *ttsmode) setDefaultSoundMode(name string) error {
|
||||
}
|
||||
tts.Lock()
|
||||
defer tts.Unlock()
|
||||
m, ok := control.Lookup(ttsServiceName)
|
||||
m, ok := control.Lookup("tts")
|
||||
if !ok {
|
||||
return errors.New("[tts] service not found")
|
||||
}
|
||||
|
||||
@ -17,15 +17,10 @@ import (
|
||||
"github.com/wdvxdr1123/ZeroBot/message"
|
||||
)
|
||||
|
||||
const (
|
||||
replyServiceName = "aireply"
|
||||
ttsServiceName = "tts"
|
||||
)
|
||||
|
||||
var replyModes = [...]string{"青云客", "小爱"}
|
||||
|
||||
func init() { // 插件主体
|
||||
enOftts := control.Register(ttsServiceName, &ctrl.Options[*zero.Ctx]{
|
||||
enOftts := control.Register("tts", &ctrl.Options[*zero.Ctx]{
|
||||
DisableOnDefault: true,
|
||||
Brief: "人工智能语音回复",
|
||||
Help: "- @Bot 任意文本(任意一句话回复)\n" +
|
||||
@ -35,7 +30,7 @@ func init() { // 插件主体
|
||||
"当前适用的原神人物含有以下:\n" + list(soundList[:], 5),
|
||||
})
|
||||
tts := newttsmode()
|
||||
enOfreply := control.Register(replyServiceName, &ctrl.Options[*zero.Ctx]{
|
||||
enOfreply := control.Register("aireply", &ctrl.Options[*zero.Ctx]{
|
||||
DisableOnDefault: false,
|
||||
Brief: "人工智能回复",
|
||||
Help: "- @Bot 任意文本(任意一句话回复)\n- 设置回复模式[青云客|小爱]",
|
||||
|
||||
@ -17,15 +17,10 @@ import (
|
||||
"github.com/FloatTech/zbputils/control"
|
||||
)
|
||||
|
||||
const (
|
||||
// 服务名
|
||||
servicename = "atri"
|
||||
// ATRI 表情的 codechina 镜像
|
||||
res = "https://gitcode.net/u011570312/zbpdata/-/raw/main/Atri/"
|
||||
)
|
||||
const res = "https://gitcode.net/u011570312/zbpdata/-/raw/main/Atri/"
|
||||
|
||||
func init() { // 插件主体
|
||||
engine := control.Register(servicename, &ctrl.Options[*zero.Ctx]{
|
||||
engine := control.Register("atri", &ctrl.Options[*zero.Ctx]{
|
||||
DisableOnDefault: false,
|
||||
Brief: "atri人格文本回复",
|
||||
Help: "本插件基于 ATRI ,为 Golang 移植版\n" +
|
||||
|
||||
@ -22,10 +22,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36"
|
||||
referer = "https://www.bilibili.com/"
|
||||
infoURL = "https://api.bilibili.com/x/space/acc/info?mid=%v"
|
||||
serviceName = "bilibilipush"
|
||||
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36"
|
||||
referer = "https://www.bilibili.com/"
|
||||
infoURL = "https://api.bilibili.com/x/space/acc/info?mid=%v"
|
||||
)
|
||||
|
||||
// bdb bilibili推送数据库
|
||||
@ -38,7 +37,7 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
en := control.Register(serviceName, &ctrl.Options[*zero.Ctx]{
|
||||
en := control.Register("bilibilipush", &ctrl.Options[*zero.Ctx]{
|
||||
DisableOnDefault: false,
|
||||
Brief: "b站推送",
|
||||
Help: "- 添加b站订阅[uid|name]\n" +
|
||||
@ -49,7 +48,7 @@ func init() {
|
||||
"Tips: 需要配合job一起使用, 全局只需要设置一个, 无视响应状态推送, 下为例子\n" +
|
||||
"记录在\"@every 5m\"触发的指令)\n" +
|
||||
"拉取b站推送",
|
||||
PrivateDataFolder: serviceName,
|
||||
PrivateDataFolder: "bilibilipush",
|
||||
})
|
||||
|
||||
// 加载bilibili推送数据库
|
||||
@ -276,7 +275,7 @@ func sendDynamic(ctx *zero.Ctx) error {
|
||||
ct := cardList[i].Get("desc.timestamp").Int()
|
||||
if ct > t && ct > time.Now().Unix()-600 {
|
||||
lastTime[buid] = ct
|
||||
m, ok := control.Lookup(serviceName)
|
||||
m, ok := control.Lookup("bilibilipush")
|
||||
if ok {
|
||||
groupList := bdb.getAllGroupByBuidAndDynamic(buid)
|
||||
dc, err := bz.LoadDynamicDetail(cardList[i].Raw)
|
||||
@ -325,7 +324,7 @@ func sendLive(ctx *zero.Ctx) error {
|
||||
oldStatus := liveStatus[key.Int()]
|
||||
if newStatus != oldStatus && newStatus == 1 {
|
||||
liveStatus[key.Int()] = newStatus
|
||||
m, ok := control.Lookup(serviceName)
|
||||
m, ok := control.Lookup("bilibilipush")
|
||||
if ok {
|
||||
groupList := bdb.getAllGroupByBuidAndLive(key.Int())
|
||||
roomID := value.Get("short_id").Int()
|
||||
|
||||
@ -13,10 +13,7 @@ import (
|
||||
"github.com/FloatTech/zbputils/ctxext"
|
||||
)
|
||||
|
||||
const (
|
||||
servicename = "epidemic"
|
||||
txurl = "https://api.inews.qq.com/newsqa/v1/query/inner/publish/modules/list?modules=statisGradeCityDetail,diseaseh5Shelf"
|
||||
)
|
||||
const txurl = "https://api.inews.qq.com/newsqa/v1/query/inner/publish/modules/list?modules=statisGradeCityDetail,diseaseh5Shelf"
|
||||
|
||||
// result 疫情查询结果
|
||||
type result struct {
|
||||
@ -50,7 +47,7 @@ type area struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
engine := control.Register(servicename, &ctrl.Options[*zero.Ctx]{
|
||||
engine := control.Register("epidemic", &ctrl.Options[*zero.Ctx]{
|
||||
DisableOnDefault: false,
|
||||
Brief: "城市疫情查询",
|
||||
Help: "- xxx疫情\n",
|
||||
|
||||
@ -32,8 +32,6 @@ import (
|
||||
"github.com/FloatTech/zbputils/img/text"
|
||||
)
|
||||
|
||||
const servicename = "guessmusic"
|
||||
|
||||
var (
|
||||
filelist []listinfo
|
||||
musictypelist = "mp3;MP3;wav;WAV;amr;AMR;3gp;3GP;3gpp;3GPP;acc;ACC"
|
||||
@ -42,7 +40,7 @@ var (
|
||||
)
|
||||
|
||||
func init() { // 插件主体
|
||||
engine := control.Register(servicename, &ctrl.Options[*zero.Ctx]{
|
||||
engine := control.Register("guessmusic", &ctrl.Options[*zero.Ctx]{
|
||||
DisableOnDefault: false,
|
||||
Brief: "猜歌插件",
|
||||
Help: "由于不可抗因素无法获取网易云歌单内容, 插件改为本地猜歌了, 但保留了下歌功能\n" +
|
||||
@ -74,7 +72,7 @@ func init() { // 插件主体
|
||||
)
|
||||
}),
|
||||
))
|
||||
serviceErr := "[" + servicename + "]"
|
||||
serviceErr := "[guessmusic]"
|
||||
// 用于存放歌曲三个片段的文件夹
|
||||
cachePath := engine.DataFolder() + "cache/"
|
||||
err := os.MkdirAll(cachePath, 0777)
|
||||
|
||||
@ -32,13 +32,11 @@ type value struct {
|
||||
|
||||
func init() {
|
||||
// 初始化engine
|
||||
engine := control.Register(
|
||||
"jikipedia",
|
||||
&ctrl.Options[*zero.Ctx]{
|
||||
DisableOnDefault: false,
|
||||
Brief: "小鸡词典",
|
||||
Help: "- [查梗|小鸡词典][梗]",
|
||||
},
|
||||
engine := control.Register("jikipedia", &ctrl.Options[*zero.Ctx]{
|
||||
DisableOnDefault: false,
|
||||
Brief: "小鸡词典",
|
||||
Help: "- [查梗|小鸡词典][梗]",
|
||||
},
|
||||
)
|
||||
engine.OnPrefixGroup([]string{"小鸡词典", "查梗"}).Limit(ctxext.LimitByGroup).SetBlock(true).Handle(
|
||||
func(ctx *zero.Ctx) {
|
||||
|
||||
@ -52,9 +52,9 @@ const (
|
||||
"- 设置告别辞 参数同设置欢迎语\n" +
|
||||
"- 测试告别辞\n" +
|
||||
"- [开启 | 关闭]入群验证\n" +
|
||||
"- 对信息回复:[设置 | 取消]精华" +
|
||||
"- 取消精华 [信息ID]" +
|
||||
"- /精华列表" +
|
||||
"- 对信息回复:[设置 | 取消]精华\n" +
|
||||
"- 取消精华 [信息ID]\n" +
|
||||
"- /精华列表\n" +
|
||||
"Tips: {at}可在发送时艾特被欢迎者 {nickname}是被欢迎者名字 {avatar}是被欢迎者头像 {uid}是被欢迎者QQ号 {gid}是当前群群号 {groupname} 是当前群群名"
|
||||
)
|
||||
|
||||
|
||||
@ -26,10 +26,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
serviceName = "wenxinvilg"
|
||||
serviceErr = "[" + serviceName + "]ERROR:\n"
|
||||
modelName = "wenxinmodel"
|
||||
modelErr = "[" + modelName + "]ERROR:\n"
|
||||
serviceErr = "[wenxinvilg]ERROR:\n"
|
||||
modelErr = "[wenxinmodel]ERROR:\n"
|
||||
)
|
||||
|
||||
type keydb struct {
|
||||
@ -69,7 +67,7 @@ func init() { // 插件主体
|
||||
defer process.GlobalInitMutex.Unlock()
|
||||
name = zero.BotConfig.NickName[0]
|
||||
}()
|
||||
engine := control.Register(serviceName, &ctrl.Options[*zero.Ctx]{
|
||||
engine := control.Register("wenxinvilg", &ctrl.Options[*zero.Ctx]{
|
||||
DisableOnDefault: false,
|
||||
Brief: "文心AI画图",
|
||||
Help: "基于百度文心的免费AI画图插件,\n因为是免费的,图片质量你懂的。\n" +
|
||||
@ -261,7 +259,7 @@ func init() { // 插件主体
|
||||
ctx.SendChain(message.Text("成功!"))
|
||||
})
|
||||
/*********************************************************/
|
||||
en := control.Register(modelName, &ctrl.Options[*zero.Ctx]{
|
||||
en := control.Register("wenxinmodel", &ctrl.Options[*zero.Ctx]{
|
||||
DisableOnDefault: false,
|
||||
Brief: "文心AI文本处理",
|
||||
Help: "基于百度文心AI的API文本处理\n" +
|
||||
|
||||
Loading…
Reference in New Issue
Block a user