Files
discordeno/src/helpers/guilds/edit_welcome_screen.ts
2021-10-21 17:38:57 +00:00

19 lines
789 B
TypeScript

import type { ModifyGuildWelcomeScreen } from "../../types/guilds/modify_guild_welcome_screen.ts";
import type { WelcomeScreen } from "../../types/guilds/welcome_screen.ts";
import type { Bot } from "../../bot.ts";
export async function editWelcomeScreen(bot: Bot, guildId: bigint, options: ModifyGuildWelcomeScreen) {
return await bot.rest.runMethod<WelcomeScreen>("patch", bot.constants.endpoints.GUILD_WELCOME_SCREEN(guildId), {
enabled: options.enabled,
welcomeScreen: options.welcomeScreen?.map((welcomeScreen) => {
return {
channel_id: welcomeScreen.channelId,
description: welcomeScreen.description,
emoji_id: welcomeScreen.emojiId,
emoji_name: welcomeScreen.emojiName,
};
}),
description: options.description,
});
}