i need help
so basically i wanna know how to make it so it reacts to a specific user with a specific emoji
21 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPI react with my message
So like when i type
!ar (user) 💀
Everytime i type something
I automatically react to that specific user with that specific emoji
You can't react unless there's a message to react to
I know bro
I said
Everytime
I send
Or the specific
User send something
I automatically react to that message
With the specific emoji
Use a messageCreate listener to monitor the messages and react
What the command for it
?
Like
How do i do it
Iam new bro sorry
No worries but this will involve some database and stuff so you do need a good foundation in javascriptb
So when i type for example “!ar (user) (emoji)” it will react to that specific user with the emoji mentioned?
Ah
Alr
Thank you
No you will need to implement that yourself but this is how to react to a message
I have my friends code but i wanna make my own(he found it on chatgpt)
Wait lemme send it
const activeReactions = new Map();
module.exports = {
run: async (client, message, args) => {
// Permission check: Only the bot owner can execute this command
if (message.author.id !== client.user.id) return;
// Check for arguments
if (args.length < 1) {
return message.reply(
"Use the command as follows:\n
Start: .ar <UserID> <Emoji1>,<Emoji2>,...
\nStop: .ar stop <UserID>
"
);
}
// Check if the command is "stop"
if (args[0].toLowerCase() === "stop") {
const targetUserId = args[1]; // ID of the user to stop the feature for
if (!targetUserId || !activeReactions.has(targetUserId)) {
return message.reply("No active AutoReact found for this user.");
}
activeReactions.delete(targetUserId); // Disable reactions
return message.reply(
Automatic reactions for user with ID ${targetUserId} have been disabled.
);
}
// Extract UserID and emoji list
const targetUserId = args[0]; // ID of the target user
const emojis = args.slice(1).join(" ").split(","); // Split emojis
if (emojis.length === 0) {
return message.reply("Please provide at least one emoji.");
}
// Update the map: Link user ID with emojis
activeReactions.set(targetUserId, emojis);
// Enable event listener
client.on("messageCreate", (msg) => {
if (!activeReactions.has(msg.author.id)) return; // No active reaction for this user
if (msg.author.id === targetUserId && !msg.author.bot) {
const emojis = activeReactions.get(targetUserId); // Retrieve emojis
const randomEmoji =
emojis[Math.floor(Math.random() * emojis.length)]; // Pick a random emoji
msg.react(randomEmoji).catch((error) =>
console.error("Error adding reaction:", error)
);
}
});
message.reply(
Automatic reactions for user with ID ${targetUserId} have been activated.\nEmojis: ${emojis.join(
", "
)}
);
},
};
Here
I wanna make my ownIf you're a beginner, I recommend reading the guide and https://discordjs.guide
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
Thank you but you do know iam talking about selfbots?
Kindly leave then. We don't support that here.
Why is that the case
Go read the discord tos
Wait a sec
Is it illegal???
Yes
Fuck
Am so sorry
I didnt know
Thank you so much for telling me
Thank you for giving me your time