Problem with rest module

So i asked in #djs-help-v14 a few time about my deploy command not working, especially all lines after the rest.put. Since i put this code in my ready event, everyone and me thought that i was rate limit. But the night after someone said that to me, it worked again. then, i removed the code from my ready event, changed the way to execute it so i executed it only 1 time, continued to work on my bot, and when i added a new command and executed my deploy command, it didn't work. I thought it was rate limit again because the var "response = rest.put(..." was empty. But i just found about client.rest.on("response", console.log) and i saw that i was not rate limit. So i'm asking here for help deploy_command.js:
function deploy_commands(){


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') || file.endsWith('.mjs'));
// 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. TEST`);

// The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put(
Routes.applicationGuildCommands(clientId, guildId),
{ body: commands },
).then(async () => {
console.log(`THEN THEN THEN Successfully reloaded ${data.length} application (/) commands.`)
}).catch((err) => {
console.error(err)
});



console.log("TEST TEST TEST")

console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();
}




module.exports = deploy_commands
// deploy_commands()
function deploy_commands(){


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') || file.endsWith('.mjs'));
// 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. TEST`);

// The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put(
Routes.applicationGuildCommands(clientId, guildId),
{ body: commands },
).then(async () => {
console.log(`THEN THEN THEN Successfully reloaded ${data.length} application (/) commands.`)
}).catch((err) => {
console.error(err)
});



console.log("TEST TEST TEST")

console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();
}




module.exports = deploy_commands
// deploy_commands()
one of the 10 000000 rest reponse:
{
method: 'PUT',
path: '/channels/1260958647878422529/permissions/1260738030206189660',
route: '/channels/:id/permissions/:id',
options: {
body: '{"id":"1260738030206189660","type":0,"allow":"0","deny":"2048"}',
headers: {
'Content-Type': 'application/json',
'User-Agent': 'DiscordBot (https://discord.js.org, 2.3.0) discord.js/14.15.3 Node.js/18.17.0',
Authorization: 'Bot xxxxxxxxxx'
},
method: 'PUT',
dispatcher: undefined
},
data: {
body: {
id: '1260738030206189660',
type: 0,
allow: [PermissionsBitField],
deny: [PermissionsBitField]
},
files: undefined,
auth: true,
signal: undefined
},
retries: 0
}
{
method: 'PUT',
path: '/channels/1260958647878422529/permissions/1260738030206189660',
route: '/channels/:id/permissions/:id',
options: {
body: '{"id":"1260738030206189660","type":0,"allow":"0","deny":"2048"}',
headers: {
'Content-Type': 'application/json',
'User-Agent': 'DiscordBot (https://discord.js.org, 2.3.0) discord.js/14.15.3 Node.js/18.17.0',
Authorization: 'Bot xxxxxxxxxx'
},
method: 'PUT',
dispatcher: undefined
},
data: {
body: {
id: '1260738030206189660',
type: 0,
allow: [PermissionsBitField],
deny: [PermissionsBitField]
},
files: undefined,
auth: true,
signal: undefined
},
retries: 0
}
6 Replies
d.js toolkit
d.js toolkit•4mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - ✅ Marked as resolved by OP
Xalri
Xalri•4mo ago
after writing all the response in a file (because the terminal is too small), all the response are from when i set the send_message permission of all channel for the role "Muted" to false. The reponse for the deploy command request don't appear (or the request don't exist) i did but there was nothing that's why i listen to response because in the resposne there is the rate limit information not in the one i show mb
{
body: BodyReadable {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 65536,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: null,
ended: true,
endEmitted: false,
reading: false,
constructed: true,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
destroyed: false,
errored: null,
closed: false,
closeEmitted: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
dataEmitted: false,
decoder: null,
encoding: null,
[Symbol(kPaused)]: null
},
_read: [Function: bound resume],
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
[Symbol(kCapture)]: false,
[Symbol(kAbort)]: [Function: abort],
[Symbol(kConsume)]: null,
[Symbol(kBody)]: null,
[Symbol(kContentType)]: 'text/html; charset=utf-8',
[Symbol(kContentLength)]: undefined,
[Symbol(kReading)]: false
},
arrayBuffer: [AsyncFunction: arrayBuffer],
json: [AsyncFunction: json],
text: [AsyncFunction: text],
bodyUsed: false,
headers: Headers {
date: 'Sat, 13 Jul 2024 20:31:14 GMT',
'content-type': 'text/html; charset=utf-8',
connection: 'keep-alive',
'set-cookie': '__dcfduid=d9bb3d90415611ef81ce5a673df258c3; Expires=Thu, 12-Jul-2029 20:31:14 GMT; Max-Age=157680000; Secure; HttpOnly; Path=/; SameSite=Lax,__sdcfduid=d9bb3d90415611ef81ce5a673df258c32c7070bcd7af43358772e548ac13897ec7ac16e64c7c7e066b6e53f38c45bb66; Expires=Thu, 12-Jul-2029 20:31:14 GMT; Max-Age=157680000; Secure; HttpOnly; Path=/; SameSite=Lax,__cfruid=0366b29a7874c480e43ca63731c681b381113bfb-1720902674; path=/; domain=.discord.com; HttpOnly; Secure; SameSite=None,_cfuvid=4HvupfwtGJjpN_Lnl9hR.QcEQhK0NKIFhQnjJeX5h3U-1720902674824-0.0.1.1-604800000; path=/; domain=.discord.com; HttpOnly; Secure; SameSite=None',
'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
'x-ratelimit-bucket': '6e836da6cef38ba2f3dfd8568a4e9631',
'x-ratelimit-limit': '10',

'x-ratelimit-remaining': '9',
'x-ratelimit-reset': '1720902684.761',
'x-ratelimit-reset-after': '10.000',
via: '1.1 google',
'alt-svc': 'h3=":443"; ma=86400',
'cf-cache-status': 'DYNAMIC',
'report-to': '{"endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=cQI2f7fkt%2B4P868dO3Rd2oARZL6LgKDQmgBP239FUL22zsbQH03m0eYuI1cPwGkNA7WnVoz65lnRERDzXBFw5veVNVCMYcwG1c5apnL5HZ%2FyrUC4o6B3GwAE0IQA"}],"group":"cf-nel","max_age":604800}',
nel: '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}',
'x-content-type-options': 'nosniff',
'content-security-policy': "frame-ancestors 'none'; default-src 'none'",
server: 'cloudflare',
'cf-ray': '8a2c09135ef71957-FRA'
},
status: 204,
statusText: 'No Content',
ok: true
}
{
body: BodyReadable {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 65536,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [],
flowing: null,
ended: true,
endEmitted: false,
reading: false,
constructed: true,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
destroyed: false,
errored: null,
closed: false,
closeEmitted: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
dataEmitted: false,
decoder: null,
encoding: null,
[Symbol(kPaused)]: null
},
_read: [Function: bound resume],
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
[Symbol(kCapture)]: false,
[Symbol(kAbort)]: [Function: abort],
[Symbol(kConsume)]: null,
[Symbol(kBody)]: null,
[Symbol(kContentType)]: 'text/html; charset=utf-8',
[Symbol(kContentLength)]: undefined,
[Symbol(kReading)]: false
},
arrayBuffer: [AsyncFunction: arrayBuffer],
json: [AsyncFunction: json],
text: [AsyncFunction: text],
bodyUsed: false,
headers: Headers {
date: 'Sat, 13 Jul 2024 20:31:14 GMT',
'content-type': 'text/html; charset=utf-8',
connection: 'keep-alive',
'set-cookie': '__dcfduid=d9bb3d90415611ef81ce5a673df258c3; Expires=Thu, 12-Jul-2029 20:31:14 GMT; Max-Age=157680000; Secure; HttpOnly; Path=/; SameSite=Lax,__sdcfduid=d9bb3d90415611ef81ce5a673df258c32c7070bcd7af43358772e548ac13897ec7ac16e64c7c7e066b6e53f38c45bb66; Expires=Thu, 12-Jul-2029 20:31:14 GMT; Max-Age=157680000; Secure; HttpOnly; Path=/; SameSite=Lax,__cfruid=0366b29a7874c480e43ca63731c681b381113bfb-1720902674; path=/; domain=.discord.com; HttpOnly; Secure; SameSite=None,_cfuvid=4HvupfwtGJjpN_Lnl9hR.QcEQhK0NKIFhQnjJeX5h3U-1720902674824-0.0.1.1-604800000; path=/; domain=.discord.com; HttpOnly; Secure; SameSite=None',
'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
'x-ratelimit-bucket': '6e836da6cef38ba2f3dfd8568a4e9631',
'x-ratelimit-limit': '10',

'x-ratelimit-remaining': '9',
'x-ratelimit-reset': '1720902684.761',
'x-ratelimit-reset-after': '10.000',
via: '1.1 google',
'alt-svc': 'h3=":443"; ma=86400',
'cf-cache-status': 'DYNAMIC',
'report-to': '{"endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=cQI2f7fkt%2B4P868dO3Rd2oARZL6LgKDQmgBP239FUL22zsbQH03m0eYuI1cPwGkNA7WnVoz65lnRERDzXBFw5veVNVCMYcwG1c5apnL5HZ%2FyrUC4o6B3GwAE0IQA"}],"group":"cf-nel","max_age":604800}',
nel: '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}',
'x-content-type-options': 'nosniff',
'content-security-policy': "frame-ancestors 'none'; default-src 'none'",
server: 'cloudflare',
'cf-ray': '8a2c09135ef71957-FRA'
},
status: 204,
statusText: 'No Content',
ok: true
}
So I'm not rate limit. My put request is simply not executed (or at least, no response is returned) In the second response I sent, you can see the x-ratelimit-limit: 10 and the x-ratelimit-remaining: 9 And I already listened to the rate limit event by following the djs 14 guide and nothing appeared no , indeed but now i did it and still nothing
const { REST, Routes } = require('discord.js');
const { clientId, guildId, token } = require('./config.json');
const fs = require('node:fs');
const path = require('node:path');


function deploy_commands(){

console.log(REST)


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') || file.endsWith('.mjs'));
// 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);

rest.on('rateLimited', console.log);




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

// The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put(
Routes.applicationGuildCommands(clientId, guildId),
{ body: commands },
).then(async () => {
console.log(`THEN THEN THEN Successfully reloaded ${data.length} application (/) commands.`)
}).catch((err) => {
console.error(err)
});



console.log("TEST TEST TEST")

console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();
}




module.exports = deploy_commands
// deploy_commands()
const { REST, Routes } = require('discord.js');
const { clientId, guildId, token } = require('./config.json');
const fs = require('node:fs');
const path = require('node:path');


function deploy_commands(){

console.log(REST)


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') || file.endsWith('.mjs'));
// 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);

rest.on('rateLimited', console.log);




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

// The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put(
Routes.applicationGuildCommands(clientId, guildId),
{ body: commands },
).then(async () => {
console.log(`THEN THEN THEN Successfully reloaded ${data.length} application (/) commands.`)
}).catch((err) => {
console.error(err)
});



console.log("TEST TEST TEST")

console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();
}




module.exports = deploy_commands
// deploy_commands()
yes everything after the rest.put is not executed in my console, i have nothing, and i don't think i have logs
Xalri
Xalri•4mo ago
Daki Hosting
Daki Hosting
Hey, you want to host your bot for free today and with a good uptime? Then you are exactly right with Daki, convince yourself today!
Xalri
Xalri•4mo ago
yes but i have 2 pcs and i'm tired of forgeting files and not being able to progress until i recode the missing files but i could ok, i'll try, it will be quick got problem with vs c++ idk, it raised an error telling me i needed it, and on my other pc, i installed it but i didn't remember why maybe something with others packages but finally i'm here wait what ?????
const node_fetch_1 = require("node-fetch");
^

Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\xxx\OneDrive\Documents\discord-bot-test\test-bot-xxx\node_modules\node-fetch\src\index.js from C:\Users\xxx\OneDrive\Documents\discord-bot-test\test-bot-xxx\node_modules\discord-backup\lib\index.js not supported.
Instead change the require of C:\Users\xxx\OneDrive\Documents\discord-bot-test\test-bot-xxx\node_modules\node-fetch\src\index.js in C:\Users\xxx\OneDrive\Documents\discord-bot-test\test-bot-xxx\node_modules\discord-backup\lib\index.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (C:\Users\xxx\OneDrive\Documents\discord-bot-test\test-bot-xxx\node_modules\discord-backup\lib\index.js:5:22) {
code: 'ERR_REQUIRE_ESM'
}
const node_fetch_1 = require("node-fetch");
^

Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\xxx\OneDrive\Documents\discord-bot-test\test-bot-xxx\node_modules\node-fetch\src\index.js from C:\Users\xxx\OneDrive\Documents\discord-bot-test\test-bot-xxx\node_modules\discord-backup\lib\index.js not supported.
Instead change the require of C:\Users\xxx\OneDrive\Documents\discord-bot-test\test-bot-xxx\node_modules\node-fetch\src\index.js in C:\Users\xxx\OneDrive\Documents\discord-bot-test\test-bot-xxx\node_modules\discord-backup\lib\index.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (C:\Users\xxx\OneDrive\Documents\discord-bot-test\test-bot-xxx\node_modules\discord-backup\lib\index.js:5:22) {
code: 'ERR_REQUIRE_ESM'
}
solved it, i used the previous version I LOVE YOU
{
global: false,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1250124908030328914/guilds/1250125877203701841/commands',
route: '/applications/:id/guilds/:id/commands',
majorParameter: 'global',
hash: 'Global(PUT:/applications/:id/guilds/:id/commands)',
limit: 2,
timeToReset: 47363,
retryAfter: 47363,
sublimitTimeout: 0,
scope: 'user'
}
{
global: false,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1250124908030328914/guilds/1250125877203701841/commands',
route: '/applications/:id/guilds/:id/commands',
majorParameter: 'global',
hash: 'Global(PUT:/applications/:id/guilds/:id/commands)',
limit: 2,
timeToReset: 47363,
retryAfter: 47363,
sublimitTimeout: 0,
scope: 'user'
}
i try the new one...
{
global: false,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1250124908030328914/guilds/1250125877203701841/commands',
route: '/applications/:id/guilds/:id/commands',
majorParameter: 'global',
hash: 'Global(PUT:/applications/:id/guilds/:id/commands)',
limit: 2,
timeToReset: 43595,
retryAfter: 43595,
sublimitTimeout: 0,
scope: 'user'
}
{
global: false,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1250124908030328914/guilds/1250125877203701841/commands',
route: '/applications/:id/guilds/:id/commands',
majorParameter: 'global',
hash: 'Global(PUT:/applications/:id/guilds/:id/commands)',
limit: 2,
timeToReset: 43595,
retryAfter: 43595,
sublimitTimeout: 0,
scope: 'user'
}
i left for at least 2-3 minutes so the 43 second were ok then i closed my bot (ctrl + c) and reexecute the node main.js now i got the new one but newer one appear it seems like it reexecute the request again and again got 3 new
{
global: false,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1250124908030328914/guilds/1250125877203701841/commands',
route: '/applications/:id/guilds/:id/commands',
majorParameter: 'global',
hash: 'Global(PUT:/applications/:id/guilds/:id/commands)',
limit: 2,
timeToReset: 59783,
retryAfter: 59783,
sublimitTimeout: 0,
scope: 'user'
}
{
global: false,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1250124908030328914/guilds/1250125877203701841/commands',
route: '/applications/:id/guilds/:id/commands',
majorParameter: 'global',
hash: 'Global(PUT:/applications/:id/guilds/:id/commands)',
limit: 2,
timeToReset: 59741,
retryAfter: 59741,
sublimitTimeout: 0,
scope: 'user'
}
{
global: false,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1250124908030328914/guilds/1250125877203701841/commands',
route: '/applications/:id/guilds/:id/commands',
majorParameter: 'global',
hash: 'Global(PUT:/applications/:id/guilds/:id/commands)',
limit: 2,
timeToReset: 59731,
retryAfter: 59731,
sublimitTimeout: 0,
scope: 'user'
}
{
global: false,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1250124908030328914/guilds/1250125877203701841/commands',
route: '/applications/:id/guilds/:id/commands',
majorParameter: 'global',
hash: 'Global(PUT:/applications/:id/guilds/:id/commands)',
limit: 2,
timeToReset: 59783,
retryAfter: 59783,
sublimitTimeout: 0,
scope: 'user'
}
{
global: false,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1250124908030328914/guilds/1250125877203701841/commands',
route: '/applications/:id/guilds/:id/commands',
majorParameter: 'global',
hash: 'Global(PUT:/applications/:id/guilds/:id/commands)',
limit: 2,
timeToReset: 59741,
retryAfter: 59741,
sublimitTimeout: 0,
scope: 'user'
}
{
global: false,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1250124908030328914/guilds/1250125877203701841/commands',
route: '/applications/:id/guilds/:id/commands',
majorParameter: 'global',
hash: 'Global(PUT:/applications/:id/guilds/:id/commands)',
limit: 2,
timeToReset: 59731,
retryAfter: 59731,
sublimitTimeout: 0,
scope: 'user'
}
with the new one appearing, i fell like the time is in second not ms i log the time when the ratelimit event is sent every time to see the diference and compar to the time in the response every 1 minutes exactly it resend the request and the number "time to reset" goes down 55 i don't it do this alone am i that dumb? yes got this after closing the host:
{
global: false,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1250124908030328914/guilds/1250125877203701841/commands',
route: '/applications/:id/guilds/:id/commands',
majorParameter: 'global',
hash: 'Global(PUT:/applications/:id/guilds/:id/commands)',
limit: 2,
timeToReset: 47170,
retryAfter: 47170,
sublimitTimeout: 0,
scope: 'user'
}
{
global: false,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1250124908030328914/guilds/1250125877203701841/commands',
route: '/applications/:id/guilds/:id/commands',
majorParameter: 'global',
hash: 'Global(PUT:/applications/:id/guilds/:id/commands)',
limit: 2,
timeToReset: 47170,
retryAfter: 47170,
sublimitTimeout: 0,
scope: 'user'
}
i'm still ratelimit
13:39:13 RATE LIMIT
{
global: false,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1250124908030328914/guilds/1250125877203701841/commands',
route: '/applications/:id/guilds/:id/commands',
majorParameter: 'global',
hash: 'Global(PUT:/applications/:id/guilds/:id/commands)',
limit: 2,
timeToReset: 45082,
retryAfter: 45082,
sublimitTimeout: 0,
scope: 'user'
}
13:39:13 RATE LIMIT
{
global: false,
method: 'PUT',
url: 'https://discord.com/api/v10/applications/1250124908030328914/guilds/1250125877203701841/commands',
route: '/applications/:id/guilds/:id/commands',
majorParameter: 'global',
hash: 'Global(PUT:/applications/:id/guilds/:id/commands)',
limit: 2,
timeToReset: 45082,
retryAfter: 45082,
sublimitTimeout: 0,
scope: 'user'
}
that's not logic after someone told me about the rrate limit ( i think it was you) i removed the functionfrom my ready evnet and only use it 2 times in the day and the second was false due to rater limit ok nope and i log all response and rate-limit so i would have seen it the strange tthing is that after changing my token, rate-limit event is not trigger anymore, but my new command isn't load in my server reloading didn't solve it. Too many automatic request, my terminal was full, didn't see if the then catch. Restart it, rate-limit came back everything's "right" just have to wait 12 h true so, see you in 12 h i guess Just, how do you know these informations? I've searched online and I found nothing If you have the section about the rate limit in the doc, can you send it pls?
d.js docs
d.js docs•4mo ago
:discord: Rate Limits Rate limits exist across Discord's APIs to prevent spam, abuse, and service overload. Limits are applied to individual bots and users both on a per-route basis and globally. Individuals are determined using a request's authentication—for example, a bot token for a bot. read more
Xalri
Xalri•4mo ago
waiiiiiit so if i deploy them globaly, it will works? yeah, i misunderstood i saw that if you deploy the commands globally, it can take times, sometimes to one hour but in only one guild, it's instant and since i'm working on it, i don't wanna wait to use my commands something weird append i changed to global deployement and when i restart my bot, i didn't get the limit rate message and i get the data.length error as you said but my command are not send and i got these error:
ReferenceError: Cannot access 'data' before initialization
at C:\Users\xxx\OneDrive\Documents\discord-bot-test\test-bot-xxx\deploy_commands.js:61:57
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async C:\Users\xxx\OneDrive\Documents\discord-bot-test\test-bot-xxx\deploy_commands.js:57:17
TEST TEST TEST
TypeError: Cannot read properties of undefined (reading 'length')
at C:\Users\xxx\OneDrive\Documents\discord-bot-test\test-bot-xxx\deploy_commands.js:70:46
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
ReferenceError: Cannot access 'data' before initialization
at C:\Users\xxx\OneDrive\Documents\discord-bot-test\test-bot-xxx\deploy_commands.js:61:57
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async C:\Users\xxx\OneDrive\Documents\discord-bot-test\test-bot-xxx\deploy_commands.js:57:17
TEST TEST TEST
TypeError: Cannot read properties of undefined (reading 'length')
at C:\Users\xxx\OneDrive\Documents\discord-bot-test\test-bot-xxx\deploy_commands.js:70:46
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
why didn't you start by that 🤣 i understand, and i correct it, thank you for everything now i'll use global deploying ( because i'm not rate limit on it )
Want results from more Discord servers?
Add your server