#REST API

5 messages · Page 1 of 1 (latest)

clever mica

Does the @discordjs/rest API handle the rate limits and queue requests when reaching their limit, like discord JS
or I require to make my own handler ?

granite perchBOT
  • 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!
primal musk

It doesn’t do it like discord.js. Discord.js uses @discordjs/rest and that handles the ratelimits.

clever mica
primal musk It doesn’t do it *like* discord.js. Discord.js uses `@discordjs/rest` and that h...

I meant if I use @discordjs/rest

import { REST } from '@discordjs/rest';
import { Routes } from 'discord-api-types/v10';
class Discord extends DiscordBase {
    #config
    constructor(config) {
        super();
        this.version = '10';
        this.#config = config;
    }

    async getGuilds() {
        const rest = new REST({ version: this.version, makeRequest: fetch }).setToken(this.#config.tokenTest);
        return await rest.get(Routes.userGuilds());
    }

}

It would be likely the same as discord.js