diff --git a/src/api/handlers/guild.ts b/src/api/handlers/guild.ts index d7dd8343e..da75af44d 100644 --- a/src/api/handlers/guild.ts +++ b/src/api/handlers/guild.ts @@ -689,6 +689,11 @@ export async function unban(guildID: string, id: string) { return RequestManager.delete(endpoints.GUILD_BAN(guildID, id)); } +/** Returns the guild preview object for the given id. If the bot is not in the guild, then the guild must be Discoverable. */ +export function getGuildPreview(guildID: string) { + return RequestManager.get(endpoints.GUILD_PREVIEW(guildID)); +} + /** Modify a guilds settings. Requires the MANAGE_GUILD permission. */ export async function editGuild(guildID: string, options: GuildEditOptions) { const hasPerm = await botHasPermission(guildID, ["MANAGE_GUILD"]); diff --git a/src/types/errors.ts b/src/types/errors.ts index 02fe6c29a..f99456106 100644 --- a/src/types/errors.ts +++ b/src/types/errors.ts @@ -42,4 +42,5 @@ export enum Errors { RULES_CHANNEL_CANNOT_BE_DELETED = "RULES_CHANNEL_CANNOT_BE_DELETED", UPDATES_CHANNEL_CANNOT_BE_DELETED = "UPDATES_CHANNEL_CANNOT_BE_DELETED", GUILD_NOT_FOUND = "GUILD_NOT_FOUND", + GUILD_NOT_DISCOVERABLE = "GUILD_NOT_DISCOVERABLE", }