Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #41

Merged
merged 4 commits into from
Nov 25, 2024
Merged

Dev #41

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions adapter/ob11/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ func CustomNode(nickname string, userID int64, content interface{}) message.Mess
switch c := content.(type) {
case string:
str = c
case message.Message:
str =Message(c).String()
case []message.MessageSegment:
str = Message(c).String()
default:
b, _ := json.Marshal(content)
str = tool.BytesToString(b)
Expand Down
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ import (
//插件注册
_ "github.com/lianhong2758/RosmBot-MUL/plugins/chatgpt"
_ "github.com/lianhong2758/RosmBot-MUL/plugins/fhl"
//_ "github.com/lianhong2758/RosmBot-MUL/plugins/dish"
_ "github.com/lianhong2758/RosmBot-MUL/plugins/gscore"
_ "github.com/lianhong2758/RosmBot-MUL/plugins/lc"
//_ "github.com/lianhong2758/RosmBot-MUL/plugins/liuyao"
_ "github.com/lianhong2758/RosmBot-MUL/plugins/onplugin"
// _ "github.com/lianhong2758/RosmBot-MUL/plugins/phi"
//_ "github.com/lianhong2758/RosmBot-MUL/plugins/phi"
_ "github.com/lianhong2758/RosmBot-MUL/plugins/pixiv"
_ "github.com/lianhong2758/RosmBot-MUL/plugins/score"
//_ "github.com/lianhong2758/RosmBot-MUL/plugins/tarot"
_ "github.com/lianhong2758/RosmBot-MUL/plugins/test"
Expand Down
10 changes: 5 additions & 5 deletions plugins/onplugin/on&off.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var en = rosm.Register(&rosm.PluginData{
})

func init() {
en.OnRex(`^/启用\s*(.*)`).Handle(func(ctx *rosm.Ctx) {
en.OnRex(`^/启用\s*(.*)`).SetRule(rosm.NoAtForOther()).Handle(func(ctx *rosm.Ctx) {
name := ctx.Being.ResultWord[1]
if _, ok := rosm.GetPlugins()[name]; !ok {
ctx.Send(message.Text("未找到插件: ", name))
Expand All @@ -32,7 +32,7 @@ func init() {
}
ctx.Send(message.Text(name, "已启用..."))
})
en.OnRex(`^/禁用\s*(.*)`).Handle(func(ctx *rosm.Ctx) {
en.OnRex(`^/禁用\s*(.*)`).SetRule(rosm.NoAtForOther()).Handle(func(ctx *rosm.Ctx) {
name := ctx.Being.ResultWord[1]
if _, ok := rosm.GetPlugins()[name]; !ok {
ctx.Send(message.Text("未找到插件: ", name))
Expand All @@ -45,7 +45,7 @@ func init() {
}
ctx.Send(message.Text(name, "已禁用..."))
})
en.OnRex(`^/用法\s*(.*)`).Handle(func(ctx *rosm.Ctx) {
en.OnRex(`^/用法\s*(.*)`).SetRule(rosm.NoAtForOther()).Handle(func(ctx *rosm.Ctx) {
name := ctx.Being.ResultWord[1]
plugin, ok := rosm.GetPlugins()[name]
if !ok {
Expand All @@ -67,7 +67,7 @@ func init() {
msg.WriteString(strings.Repeat("*", 20))
ctx.Send(message.Text(msg.String()))
})
en.OnWord(`早安`).SetRule(rosm.OnlyAtMe()).Handle(func(ctx *rosm.Ctx) {
en.OnWord(`早安`).SetRule(rosm.OnlyMaster()).Handle(func(ctx *rosm.Ctx) {
on := rosm.PluginIsOn(rosm.GetBoten())(ctx)
if !on {
err := rosm.PluginDB.InsertOff(rosm.GetBoten().Name, tool.MergePadString(ctx.Being.GroupID, ctx.Being.GuildID), false)
Expand All @@ -81,7 +81,7 @@ func init() {
ctx.Send(message.Text("早安,", rosm.GetRandBotName(), "已经在认真工作了喵~"))
}
})
en.OnWord(`晚安`).SetRule(rosm.OnlyAtMe()).Handle(func(ctx *rosm.Ctx) {
en.OnWord(`晚安`).SetRule(rosm.OnlyMaster()).Handle(func(ctx *rosm.Ctx) {
on := rosm.PluginIsOn(rosm.GetBoten())(ctx)
if on {
err := rosm.PluginDB.InsertOff(rosm.GetBoten().Name, tool.MergePadString(ctx.Being.GroupID, ctx.Being.GuildID), true)
Expand Down
4 changes: 2 additions & 2 deletions plugins/pixiv/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func init() {
_ = os.MkdirAll(en.DataFolder+"cache", 0755)
}

en.OnRex(`^/搜图\s*(\d+)$`).MUL("ob11").Handle(func(ctx *rosm.Ctx) {
en.OnRex(`^/搜图\s*(\d+)$`).MUL(ob11.BotType).Handle(func(ctx *rosm.Ctx) {
id, _ := strconv.ParseInt(ctx.Being.ResultWord[1], 10, 64)
ctx.Send(message.Text("雪儿正在寻找中......"))
// 获取P站插图信息
Expand Down Expand Up @@ -88,7 +88,7 @@ func init() {
ctx.Send(message.Text("图片不存在呜..."))
}
})
en.OnWord("以图搜图", "以图识图").MUL("ob11").Handle(func(ctx *rosm.Ctx) {
en.OnWord("以图搜图", "以图识图").MUL(ob11.BotType).Handle(func(ctx *rosm.Ctx) {
pics := GetMustPic(ctx)
if len(pics) == 0 {
ctx.Send(message.Text("雪儿没有收到图片唔..."))
Expand Down
2 changes: 1 addition & 1 deletion plugins/test/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func init() {
Name: "帮助菜单",
Help: "- /help\n",
})
en.OnWord("/help", "/帮助").Handle(func(ctx *rosm.Ctx) {
en.OnWord("/help", "/帮助").SetRule(rosm.OnlyAtMe()).Handle(func(ctx *rosm.Ctx) {
var msg strings.Builder
msg.WriteString("****RosmBot菜单*****")
for _, v := range rosm.GetPlugins() {
Expand Down
Loading