add: editWelcomeScreen function

This commit is contained in:
ITOH
2021-04-14 10:40:56 +02:00
parent 2d30086863
commit 38bf6727ba
2 changed files with 24 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
import { rest } from "../../rest/rest.ts";
import { ModifyGuildWelcomeScreen } from "../../types/guilds/modify_guild_welcome_screen.ts";
import { WelcomeScreen } from "../../types/mod.ts";
import { endpoints } from "../../util/constants.ts";
import {
camelKeysToSnakeCase,
snakeKeysToCamelCase,
} from "../../util/utils.ts";
export async function editWelcomeScreen(
guildId: string,
options: ModifyGuildWelcomeScreen,
) {
const result = await rest.runMethod(
"patch",
endpoints.GUILD_WELCOME_SCREEN(guildId),
camelKeysToSnakeCase(options),
);
return snakeKeysToCamelCase<WelcomeScreen>(result);
}