feat(handlers): add getGuildPreview() (#408)

* add(handlers): getGuildPreview

* update comment

* check if guild is discoverable

* remove checking since getGuild does not work on unjoined guilds
This commit is contained in:
ITOH
2021-01-20 11:22:04 +01:00
committed by GitHub
parent 7f67b45a09
commit 11b68981f9
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -689,6 +689,11 @@ export async function unban(guildID: string, id: string) {
return RequestManager.delete(endpoints.GUILD_BAN(guildID, id)); 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. */ /** Modify a guilds settings. Requires the MANAGE_GUILD permission. */
export async function editGuild(guildID: string, options: GuildEditOptions) { export async function editGuild(guildID: string, options: GuildEditOptions) {
const hasPerm = await botHasPermission(guildID, ["MANAGE_GUILD"]); const hasPerm = await botHasPermission(guildID, ["MANAGE_GUILD"]);
+1
View File
@@ -42,4 +42,5 @@ export enum Errors {
RULES_CHANNEL_CANNOT_BE_DELETED = "RULES_CHANNEL_CANNOT_BE_DELETED", RULES_CHANNEL_CANNOT_BE_DELETED = "RULES_CHANNEL_CANNOT_BE_DELETED",
UPDATES_CHANNEL_CANNOT_BE_DELETED = "UPDATES_CHANNEL_CANNOT_BE_DELETED", UPDATES_CHANNEL_CANNOT_BE_DELETED = "UPDATES_CHANNEL_CANNOT_BE_DELETED",
GUILD_NOT_FOUND = "GUILD_NOT_FOUND", GUILD_NOT_FOUND = "GUILD_NOT_FOUND",
GUILD_NOT_DISCOVERABLE = "GUILD_NOT_DISCOVERABLE",
} }