koishi-plugin-command-interceptor
Version:
Intercept commands according to the rules
30 lines (29 loc) • 885 B
TypeScript
import { Schema } from "koishi";
export type ConditionKey = "private" | "userId" | "groupId" | "channelId" | "botId" | "platform" | "content";
export type ConditionLogic = "equalTo" | "notEqualTo" | "include" | "notInclude" | "like" | "notLike";
export type ConditionValue = string | boolean | {
value: string[];
};
export interface Condition {
key: ConditionKey;
logic: ConditionLogic;
value: ConditionValue;
}
export type AndOr = "and" | "or";
export interface ConditionGroup {
externalLogic?: AndOr;
internalLogic?: AndOr;
conditions: Condition[];
}
export type RuleType = "whitelist" | "blacklist";
export interface Rule {
type: RuleType;
priority: number;
command: string[];
notCommandMessage: boolean;
conditionGroups: ConditionGroup[];
}
export interface Config {
rules: Rule[];
}
export declare const Config: Schema<Config>;