2020-07-05 05:00:54 +03:00
|
|
|
import { utilityCmd } from "../types";
|
2020-07-06 03:05:40 +03:00
|
|
|
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
|
|
|
|
2020-07-06 03:05:40 +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
|
|
|
};
|
2020-07-05 05:00:54 +03:00
|
|
|
|
2020-07-05 15:03:51 +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:03:51 +03:00
|
|
|
|
2020-07-05 15:59:15 +03:00
|
|
|
signature: searchCmdSignature,
|
2020-07-05 05:00:54 +03:00
|
|
|
|
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);
|
|
|
|
}
|
2020-07-05 05:00:54 +03:00
|
|
|
},
|
2020-07-05 15:03:51 +03:00
|
|
|
});
|