mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 09:20:08 +00:00
* perf(plugins/helpers,rest,site,template)!: uppercase rest methods There is no need for us to pass the methods in lower case and then use the `toUpperCase()` method everywhere. Therefore this PR changes every lowercase method to be uppercase (eg. `"get"` => `"GET"`). * template is old version
18 lines
573 B
TypeScript
18 lines
573 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.routes.GUILD_WIDGET(guildId),
|
|
{
|
|
enabled,
|
|
channel_id: channelId,
|
|
},
|
|
);
|
|
|
|
return bot.transformers.widgetSettings(bot, result);
|
|
}
|