@discord-interactions/api
v0.3.21
Published
A Discord HTTP client that handles global and resource rate limits automatically
Downloads
662
Readme
@discord-interactions/api
A simple, typed wrapper around the Discord API.
This package is built on top of @discord-interactions/request
and discord-api-types
- it is fully typed and handles rate limits appropriately.
It is used internally within @discord-interactions/core
, but can easily be used outside of this context.
Installation
npm install @discord-interactions/api
Example Usage
import { client } from "discord-api";
try {
const response = await client.postGlobalApplicationCommand(
process.env.APPLICATION_ID,
payload
);
} catch (error: unknown) {
console.error((error as Error).message);
}
Credits
This code is derived from @IanMitchell's Interaction Kit: discord-api and distributed under the Apache 2 license. It was changed to use @discord-interactions/request
.