3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-20 16:25:03 +00:00
zeppelin/backend/src/plugins/Utility/commands/MessageInfoCmd.ts
Dark 49b555df07
Fix various issues with the info commands
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-01 06:41:56 +01: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 });
},
});