mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 14:11:50 +00:00
Use blueprint directly for commands for clarity
This commit is contained in:
parent
05693455ec
commit
9963a4d5a4
4 changed files with 34 additions and 40 deletions
|
@ -4,20 +4,18 @@ import { helpers } from "knub";
|
||||||
|
|
||||||
const { getMemberLevel } = helpers;
|
const { getMemberLevel } = helpers;
|
||||||
|
|
||||||
export const LevelCmd = utilityCmd(
|
export const LevelCmd = utilityCmd({
|
||||||
"level",
|
trigger: "level",
|
||||||
{
|
description: "Show the permission level of a user",
|
||||||
|
usage: "!level 106391128718245888",
|
||||||
|
|
||||||
|
signature: {
|
||||||
member: ct.resolvedMember({ required: false }),
|
member: ct.resolvedMember({ required: false }),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
run({ message, args, pluginData }) {
|
||||||
description: "Show the permission level of a user",
|
|
||||||
usage: "!level 106391128718245888",
|
|
||||||
},
|
|
||||||
|
|
||||||
({ message, args, pluginData }) => {
|
|
||||||
const member = args.member || message.member;
|
const member = args.member || message.member;
|
||||||
const level = getMemberLevel(pluginData, member);
|
const level = getMemberLevel(pluginData, member);
|
||||||
message.channel.createMessage(`The permission level of ${member.username}#${member.discriminator} is **${level}**`);
|
message.channel.createMessage(`The permission level of ${member.username}#${member.discriminator} is **${level}**`);
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
|
|
@ -5,22 +5,20 @@ import { chunkArray, sorter, trimLines } from "../../../utils";
|
||||||
import { refreshMembersIfNeeded } from "../refreshMembers";
|
import { refreshMembersIfNeeded } from "../refreshMembers";
|
||||||
import { sendErrorMessage } from "../../../pluginUtils";
|
import { sendErrorMessage } from "../../../pluginUtils";
|
||||||
|
|
||||||
export const RolesCmd = utilityCmd(
|
export const RolesCmd = utilityCmd({
|
||||||
"roles",
|
trigger: "roles",
|
||||||
{
|
description: "List all roles or roles matching a search",
|
||||||
|
usage: "!roles mod",
|
||||||
|
permission: "can_roles",
|
||||||
|
|
||||||
|
signature: {
|
||||||
search: t.string({ catchAll: true }),
|
search: t.string({ catchAll: true }),
|
||||||
|
|
||||||
counts: t.switchOption(),
|
counts: t.switchOption(),
|
||||||
sort: t.string({ option: true }),
|
sort: t.string({ option: true }),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
async run({ message: msg, args, pluginData }) {
|
||||||
description: "List all roles or roles matching a search",
|
|
||||||
usage: "!roles mod",
|
|
||||||
permission: "can_roles",
|
|
||||||
},
|
|
||||||
|
|
||||||
async ({ message: msg, args, pluginData }) => {
|
|
||||||
const { guild } = pluginData;
|
const { guild } = pluginData;
|
||||||
|
|
||||||
let roles: Array<{ _memberCount?: number } & Role> = Array.from((msg.channel as TextChannel).guild.roles.values());
|
let roles: Array<{ _memberCount?: number } & Role> = Array.from((msg.channel as TextChannel).guild.roles.values());
|
||||||
|
@ -109,5 +107,5 @@ export const RolesCmd = utilityCmd(
|
||||||
msg.channel.createMessage("```py\n" + roleLines.join("\n") + "```");
|
msg.channel.createMessage("```py\n" + roleLines.join("\n") + "```");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
);
|
});
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
import { utilityCmd } from "../types";
|
import { utilityCmd } from "../types";
|
||||||
import { baseTypeHelpers as t } from "knub";
|
import { baseTypeHelpers as t } from "knub";
|
||||||
|
|
||||||
export const SearchCmd = utilityCmd(
|
export const SearchCmd = utilityCmd({
|
||||||
["search", "s"],
|
trigger: ["search", "s"],
|
||||||
{
|
|
||||||
|
signature: {
|
||||||
query: t.string({ catchAll: true }),
|
query: t.string({ catchAll: true }),
|
||||||
|
},
|
||||||
|
|
||||||
|
run() {
|
||||||
|
|
||||||
},
|
},
|
||||||
{},
|
});
|
||||||
() => {}
|
|
||||||
);
|
|
||||||
|
|
|
@ -4,17 +4,13 @@ import { embedPadding, formatNumber, memoize, MINUTES, trimLines } from "../../.
|
||||||
import { utilityCmd } from "../types";
|
import { utilityCmd } from "../types";
|
||||||
import humanizeDuration from "humanize-duration";
|
import humanizeDuration from "humanize-duration";
|
||||||
|
|
||||||
export const ServerCmd = utilityCmd(
|
export const ServerCmd = utilityCmd({
|
||||||
"server",
|
trigger: "server",
|
||||||
{},
|
description: "Show information about the server",
|
||||||
|
usage: "!server",
|
||||||
|
permission: "can_server",
|
||||||
|
|
||||||
{
|
async run({ message }) {
|
||||||
permission: "can_server",
|
|
||||||
description: "Show information about the server",
|
|
||||||
usage: "!server",
|
|
||||||
},
|
|
||||||
|
|
||||||
async ({ message }) => {
|
|
||||||
const embed: EmbedOptions = {
|
const embed: EmbedOptions = {
|
||||||
fields: [],
|
fields: [],
|
||||||
color: parseInt("6b80cf", 16),
|
color: parseInt("6b80cf", 16),
|
||||||
|
@ -122,5 +118,5 @@ export const ServerCmd = utilityCmd(
|
||||||
});
|
});
|
||||||
|
|
||||||
message.channel.createMessage({ embed });
|
message.channel.createMessage({ embed });
|
||||||
}
|
},
|
||||||
);
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue