3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-16 22:21:51 +00:00

Use commandTypeHelpers instead of baseTypeHelpers

This commit is contained in:
Dragory 2020-07-06 03:05:40 +03:00
parent c17fef6440
commit 3df57e3cb9
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
5 changed files with 26 additions and 28 deletions

View file

@ -1,17 +1,17 @@
import { utilityCmd } from "../types"; import { utilityCmd } from "../types";
import { baseTypeHelpers as t } from "knub"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { archiveSearch, displaySearch, SearchType } from "../search"; import { archiveSearch, displaySearch, SearchType } from "../search";
// Separate from BanSearchCmd to avoid a circular reference from ./search.ts // Separate from BanSearchCmd to avoid a circular reference from ./search.ts
export const banSearchSignature = { export const banSearchSignature = {
query: t.string({ catchAll: true }), query: ct.string({ catchAll: true }),
page: t.number({ option: true, shortcut: "p" }), page: ct.number({ option: true, shortcut: "p" }),
sort: t.string({ option: true }), sort: ct.string({ option: true }),
"case-sensitive": t.switchOption({ shortcut: "cs" }), "case-sensitive": ct.switchOption({ shortcut: "cs" }),
export: t.switchOption({ shortcut: "e" }), export: ct.switchOption({ shortcut: "e" }),
ids: t.switchOption(), ids: ct.switchOption(),
regex: t.switchOption({ shortcut: "re" }), regex: ct.switchOption({ shortcut: "re" }),
}; };
export const BanSearchCmd = utilityCmd({ export const BanSearchCmd = utilityCmd({

View file

@ -1,5 +1,4 @@
import { utilityCmd } from "../types"; import { utilityCmd } from "../types";
import { baseTypeHelpers as t } from "knub";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { embedPadding, resolveMember, trimLines, UnknownUser } from "../../../utils"; import { embedPadding, resolveMember, trimLines, UnknownUser } from "../../../utils";
import { EmbedOptions, GuildTextableChannel } from "eris"; import { EmbedOptions, GuildTextableChannel } from "eris";
@ -16,7 +15,7 @@ export const InfoCmd = utilityCmd({
signature: { signature: {
user: ct.resolvedUserLoose({ required: false }), user: ct.resolvedUserLoose({ required: false }),
compact: t.switchOption({ shortcut: "c" }), compact: ct.switchOption({ shortcut: "c" }),
}, },
async run({ message: msg, args, pluginData }) { async run({ message: msg, args, pluginData }) {

View file

@ -1,6 +1,5 @@
import { utilityCmd } from "../types"; import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { baseTypeHelpers as t } from "knub";
import { errorMessage } from "../../../utils"; import { errorMessage } from "../../../utils";
import { canActOn, sendSuccessMessage } from "../../../pluginUtils"; import { canActOn, sendSuccessMessage } from "../../../pluginUtils";
@ -12,7 +11,7 @@ export const NicknameCmd = utilityCmd({
signature: { signature: {
member: ct.resolvedMember(), member: ct.resolvedMember(),
nickname: t.string({ catchAll: true }), nickname: ct.string({ catchAll: true }),
}, },
async run({ message: msg, args, pluginData }) { async run({ message: msg, args, pluginData }) {

View file

@ -1,5 +1,5 @@
import { utilityCmd } from "../types"; import { utilityCmd } from "../types";
import { baseTypeHelpers as t } from "knub"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { Role, TextChannel } from "eris"; import { Role, TextChannel } from "eris";
import { chunkArray, sorter, trimLines } from "../../../utils"; import { chunkArray, sorter, trimLines } from "../../../utils";
import { refreshMembersIfNeeded } from "../refreshMembers"; import { refreshMembersIfNeeded } from "../refreshMembers";
@ -12,10 +12,10 @@ export const RolesCmd = utilityCmd({
permission: "can_roles", permission: "can_roles",
signature: { signature: {
search: t.string({ catchAll: true }), search: ct.string({ catchAll: true }),
counts: t.switchOption(), counts: ct.switchOption(),
sort: t.string({ option: true }), sort: ct.string({ option: true }),
}, },
async run({ message: msg, args, pluginData }) { async run({ message: msg, args, pluginData }) {

View file

@ -1,21 +1,21 @@
import { utilityCmd } from "../types"; import { utilityCmd } from "../types";
import { baseTypeHelpers as t } from "knub"; import { commandTypeHelpers as ct } from "../../../commandTypes";
import { archiveSearch, displaySearch, SearchType } from "../search"; import { archiveSearch, displaySearch, SearchType } from "../search";
// Separate from SearchCmd to avoid a circular reference from ./search.ts // Separate from SearchCmd to avoid a circular reference from ./search.ts
export const searchCmdSignature = { export const searchCmdSignature = {
query: t.string({ catchAll: true }), query: ct.string({ catchAll: true }),
page: t.number({ option: true, shortcut: "p" }), page: ct.number({ option: true, shortcut: "p" }),
role: t.string({ option: true, shortcut: "r" }), role: ct.string({ option: true, shortcut: "r" }),
voice: t.switchOption({ shortcut: "v" }), voice: ct.switchOption({ shortcut: "v" }),
bot: t.switchOption({ shortcut: "b" }), bot: ct.switchOption({ shortcut: "b" }),
sort: t.string({ option: true }), sort: ct.string({ option: true }),
"case-sensitive": t.switchOption({ shortcut: "cs" }), "case-sensitive": ct.switchOption({ shortcut: "cs" }),
export: t.switchOption({ shortcut: "e" }), export: ct.switchOption({ shortcut: "e" }),
ids: t.switchOption(), ids: ct.switchOption(),
regex: t.switchOption({ shortcut: "re" }), regex: ct.switchOption({ shortcut: "re" }),
"status-search": t.switchOption({ shortcut: "ss" }), "status-search": ct.switchOption({ shortcut: "ss" }),
}; };
export const SearchCmd = utilityCmd({ export const SearchCmd = utilityCmd({