mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-24 11:29:12 +00:00
fix(bot): update discord.js to 13, ignore non-direct mentions
This commit is contained in:
parent
cba0d1f35a
commit
7a52653260
2 changed files with 10 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
|||
const { Client } = require('discord.js');
|
||||
const { Client, Message } = require('discord.js');
|
||||
|
||||
const botToken = process.env['BOT_TOKEN'];
|
||||
const allowedBots = process.env['ALLOWED_BOTS']?.split(',') ?? [];
|
||||
|
@ -10,7 +10,11 @@ function messageEventListener(message) {
|
|||
if (!guild) {
|
||||
return;
|
||||
} // Ignore DMs
|
||||
if (client.user && !mentions.has(client.user.id)) {
|
||||
|
||||
if (
|
||||
client.user &&
|
||||
!mentions.has(client.user.id, { ignoreRoles: true, ignoreEveryone: true })
|
||||
) {
|
||||
return;
|
||||
} // Ignore non bot mentions
|
||||
|
||||
|
@ -19,14 +23,12 @@ function messageEventListener(message) {
|
|||
} // Only respond to allowed bots
|
||||
|
||||
const guildId = guild.id;
|
||||
channel.send(`:beginner: Assign your roles here! ${appUrl}/s/${guildId}`);
|
||||
channel.send({ content: `:beginner: Assign your roles here! ${appUrl}/s/${guildId}` });
|
||||
}
|
||||
|
||||
const client = new Client({
|
||||
ws: {
|
||||
intents: ['GUILDS', 'GUILD_MESSAGES'],
|
||||
},
|
||||
});
|
||||
|
||||
client.on('message', (message) => messageEventListener(message));
|
||||
client.on('messageCreate', (message) => messageEventListener(message));
|
||||
client.login(botToken);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"discord.js": "^12.5.3",
|
||||
"discord.js": "^13.6.0",
|
||||
"dotenv": "^10.0.0"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue