mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 09:50:07 +00:00
* add guild widget settings interface, transformer * fix bot.transformers.widgetSettings is not a function Co-authored-by: ITOH <to@itoh.at>
18 lines
576 B
TypeScript
18 lines
576 B
TypeScript
import type { Bot } from "../../bot.ts";
|
|
import { DiscordGuildWidgetSettings } from "../../types/discord.ts";
|
|
|
|
/** Modify a guild widget object for the guild. Requires the MANAGE_GUILD permission. */
|
|
export async function editWidget(bot: Bot, guildId: bigint, enabled: boolean, channelId?: string | null) {
|
|
const result = await bot.rest.runMethod<DiscordGuildWidgetSettings>(
|
|
bot.rest,
|
|
"patch",
|
|
bot.constants.endpoints.GUILD_WIDGET(guildId),
|
|
{
|
|
enabled,
|
|
channel_id: channelId,
|
|
},
|
|
);
|
|
|
|
return bot.transformers.widgetSettings(bot, result);
|
|
}
|