blob: 84dce37d168d46f1d3a21286b2fe0c137e68a8c9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
import { Message } from "discord.js";
import { replyWithCleanup } from "../utilities";
export const handleReactCommand = async (message: Message) => {
if (message.author.bot) return;
if (!message.content.startsWith("uma!react")) return;
if (!message.guild || message.author.id !== message.guild.ownerId) return;
const parameters = message.content.split(" ");
if (parameters.length < 3) {
await replyWithCleanup(
message,
"❌ Usage: `uma!react <message_id> <emoji>`",
);
return;
}
const messageId = parameters[1];
const emoji = parameters[2];
try {
const targetMessage = await message.channel.messages.fetch(messageId);
if (!targetMessage) {
await replyWithCleanup(message, "❌ Message not found.");
return;
}
await targetMessage.react(emoji);
} catch (error) {
console.error("Error reacting to message:", error);
await replyWithCleanup(message, "❌ Failed to react to the message.");
}
};
|