Skip to content

Commit

Permalink
Add editGuildVanity() (#1166)
Browse files Browse the repository at this point in the history
  • Loading branch information
HeadTriXz authored Apr 14, 2021
1 parent e71c2ba commit c152aac
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,10 @@ declare namespace Eris {
users: User[];
webhooks: Webhook[];
}
interface GuildVanity {
code: string | null;
uses: number;
}
interface IntegrationApplication {
bot?: User;
description: string;
Expand Down Expand Up @@ -1518,6 +1522,7 @@ declare namespace Eris {
editGuildIntegration(guildID: string, integrationID: string, options: IntegrationOptions): Promise<void>;
editGuildMember(guildID: string, memberID: string, options: MemberOptions, reason?: string): Promise<void>;
editGuildTemplate(guildID: string, code: string, options: GuildTemplateOptions): Promise<GuildTemplate>;
editGuildVanity(guildID: string, code: string): Promise<GuildVanity>;
editGuildWidget(guildID: string, options: Widget): Promise<Widget>
editMessage(channelID: string, messageID: string, content: MessageContent): Promise<Message>;
editNickname(guildID: string, nick: string, reason?: string): Promise<void>;
Expand Down Expand Up @@ -1571,7 +1576,7 @@ declare namespace Eris {
getGuildPreview(guildID: string): Promise<GuildPreview>;
getGuildTemplate(code: string): Promise<GuildTemplate>;
getGuildTemplates(guildID: string): Promise<GuildTemplate[]>;
getGuildVanity(guildID: string): Promise<{ code?: string; uses?: number }>;
getGuildVanity(guildID: string): Promise<GuildVanity>;
getGuildWebhooks(guildID: string): Promise<Webhook[]>;
getGuildWidget(guildID: string): Promise<Widget>;
getInvite(inviteID: string, withCounts?: false): Promise<Invite<"withoutCount">>;
Expand Down Expand Up @@ -1894,6 +1899,7 @@ declare namespace Eris {
editNickname(nick: string): Promise<void>;
editRole(roleID: string, options: RoleOptions): Promise<Role>;
editTemplate(code: string, options: GuildTemplateOptions): Promise<GuildTemplate>
editVanity(code: string): Promise<GuildVanity>;
editWidget(options: Widget): Promise<Widget>;
fetchAllMembers(timeout?: number): Promise<number>;
fetchMembers(options?: FetchMembersOptions): Promise<Member[]>;
Expand All @@ -1913,7 +1919,7 @@ declare namespace Eris {
getRESTMembers(limit?: number, after?: string): Promise<Member[]>;
getRESTRoles(): Promise<Role[]>;
getTemplates(): Promise<GuildTemplate[]>;
getVanity(): Promise<{ code?: string; uses?: number }>;
getVanity(): Promise<GuildVanity>;
getVoiceRegions(): Promise<VoiceRegion[]>;
getWebhooks(): Promise<Webhook[]>;
getWidget(): Promise<Widget>;
Expand Down
12 changes: 12 additions & 0 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1354,6 +1354,18 @@ class Client extends EventEmitter {
});
}

/**
* Modify a guild's vanity code
* @arg {String} guildID The ID of the guild
* @arg {String} code The new vanity code
* @returns {Promise<Object>}
*/
editGuildVanity(guildID, code) {
return this.requestHandler.request("PATCH", Endpoints.GUILD_VANITY_URL(guildID), true, {
code
});
}

/**
* Edit a webhook
* @arg {String} webhookID The ID of the webhook
Expand Down
9 changes: 9 additions & 0 deletions lib/structures/Guild.js
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,15 @@ class Guild extends Base {
return this._client.editGuildTemplate.call(this._client, this.id, code, options);
}

/**
* Modify a guild's vanity code
* @arg {String} code The new vanity code
* @returns {Promise<Object>}
*/
editVanity(code) {
return this._client.editGuildVanity.call(this._client, this.id, code);
}

/**
* Modify a guild's widget
* @arg {Object} options The widget object to modify (https://discord.com/developers/docs/resources/guild#modify-guild-widget)
Expand Down

0 comments on commit c152aac

Please sign in to comment.