-
-
Notifications
You must be signed in to change notification settings - Fork 293
Feature: 添加一个上下文的api,能够实现禁用插件 启用插件的功能 #886
Copy link
Copy link
Closed
Labels
feature新特性新特性
Description
Describe the problem related to the feature request
号不少 风控的也不少 我想要在一个号风控后通过命令的方式禁用掉当前的onebot插件 然后打开下一个onebot
Describe the solution you'd like
添加一个上下文的api,能够实现禁用插件 启用插件的功能(可在插件配置向用户申请该权
Describe alternatives you've considered
让koishi自动检测gocqhttp的stdout 来实现风控换号?
Additional context
来个伪代码实现
export function apply(ctx) {
var onebots = ctx.getPluginsByType("adapter-onebot")
// [
// {
// id:"114514",
// isActivate: false,
// activate:function(...)
// },
// {
// id:"1919810",
// isActivate: true,
// activate:function(...)
// }
// ]
for (const key in onebots) {
if(onebots[key].isActivate) {
if(key+1 == onebots.length) {
onebots[0].activate()
} else {
onebots[key+1].activate()
}
}
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feature新特性新特性