Stop checking ratelimits
This commit is contained in:
parent
1b0269c304
commit
291db33692
24
main.js
24
main.js
@ -31,6 +31,7 @@ client.once('ready', async () => {
|
||||
fn.collectionBuilders.slashCommands(client);
|
||||
await fn.collectionBuilders.guildInfos(client);
|
||||
await fn.collectionBuilders.messageCollectors(client);
|
||||
checkRateLimits();
|
||||
console.log('Ready!');
|
||||
client.user.setActivity({ name: strings.activity.name, type: ActivityType.Watching });
|
||||
if (isDev == 'false') {
|
||||
@ -85,6 +86,29 @@ client.on('interactionCreate', async interaction => {
|
||||
}
|
||||
});
|
||||
|
||||
async function checkRateLimits(hi) {
|
||||
const axios = require('axios');
|
||||
|
||||
// Make a GET request to the Discord API
|
||||
await axios.get('https://discord.com/api/v10/users/@me', {
|
||||
headers: {
|
||||
'Authorization': `Bot ${token}`
|
||||
}
|
||||
}).then(response => {
|
||||
// Get the rate limit headers
|
||||
const remaining = response.headers['x-ratelimit-remaining'];
|
||||
const reset = response.headers['x-ratelimit-reset'];
|
||||
|
||||
// Log the rate limit headers
|
||||
console.log(`Remaining requests: ${remaining}`);
|
||||
console.log(`Reset time (Unix epoch seconds): ${reset}`);
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
await fn.sleep(500).then(async () =>{
|
||||
await checkRateLimits();
|
||||
})
|
||||
}
|
||||
|
||||
process.on('unhandledRejection', error => {
|
||||
console.error('Unhandled promise rejection:', error);
|
||||
|
@ -17,6 +17,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/voidf1sh/silvanus#readme",
|
||||
"dependencies": {
|
||||
"axios": "^1.3.3",
|
||||
"discord.js": "^14.7.1",
|
||||
"dotenv": "^16.0.3",
|
||||
"mysql": "^2.18.1",
|
||||
|
Loading…
Reference in New Issue
Block a user