This commit is contained in:
Yuzu 2022-07-28 12:59:08 -05:00
parent be33bc5e2d
commit b26944e237

View File

@ -1040,35 +1040,40 @@ export class Guild extends BaseGuild implements Model {
* @returns A promise that resolves to the edited guild. * @returns A promise that resolves to the edited guild.
*/ */
async edit(options: GuildEditOptions): Promise<Guild> { async edit(options: GuildEditOptions): Promise<Guild> {
const guild = await this.session.rest.runMethod<DiscordGuild>(this.session.rest, 'PATCH', Routes.GUILDS(this.id), { const guild = await this.session.rest.runMethod<DiscordGuild>(
name: options.name, this.session.rest,
afk_channel_id: options.afkChannelId, 'PATCH',
afk_timeout: options.afkTimeout, Routes.GUILDS(this.id),
default_message_notifications: options.defaultMessageNotifications, {
explicit_content_filter: options.explicitContentFilter, name: options.name,
system_channel_flags: options.systemChannelFlags, afk_channel_id: options.afkChannelId,
verification_level: options.verificationLevel, afk_timeout: options.afkTimeout,
icon: 'iconURL' in options default_message_notifications: options.defaultMessageNotifications,
? options.iconURL && urlToBase64(options.iconURL) explicit_content_filter: options.explicitContentFilter,
: options.iconHash && Util.iconBigintToHash(options.iconHash), system_channel_flags: options.systemChannelFlags,
// extra props verification_level: options.verificationLevel,
splash: 'splashURL' in options icon: 'iconURL' in options
? options.splashURL && urlToBase64(options.splashURL) ? options.iconURL && urlToBase64(options.iconURL)
: options.iconHash && Util.iconBigintToHash(options.iconHash), : options.iconHash && Util.iconBigintToHash(options.iconHash),
banner: 'bannerURL' in options // extra props
? options.bannerURL && urlToBase64(options.bannerURL) splash: 'splashURL' in options
: options.bannerHash && Util.iconBigintToHash(options.bannerHash), ? options.splashURL && urlToBase64(options.splashURL)
discovery_splash: 'discoverySplashURL' in options : options.iconHash && Util.iconBigintToHash(options.iconHash),
? options.discoverySplashURL && urlToBase64(options.discoverySplashURL) banner: 'bannerURL' in options
: options.discoverySplashHash && Util.iconBigintToHash(options.discoverySplashHash), ? options.bannerURL && urlToBase64(options.bannerURL)
owner_id: options.ownerId, : options.bannerHash && Util.iconBigintToHash(options.bannerHash),
rules_channel_id: options.rulesChannelId, discovery_splash: 'discoverySplashURL' in options
public_updates_channel_id: options.publicUpdatesChannelId, ? options.discoverySplashURL && urlToBase64(options.discoverySplashURL)
preferred_locale: options.preferredLocale, : options.discoverySplashHash && Util.iconBigintToHash(options.discoverySplashHash),
features: options.features, owner_id: options.ownerId,
description: options.description, rules_channel_id: options.rulesChannelId,
premiumProgressBarEnabled: options.premiumProgressBarEnabled, public_updates_channel_id: options.publicUpdatesChannelId,
}); preferred_locale: options.preferredLocale,
features: options.features,
description: options.description,
premiumProgressBarEnabled: options.premiumProgressBarEnabled,
},
);
return new Guild(this.session, guild); return new Guild(this.session, guild);
} }