HewkawAr
HewkawAr
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by HewkawAr on 12/12/2023 in #djs-questions
My Bot Can't Add roles to member
Version - [email protected] - Node.js v18.13.0 My Simple Code
const { default: axios } = require("axios");

module.exports = {
name: 'interactionCreate',
async execute(interaction, client) {
const role = await interaction.guild.roles.cache.get("1181943769789108255");
await interaction.member.roles.add(role);
await interaction.reply("Hello");
}
const { default: axios } = require("axios");

module.exports = {
name: 'interactionCreate',
async execute(interaction, client) {
const role = await interaction.guild.roles.cache.get("1181943769789108255");
await interaction.member.roles.add(role);
await interaction.reply("Hello");
}
Console
DiscordAPIError[50013]: Missing Permissions
at handleErrors (D:\.Projects\HewkawDiscordBotProject\M2Bot\node_modules\@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (D:\.Projects\HewkawDiscordBotProject\M2Bot\node_modules\@discordjs\rest\dist\index.js:1120:23)
at async SequentialHandler.queueRequest (D:\.Projects\HewkawDiscordBotProject\M2Bot\node_modules\@discordjs\rest\dist\index.js:953:14)
at async _REST.request (D:\.Projects\HewkawDiscordBotProject\M2Bot\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async GuildMemberRoleManager.add (D:\.Projects\HewkawDiscordBotProject\M2Bot\node_modules\discord.js\src\managers\GuildMemberRoleManager.js:131:7)
at async Object.execute (D:\.Projects\HewkawDiscordBotProject\M2Bot\events\interactionCreateButtons.js:8:13)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:394:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
requestBody: { files: undefined, json: undefined },
rawError: { message: 'Missing Permissions', code: 50013 },
code: 50013,
status: 403,
method: 'PUT',
url: 'https://discord.com/api/v10/guilds/1121829832423129160/members/758681611251744788/roles/1181943769789108255'
}

Node.js v18.13.0
DiscordAPIError[50013]: Missing Permissions
at handleErrors (D:\.Projects\HewkawDiscordBotProject\M2Bot\node_modules\@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (D:\.Projects\HewkawDiscordBotProject\M2Bot\node_modules\@discordjs\rest\dist\index.js:1120:23)
at async SequentialHandler.queueRequest (D:\.Projects\HewkawDiscordBotProject\M2Bot\node_modules\@discordjs\rest\dist\index.js:953:14)
at async _REST.request (D:\.Projects\HewkawDiscordBotProject\M2Bot\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async GuildMemberRoleManager.add (D:\.Projects\HewkawDiscordBotProject\M2Bot\node_modules\discord.js\src\managers\GuildMemberRoleManager.js:131:7)
at async Object.execute (D:\.Projects\HewkawDiscordBotProject\M2Bot\events\interactionCreateButtons.js:8:13)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:394:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
requestBody: { files: undefined, json: undefined },
rawError: { message: 'Missing Permissions', code: 50013 },
code: 50013,
status: 403,
method: 'PUT',
url: 'https://discord.com/api/v10/guilds/1121829832423129160/members/758681611251744788/roles/1181943769789108255'
}

Node.js v18.13.0
6 replies
DIAdiscord.js - Imagine an app
Created by HewkawAr on 12/12/2023 in #djs-questions
My Bot Can't Add roles to member
My Simple Code
const { EmbedBuilder, ButtonStyle, ActionRowBuilder, ButtonBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } = require("discord.js");
const { default: axios } = require("axios");

module.exports = {
name: 'interactionCreate',
async execute(interaction, client) {
const role = await interaction.guild.roles.cache.get("1181943769789108255");
await interaction.member.roles.add(role);
await interaction.reply("Hello");
}
const { EmbedBuilder, ButtonStyle, ActionRowBuilder, ButtonBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } = require("discord.js");
const { default: axios } = require("axios");

module.exports = {
name: 'interactionCreate',
async execute(interaction, client) {
const role = await interaction.guild.roles.cache.get("1181943769789108255");
await interaction.member.roles.add(role);
await interaction.reply("Hello");
}
DiscordAPIError[50013]: Missing Permissions
at handleErrors (D:\.Projects\HewkawDiscordBotProject\M2Bot\node_modules\@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (D:\.Projects\HewkawDiscordBotProject\M2Bot\node_modules\@discordjs\rest\dist\index.js:1120:23)
at async SequentialHandler.queueRequest (D:\.Projects\HewkawDiscordBotProject\M2Bot\node_modules\@discordjs\rest\dist\index.js:953:14)
at async _REST.request (D:\.Projects\HewkawDiscordBotProject\M2Bot\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async GuildMemberRoleManager.add (D:\.Projects\HewkawDiscordBotProject\M2Bot\node_modules\discord.js\src\managers\GuildMemberRoleManager.js:131:7)
at async Object.execute (D:\.Projects\HewkawDiscordBotProject\M2Bot\events\interactionCreateButtons.js:23:13)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:394:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
requestBody: { files: undefined, json: undefined },
rawError: { message: 'Missing Permissions', code: 50013 },
code: 50013,
status: 403,
method: 'PUT',
url: 'https://discord.com/api/v10/guilds/1121829832423129160/members/758681611251744788/roles/1181943769789108255'
}

Node.js v18.13.0
DiscordAPIError[50013]: Missing Permissions
at handleErrors (D:\.Projects\HewkawDiscordBotProject\M2Bot\node_modules\@discordjs\rest\dist\index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (D:\.Projects\HewkawDiscordBotProject\M2Bot\node_modules\@discordjs\rest\dist\index.js:1120:23)
at async SequentialHandler.queueRequest (D:\.Projects\HewkawDiscordBotProject\M2Bot\node_modules\@discordjs\rest\dist\index.js:953:14)
at async _REST.request (D:\.Projects\HewkawDiscordBotProject\M2Bot\node_modules\@discordjs\rest\dist\index.js:1266:22)
at async GuildMemberRoleManager.add (D:\.Projects\HewkawDiscordBotProject\M2Bot\node_modules\discord.js\src\managers\GuildMemberRoleManager.js:131:7)
at async Object.execute (D:\.Projects\HewkawDiscordBotProject\M2Bot\events\interactionCreateButtons.js:23:13)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:394:10)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
requestBody: { files: undefined, json: undefined },
rawError: { message: 'Missing Permissions', code: 50013 },
code: 50013,
status: 403,
method: 'PUT',
url: 'https://discord.com/api/v10/guilds/1121829832423129160/members/758681611251744788/roles/1181943769789108255'
}

Node.js v18.13.0
2 replies