mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-21 16:55:03 +00:00
added roleinfo command
This commit is contained in:
parent
edd78fc9c6
commit
89a4b4a153
5 changed files with 115 additions and 3 deletions
|
@ -9,9 +9,10 @@ import { canReadChannel } from "../../../utils/canReadChannel";
|
|||
import { getMessageInfoEmbed } from "../functions/getMessageInfoEmbed";
|
||||
import { getChannelInfoEmbed } from "../functions/getChannelInfoEmbed";
|
||||
import { getServerInfoEmbed } from "../functions/getServerInfoEmbed";
|
||||
import { getChannelId } from "knub/dist/utils";
|
||||
import { getChannelId, getRoleId } from "knub/dist/utils";
|
||||
import { getGuildPreview } from "../functions/getGuildPreview";
|
||||
import { getSnowflakeInfoEmbed } from "../functions/getSnowflakeInfoEmbed";
|
||||
import { getRoleInfoEmbed } from "../functions/getRoleInfoEmbed";
|
||||
|
||||
export const InfoCmd = utilityCmd({
|
||||
trigger: "info",
|
||||
|
@ -104,14 +105,25 @@ export const InfoCmd = utilityCmd({
|
|||
}
|
||||
}
|
||||
|
||||
// 7. Arbitrary ID
|
||||
// 7. Role ID
|
||||
const roleId = getRoleId(value);
|
||||
const role = roleId && pluginData.guild.roles.get(roleId);
|
||||
if (role && userCfg.can_roleinfo) {
|
||||
const embed = await getRoleInfoEmbed(pluginData, role, message.author.id);
|
||||
message.channel.createMessage({ embed });
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: 8. Emoji ID
|
||||
|
||||
// 9. Arbitrary ID
|
||||
if (isValidSnowflake(value) && userCfg.can_snowflake) {
|
||||
const embed = await getSnowflakeInfoEmbed(pluginData, value, true, message.author.id);
|
||||
message.channel.createMessage({ embed });
|
||||
return;
|
||||
}
|
||||
|
||||
// 7. No can do
|
||||
// 10. No can do
|
||||
sendErrorMessage(
|
||||
pluginData,
|
||||
message.channel,
|
||||
|
|
28
backend/src/plugins/Utility/commands/RoleInfoCmd.ts
Normal file
28
backend/src/plugins/Utility/commands/RoleInfoCmd.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
import { utilityCmd } from "../types";
|
||||
import { commandTypeHelpers as ct } from "../../../commandTypes";
|
||||
import { sendErrorMessage } from "../../../pluginUtils";
|
||||
import { getRoleInfoEmbed } from "../functions/getRoleInfoEmbed";
|
||||
|
||||
export const RoleInfoCmd = utilityCmd({
|
||||
trigger: ["role", "roleinfo"],
|
||||
description: "Show information about a role",
|
||||
usage: "!role 106391128718245888",
|
||||
permission: "can_roleinfo",
|
||||
|
||||
signature: {
|
||||
role: ct.role({ required: false }),
|
||||
},
|
||||
|
||||
async run({ message, args, pluginData }) {
|
||||
const roleId = args.role?.id;
|
||||
const role = roleId && pluginData.guild.roles.get(roleId);
|
||||
if (!role) {
|
||||
sendErrorMessage(pluginData, message.channel, "Role not found");
|
||||
return;
|
||||
}
|
||||
|
||||
const embed = await getRoleInfoEmbed(pluginData, role, message.author.id);
|
||||
|
||||
message.channel.createMessage({ embed });
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue