3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-19 15:30:00 +00:00
zeppelin/backend/src/plugins/Utility/commands/SearchCmd.ts

37 lines
1.2 KiB
TypeScript
Raw Normal View History

import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
2020-07-06 00:53:28 +03:00
import { archiveSearch, displaySearch, SearchType } from "../search";
2020-07-05 15:59:15 +03:00
// Separate from SearchCmd to avoid a circular reference from ./search.ts
export const searchCmdSignature = {
2020-07-30 18:54:56 +03:00
query: ct.string({ catchAll: true, required: false }),
2020-07-05 15:59:15 +03:00
page: ct.number({ option: true, shortcut: "p" }),
role: ct.string({ option: true, shortcut: "r" }),
voice: ct.switchOption({ shortcut: "v" }),
bot: ct.switchOption({ shortcut: "b" }),
sort: ct.string({ option: true }),
"case-sensitive": ct.switchOption({ shortcut: "cs" }),
export: ct.switchOption({ shortcut: "e" }),
ids: ct.switchOption(),
regex: ct.switchOption({ shortcut: "re" }),
"status-search": ct.switchOption({ shortcut: "ss" }),
2020-07-05 15:59:15 +03:00
};
export const SearchCmd = utilityCmd({
trigger: ["search", "s"],
2020-07-05 15:59:15 +03:00
description: "Search server members",
usage: "!search dragory",
permission: "can_search",
2020-07-05 15:59:15 +03:00
signature: searchCmdSignature,
2020-07-05 15:59:15 +03:00
run({ pluginData, message, args }) {
if (args.export) {
return archiveSearch(pluginData, args, SearchType.MemberSearch, message);
} else {
return displaySearch(pluginData, args, SearchType.MemberSearch, message);
}
},
});