Slothy
Slothy
DIAdiscord.js - Imagine an app
Created by Slothy on 10/13/2023 in #djs-questions
Error - const roleId = interaction.options.getString('role_id');
❤️
17 replies
DIAdiscord.js - Imagine an app
Created by Slothy on 10/13/2023 in #djs-questions
Error - const roleId = interaction.options.getString('role_id');
Do you have a /tag for that lol
17 replies
DIAdiscord.js - Imagine an app
Created by Slothy on 10/13/2023 in #djs-questions
Error - const roleId = interaction.options.getString('role_id');
It's at the bottom here
// Insert the reaction role info into the database
db.run(
'INSERT INTO role_reactions (messageId, channelId, roleId) VALUES (?, ?, ?)',
[sentMessage.id, interaction.channelId, roleId],
(err) => {
if (err) {
console.error('Error inserting data into the database:', err);
return;
}
console.log(`Role reaction button added for the ${role.name} role!`);
}
);

// listener for button interactions
addReactRoleListener(client);
}
// Insert the reaction role info into the database
db.run(
'INSERT INTO role_reactions (messageId, channelId, roleId) VALUES (?, ?, ?)',
[sentMessage.id, interaction.channelId, roleId],
(err) => {
if (err) {
console.error('Error inserting data into the database:', err);
return;
}
console.log(`Role reaction button added for the ${role.name} role!`);
}
);

// listener for button interactions
addReactRoleListener(client);
}
17 replies
DIAdiscord.js - Imagine an app
Created by Slothy on 10/13/2023 in #djs-questions
Error - const roleId = interaction.options.getString('role_id');
function addReactRoleListener(client) {
client.on('interactionCreate', async (interaction) => {
if (!interaction.isButton()) return;

const roleId = interaction.customId === 'role_reaction';
if (!roleId) return;

const member = interaction.guild.members.cache.get(interaction.user.id);

if (member) {
if (member.roles.cache.has(roleId)) {
await member.roles.remove(roleId);
await interaction.reply({ content: 'Role removed!', ephemeral: true });
} else {
await member.roles.add(roleId);
await interaction.reply({ content: 'Role added!', ephemeral: true });
}
}
});
}
function addReactRoleListener(client) {
client.on('interactionCreate', async (interaction) => {
if (!interaction.isButton()) return;

const roleId = interaction.customId === 'role_reaction';
if (!roleId) return;

const member = interaction.guild.members.cache.get(interaction.user.id);

if (member) {
if (member.roles.cache.has(roleId)) {
await member.roles.remove(roleId);
await interaction.reply({ content: 'Role removed!', ephemeral: true });
} else {
await member.roles.add(roleId);
await interaction.reply({ content: 'Role added!', ephemeral: true });
}
}
});
}
17 replies
DIAdiscord.js - Imagine an app
Created by Slothy on 10/13/2023 in #djs-questions
Error - const roleId = interaction.options.getString('role_id');
It's right above the top part
17 replies
DIAdiscord.js - Imagine an app
Created by Slothy on 10/13/2023 in #djs-questions
Error - const roleId = interaction.options.getString('role_id');
You're talking about the ready.js? If so I've tried making it (client, interaction) Vice Versa. Regardless thanks for the info, I'll go ahead and try to fix it 🙂
17 replies
DIAdiscord.js - Imagine an app
Created by Slothy on 10/8/2023 in #djs-questions
Embed Channel Not Found
No description
7 replies
DIAdiscord.js - Imagine an app
Created by Slothy on 10/8/2023 in #djs-questions
Embed Channel Not Found
Ah! I through it in '' let me try it real fast
7 replies
DIAdiscord.js - Imagine an app
Created by Slothy on 10/8/2023 in #djs-questions
Embed Channel Not Found
[email protected] - Node v18.18.0
7 replies