blob: d8a8021b6790a243fa7480aab0d865d4e98149a1 (
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
|
import { Message } from "discord.js";
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 message.reply("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 message.reply("Message not found.");
return;
}
await targetMessage.react(emoji);
} catch (error) {
console.error("Error reacting to message:", error);
await message.reply("Failed to react to the message.");
}
};
|