3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-18 23:09:59 +00:00
zeppelin/backend/src/plugins/Utility/commands/MessageInfoCmd.ts
Nils 93618e1bda
Fix various issues with the info commands (#151)
Fixed !info not checking for any of the sub-permissions
Fixed message/channel/invite checking non-existent permissions
Fixed ServerCmd being out of line with the rest of the info commands name-wise
2021-02-13 20:02:43 +02:00

36 lines
1.1 KiB
TypeScript

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",
signature: {
message: ct.messageTarget(),
},
async run({ message, args, pluginData }) {
if (!canReadChannel(args.message.channel, message.member)) {
sendErrorMessage(pluginData, message.channel, "Unknown message");
return;
}
const embed = await getMessageInfoEmbed(
pluginData,
args.message.channel.id,
args.message.messageId,
message.author.id,
);
if (!embed) {
sendErrorMessage(pluginData, message.channel, "Unknown message");
return;
}
message.channel.createMessage({ embed });
},
});