@filiberto
To make an auto reaction using discord.js, you can use the message event to listen for messages being sent in a Discord channel, and the react method to add a reaction to the message. Here is an example code snippet to achieve this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
// Import the discord.js library
const Discord = require('discord.js');
// Create a new client instance
const client = new Discord.Client();
// Set up a listener for the message event
client.on('message', message => {
// Check if the message content matches a specific keyword
if (message.content.toLowerCase().includes('hello')) {
// React to the message with a thumbs up emoji
message.react('👍');
}
});
// Log in to Discord with your bot token
client.login('YOUR_BOT_TOKEN_HERE');
|
In this example, the bot listens for messages that contain the word "hello" and automatically reacts to them with a thumbs up emoji. You can customize the keyword and emoji to suit your needs. Just replace 'hello' with the keyword you want to react to and '👍' with the emoji you want to use.
Make sure to replace 'YOUR_BOT_TOKEN_HERE' with your own bot token, which you can obtain by creating a new bot application in the Discord Developer Portal and copying the token from there.