mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-14 05:45:02 +00:00
Port !search and !bansearch to Knub 30
This commit is contained in:
parent
902b7693e6
commit
954c88bee2
4 changed files with 476 additions and 7 deletions
32
backend/src/plugins/Utility/commands/BanSearchCmd.ts
Normal file
32
backend/src/plugins/Utility/commands/BanSearchCmd.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
import { utilityCmd } from "../types";
|
||||
import { baseTypeHelpers as t } from "knub";
|
||||
import { archiveSearch, displaySearch, SearchType } from "./search";
|
||||
|
||||
// Separate from BanSearchCmd to avoid a circular reference from ./search.ts
|
||||
export const banSearchSignature = {
|
||||
query: t.string({ catchAll: true }),
|
||||
|
||||
page: t.number({ option: true, shortcut: "p" }),
|
||||
sort: t.string({ option: true }),
|
||||
"case-sensitive": t.switchOption({ shortcut: "cs" }),
|
||||
export: t.switchOption({ shortcut: "e" }),
|
||||
ids: t.switchOption(),
|
||||
regex: t.switchOption({ shortcut: "re" }),
|
||||
};
|
||||
|
||||
export const BanSearchCmd = utilityCmd({
|
||||
trigger: ["bansearch", "bs"],
|
||||
description: "Search banned users",
|
||||
usage: "!bansearch dragory",
|
||||
permission: "can_search",
|
||||
|
||||
signature: banSearchSignature,
|
||||
|
||||
run({ pluginData, message, args }) {
|
||||
if (args.export) {
|
||||
return archiveSearch(pluginData, args, SearchType.BanSearch, message);
|
||||
} else {
|
||||
return displaySearch(pluginData, args, SearchType.BanSearch, message);
|
||||
}
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue