1.0.4 • Published 3 years ago
@razulmao/rest v1.0.4
@razulmao/rest
A fork of @discordjs/rest but with more features.
1.0.4
Proxy support has been added for requests.
An example is below.
import { REST } from '@razulmao/rest';
class RequestClient extends REST {
client = new REST();
authPrefix;
/**
* @param {string} token
* @param {"Bot" | "Bearer"} authPrefix
**/
construct(token, authPrefix = 'Bot') {
if (token) this.client.setToken(token);
this.authPrefix = authPrefix;
}
/**
* @description "Fetches the users information."
**/
fetchMe() {
return this.client.get('/users/@me', {
authPrefix: this.authPrefix,
proxy: {
type: 'https',
proxyURL: 'https://127.0.0.1:80',
},
});
}
}
Basic Example
import { REST } from '@razulmao/rest';
class RequestClient extends REST {
client = new REST();
authPrefix;
/**
* @param {string} token
* @param {"Bot" | "Bearer"} authPrefix
**/
construct(token, authPrefix = 'Bot') {
if (token) this.client.setToken(token);
this.authPrefix = authPrefix;
}
/**
* @description "Fetches the users information."
**/
fetchMe() {
return this.client.get('/users/@me', {
authPrefix: this.authPrefix,
});
}
}