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 { baseTypeHelpers as t } from "knub";
import { commandTypeHelpers as ct } from "../../../commandTypes";
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 }),
query: ct.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" }),
page: ct.number({ option: true, shortcut: "p" }),
sort: ct.string({ option: true }),
"case-sensitive": ct.switchOption({ shortcut: "cs" }),
export: ct.switchOption({ shortcut: "e" }),
ids: ct.switchOption(),
regex: ct.switchOption({ shortcut: "re" }),
};
export const BanSearchCmd = utilityCmd({

View file

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

View file

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

View file

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

View file

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