feat(handlers): add getGatewayBot() & getApplicationInformation() (#428)

* feat(handlers): add getGatewayBot()

* refactor(bot): use getGatewayBot() to get gateway data

* feat(handlers): add getApplicationInformation

* add(handlers): getApplicationInformation jsdoc

* Add oauth required types

* create separate file

* delete misc

* OAuthApplication

* forgot to update import

* idk why that was here
This commit is contained in:
ITOH
2021-01-23 11:51:35 +01:00
committed by GitHub
parent 62af388820
commit 8beb036741
6 changed files with 95 additions and 8 deletions
+10
View File
@@ -0,0 +1,10 @@
import { RequestManager } from "../../rest/request_manager.ts";
import { DiscordBotGatewayData } from "../../types/mod.ts";
import { endpoints } from "../../util/constants.ts";
/** Get the bots Gateway metadata that can help during the operation of large or sharded bots. */
export function getGatewayBot() {
return RequestManager.get(
endpoints.GATEWAY_BOT,
) as Promise<DiscordBotGatewayData>;
}
+10
View File
@@ -0,0 +1,10 @@
import { RequestManager } from "../../rest/request_manager.ts";
import { OAuthApplication } from "../../types/oauth.ts";
import { endpoints } from "../../util/constants.ts";
/** Returns the bot's OAuth2 application object without `flags`. */
export function getApplicationInformation() {
return RequestManager.get(endpoints.OAUTH2_APPLICATION) as Promise<
OAuthApplication
>;
}