Trolli
Trolli
DIAdiscord.js - Imagine an app
Created by Trolli on 8/7/2024 in #djs-questions
DiscordAPIError
now thers the error:
DiscordAPIError[20012]: You are not authorized to perform this action on this application
at handleErrors (C:\Users\docto\IdeaProjects\drip.bot\node_modules\@discordjs\rest\dist\index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Users\docto\IdeaProjects\drip.bot\node_modules\@discordjs\rest\dist\index.js:1133:23)
at async SequentialHandler.queueRequest (C:\Users\docto\IdeaProjects\drip.bot\node_modules\@discordjs\rest\dist\index.js:963:14)
at async _REST.request (C:\Users\docto\IdeaProjects\drip.bot\node_modules\@discordjs\rest\dist\index.js:1278:22)
at async C:\Users\docto\IdeaProjects\drip.bot\src\deploy-commands.js:36:22 {
requestBody: {
files: undefined,
json: [ [Object], [Object], [Object], [Object] ]
},
rawError: {
message: 'You are not authorized to perform this action on this application',
code: 20012
},
code: 20012,
status: 403,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/952185851218120804/commands'
}

Process finished with exit code 0
DiscordAPIError[20012]: You are not authorized to perform this action on this application
at handleErrors (C:\Users\docto\IdeaProjects\drip.bot\node_modules\@discordjs\rest\dist\index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Users\docto\IdeaProjects\drip.bot\node_modules\@discordjs\rest\dist\index.js:1133:23)
at async SequentialHandler.queueRequest (C:\Users\docto\IdeaProjects\drip.bot\node_modules\@discordjs\rest\dist\index.js:963:14)
at async _REST.request (C:\Users\docto\IdeaProjects\drip.bot\node_modules\@discordjs\rest\dist\index.js:1278:22)
at async C:\Users\docto\IdeaProjects\drip.bot\src\deploy-commands.js:36:22 {
requestBody: {
files: undefined,
json: [ [Object], [Object], [Object], [Object] ]
},
rawError: {
message: 'You are not authorized to perform this action on this application',
code: 20012
},
code: 20012,
status: 403,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/952185851218120804/commands'
}

Process finished with exit code 0
7 replies
DIAdiscord.js - Imagine an app
Created by Trolli on 8/7/2024 in #djs-questions
DiscordAPIError
No description
7 replies
DIAdiscord.js - Imagine an app
Created by Trolli on 8/7/2024 in #djs-questions
DiscordAPIError
discord js version: 14.15.3 node version: 20.16.0
7 replies
DIAdiscord.js - Imagine an app
Created by Trolli on 8/7/2024 in #djs-questions
DiscordAPIError
my code (directly copied from the discord.js guide website):
const { REST, Routes } = require('discord.js');
const { clientId, guildId, token } = require('./config.json');
const fs = require('node:fs');
const path = require('node:path');

const commands = [];
// Grab all the command folders from the commands directory you created earlier
const foldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(foldersPath);

for (const folder of commandFolders) {
// Grab all the command files from the commands directory you created earlier
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
commands.push(command.data.toJSON());
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}

// Construct and prepare an instance of the REST module
const rest = new REST().setToken(token);

// and deploy your commands!
(async () => {
try {
console.log(`Started refreshing ${commands.length} application (/) commands.`);

// The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put(
Routes.applicationCommands(clientId),
{ body: commands },
);

console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();
const { REST, Routes } = require('discord.js');
const { clientId, guildId, token } = require('./config.json');
const fs = require('node:fs');
const path = require('node:path');

const commands = [];
// Grab all the command folders from the commands directory you created earlier
const foldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(foldersPath);

for (const folder of commandFolders) {
// Grab all the command files from the commands directory you created earlier
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
commands.push(command.data.toJSON());
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}

// Construct and prepare an instance of the REST module
const rest = new REST().setToken(token);

// and deploy your commands!
(async () => {
try {
console.log(`Started refreshing ${commands.length} application (/) commands.`);

// The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put(
Routes.applicationCommands(clientId),
{ body: commands },
);

console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();
7 replies
DIAdiscord.js - Imagine an app
Created by Trolli on 9/2/2023 in #djs-questions
Is it possible to check if a user has 2fa enabled?
Its part of a larger, more complicated system, tbh I don't know why either, someone just asked me to code it
6 replies
DIAdiscord.js - Imagine an app
Created by Trolli on 9/2/2023 in #djs-questions
Is it possible to check if a user has 2fa enabled?
Checking if people have 2factor activated when joining the server
6 replies
DIAdiscord.js - Imagine an app
Created by Trolli on 4/30/2023 in #djs-questions
How do I get the referenced user id from a referenced message?
tried it and works ty ❤️ . One other question tho, do you know why I can't get the msg.author.id in this rewritten code:
let prevMessages = await message.channel.messages.fetch({ limit: 15 });
for (const msg of prevMessages) {
if (isUser) {
if (msg.author.id === message.author.id) {
... }
let prevMessages = await message.channel.messages.fetch({ limit: 15 });
for (const msg of prevMessages) {
if (isUser) {
if (msg.author.id === message.author.id) {
... }
I just get an error that says that it doesnt have an id TypeError: Cannot read properties of undefined (reading 'id')
13 replies
DIAdiscord.js - Imagine an app
Created by Trolli on 4/30/2023 in #djs-questions
How do I get the referenced user id from a referenced message?
alr ima try that
13 replies
DIAdiscord.js - Imagine an app
Created by Trolli on 4/30/2023 in #djs-questions
How do I get the referenced user id from a referenced message?
I want the user id of the original message that has been replied to, so that i can check if it isn't an other user
13 replies
DIAdiscord.js - Imagine an app
Created by Trolli on 4/30/2023 in #djs-questions
How do I get the referenced user id from a referenced message?
13 replies