Add !message/!messageinfo command
This commit is contained in:
parent
60aff76ebe
commit
e8ff297368
9 changed files with 210 additions and 0 deletions
31
backend/src/plugins/Utility/commands/MessageInfoCmd.ts
Normal file
31
backend/src/plugins/Utility/commands/MessageInfoCmd.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
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_message",
|
||||
|
||||
signature: {
|
||||
message: ct.messageTarget(),
|
||||
},
|
||||
|
||||
async run({ message, args, pluginData }) {
|
||||
if (!canReadChannel(args.message.channel, message.author.id)) {
|
||||
sendErrorMessage(pluginData, message.channel, "Unknown message");
|
||||
return;
|
||||
}
|
||||
|
||||
const embed = await getMessageInfoEmbed(pluginData, args.message.channel.id, args.message.messageId);
|
||||
if (!embed) {
|
||||
sendErrorMessage(pluginData, message.channel, "Unknown message");
|
||||
return;
|
||||
}
|
||||
|
||||
message.channel.createMessage({ embed });
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue