zappyzep/backend/src/plugins/Utility/commands/ChannelInfoCmd.ts

26 lines
794 B
TypeScript
Raw Normal View History

2020-08-05 22:54:14 +03:00
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils";
import { getChannelInfoEmbed } from "../functions/getChannelInfoEmbed";
import { utilityCmd } from "../types";
2020-08-05 22:54:14 +03:00
export const ChannelInfoCmd = utilityCmd({
trigger: ["channel", "channelinfo"],
description: "Show information about a channel",
usage: "!channel 534722016549404673",
permission: "can_channelinfo",
2020-08-05 22:54:14 +03:00
signature: {
channel: ct.channelId({ required: false }),
},
async run({ message, args, pluginData }) {
const embed = await getChannelInfoEmbed(pluginData, args.channel);
if (!embed) {
sendErrorMessage(pluginData, message.channel, "Unknown channel");
return;
}
2021-06-30 04:56:56 +02:00
message.channel.send({ embeds: [embed] });
2020-08-05 22:54:14 +03:00
},
});