Files
discordeno/transformers/gatewayBot.ts
LTS20050703 8d4c0069b0 (transformers) return as Optionalize<typeof> (#2117)
* (transformers) return as Optionalize<typeof>

* fix check error

Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
2022-03-20 10:35:48 -04:00

20 lines
660 B
TypeScript

import { DiscordGetGatewayBot } from "../types/discord.ts";
import { Optionalize } from "../types/shared.ts";
export function transformGatewayBot(payload: DiscordGetGatewayBot) {
const gatewayBot = {
url: payload.url,
shards: payload.shards,
sessionStartLimit: {
total: payload.session_start_limit.total,
remaining: payload.session_start_limit.remaining,
resetAfter: payload.session_start_limit.reset_after,
maxConcurrency: payload.session_start_limit.max_concurrency,
},
};
return gatewayBot as Optionalize<typeof gatewayBot>;
}
export interface GetGatewayBot extends ReturnType<typeof transformGatewayBot> {}