mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
Guilds helpers
This commit is contained in:
@@ -1,9 +1,18 @@
|
||||
import { rest } from "../../rest/rest.ts";
|
||||
import type { ModifyGuildWelcomeScreen } from "../../types/guilds/modify_guild_welcome_screen.ts";
|
||||
import type { WelcomeScreen } from "../../types/guilds/welcome_screen.ts";
|
||||
import { endpoints } from "../../util/constants.ts";
|
||||
import { snakelize } from "../../util/utils.ts";
|
||||
import type { Bot } from "../../bot.ts";
|
||||
|
||||
export async function editWelcomeScreen(guildId: bigint, options: ModifyGuildWelcomeScreen) {
|
||||
return await rest.runMethod<WelcomeScreen>("patch", endpoints.GUILD_WELCOME_SCREEN(guildId), snakelize(options));
|
||||
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
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user