@wumpcord/rest
🥀 Standalone package for Discord's REST and CDN for Wumpcord
Usage
import { RestClient, CDN, DiscordRestError, DiscordAPIError } from '@wumpcord/rest';
import { readFileSync } from 'fs';
CDN.getDefaultAvatar('5820');
CDN.getUserAvatar('280158289667555328', 'f788c8a8993bc702824700eda5623795');
const rest = new RestClient('bot token');
rest.dispatch({
endpoint: '/channels/:id/messages',
method: 'POST',
query: {
id: '794102278004932648'
},
data: {
content: 'Hello, world!'
},
file: {
file: readFileSync('./path/to/some/file.png'),
name: 'file.png'
}
}).then(message => {
}).catch((error) => {
if (error instanceof DiscordRestError) {
}
if (error instanceof DiscordAPIError) {
}
console.error(error);
});