3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-19 07:20:00 +00:00
zeppelin/backend/src/plugins/Utility/commands/MessageInfoCmd.ts

37 lines
1.1 KiB
TypeScript
Raw Normal View History

2020-08-06 00:46:47 +03:00
import { utilityCmd } from "../types";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage } from "../../../pluginUtils";
import { getMessageInfoEmbed } from "../functions/getMessageInfoEmbed";
import { canReadChannel } from "../../../utils/canReadChannel";
export const MessageInfoCmd = utilityCmd({
trigger: ["message", "messageinfo"],
description: "Show information about a message",
usage: "!message 534722016549404673-534722219696455701",
permission: "can_messageinfo",
2020-08-06 00:46:47 +03:00
signature: {
message: ct.messageTarget(),
},
async run({ message, args, pluginData }) {
if (!canReadChannel(args.message.channel, message.member)) {
2020-08-06 00:46:47 +03:00
sendErrorMessage(pluginData, message.channel, "Unknown message");
return;
}
const embed = await getMessageInfoEmbed(
pluginData,
args.message.channel.id,
args.message.messageId,
message.author.id,
);
2020-08-06 00:46:47 +03:00
if (!embed) {
sendErrorMessage(pluginData, message.channel, "Unknown message");
return;
}
message.channel.createMessage({ embed });
},
});