From 42c743421b75109bbf197b7bab1f394da1d3bc3b Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Mon, 8 Mar 2021 15:51:12 +0100 Subject: [PATCH] refactor(handlers/guild): rename guild widget functions (#386) * Update guild.ts * Update guild.ts * this should be named getWidgetSettings * update mod imports --- src/api/handlers/guild.ts | 8 ++++---- src/api/handlers/mod.ts | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/api/handlers/guild.ts b/src/api/handlers/guild.ts index df04dc6b3..99f3bcfa5 100644 --- a/src/api/handlers/guild.ts +++ b/src/api/handlers/guild.ts @@ -694,8 +694,8 @@ export async function getAuditLogs( return result; } -/** Returns the guild embed object. Requires the MANAGE_GUILD permission. */ -export async function getEmbed(guildID: string) { +/** Returns the guild widget object. Requires the MANAGE_GUILD permission. */ +export async function getWidgetSettings(guildID: string) { const hasPerm = await botHasPermission(guildID, ["MANAGE_GUILD"]); if (!hasPerm) { throw new Error(Errors.MISSING_MANAGE_GUILD); @@ -706,8 +706,8 @@ export async function getEmbed(guildID: string) { return result; } -/** Modify a guild embed object for the guild. Requires the MANAGE_GUILD permission. */ -export async function editEmbed( +/** Modify a guild widget object for the guild. Requires the MANAGE_GUILD permission. */ +export async function editWidget( guildID: string, enabled: boolean, channelID?: string | null, diff --git a/src/api/handlers/mod.ts b/src/api/handlers/mod.ts index ddd9070a0..cb18f6431 100644 --- a/src/api/handlers/mod.ts +++ b/src/api/handlers/mod.ts @@ -39,6 +39,7 @@ import { editGuildTemplate, editIntegration, editRole, + editWidget, emojiURL, fetchMembers, getAuditLogs, @@ -66,6 +67,7 @@ import { getVanityURL, getVoiceRegions, getWebhooks, + getWidgetSettings, guildBannerURL, guildIconURL, guildSplashURL, @@ -160,7 +162,7 @@ export let handlers = { deleteIntegration, deleteRole, deleteServer, - editEmbed, + editWidget, editEmoji, editGuild, editGuildTemplate, @@ -173,6 +175,7 @@ export let handlers = { getBans, getChannel, getChannels, + getWidgetSettings, getEmbed, getEmoji, getEmojis,