Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Guild): Edit MFA level #1473

Merged
merged 10 commits into from
Jan 22, 2024
2 changes: 2 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2641,6 +2641,7 @@ declare namespace Eris {
): Promise<Emoji>;
editGuildIntegration(guildID: string, integrationID: string, options: IntegrationOptions): Promise<void>;
editGuildMember(guildID: string, memberID: string, options: MemberOptions, reason?: string): Promise<Member>;
editGuildMFALevel(guildID: string, level: 0 | 1, reason?: string): Promise<number>;
conorwastakenwastaken marked this conversation as resolved.
Show resolved Hide resolved
editGuildScheduledEvent<T extends GuildScheduledEventEntityTypes>(guildID: string, eventID: string, event: GuildScheduledEventEditOptions<T>, reason?: string): Promise<GuildScheduledEvent<T>>;
editGuildSticker(guildID: string, stickerID: string, options?: EditStickerOptions, reason?: string): Promise<Sticker>;
editGuildTemplate(guildID: string, code: string, options: GuildTemplateOptions): Promise<GuildTemplate>;
Expand Down Expand Up @@ -3067,6 +3068,7 @@ declare namespace Eris {
editEmoji(emojiID: string, options: { name: string; roles?: string[] }, reason?: string): Promise<Emoji>;
editIntegration(integrationID: string, options: IntegrationOptions): Promise<void>;
editMember(memberID: string, options: MemberOptions, reason?: string): Promise<Member>;
editMFALevel(level: 0 | 1, reason?: string): Promise<number>;
/** @deprecated */
editNickname(nick: string): Promise<void>;
editRole(roleID: string, options: RoleOptions): Promise<Role>;
Expand Down
15 changes: 15 additions & 0 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1784,6 +1784,21 @@ class Client extends EventEmitter {
}).then((member) => new Member(member, this.guilds.get(guildID), this));
}

/**
* Edit a guild's MFA level (multi-factor authentication)
* @arg {String} guildID The ID of the guild
* @arg {Number} level The new MFA level, `0` to disable MFA, `1` to enable it
* @arg {String} [reason] The reason to be displayed in audit logs
* @returns {Promise<Number>}
*/
editGuildMFALevel(guildID, level, reason) {
return this.requestHandler.request("POST", Endpoints.GUILD_MFA_LEVEL(guildID), true, {
level: level,
reason: reason
});
}


/**
* Edit a guild scheduled event
* @arg {String} guildID The guild ID where the event will be edited
Expand Down
1 change: 1 addition & 0 deletions lib/rest/Endpoints.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions lib/structures/Guild.js
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,16 @@ class Guild extends Base {
return this._client.editGuildMember.call(this._client, this.id, memberID, options, reason);
}

/**
* Edit the guild's MFA level (multi-factor authentication)
* @param {Number} level The new MFA level, `0` to disable MFA, `1` to enable it
* @param {String} [reason] The reason to be displayed in audit logs
* @returns {Promise<Number>}
*/
editMFALevel(level, reason) {
return this._client.editGuildMFALevel.call(this._client, this.id, level, reason);
}

/**
* [DEPRECATED] Edit the bot's nickname in the guild
* @arg {String} nick The nickname
Expand Down