mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
feat(Guild): add setBanner method and banner to edit (#3708)
This commit is contained in:
@@ -851,6 +851,7 @@ class Guild {
|
||||
* @property {ChannelResolvable} [systemChannel] The system channel of the guild
|
||||
* @property {number} [afkTimeout] The AFK timeout of the guild
|
||||
* @property {Base64Resolvable} [icon] The icon of the guild
|
||||
* @property {Base64Resolvable} [banner] The banner of the guild
|
||||
* @property {GuildMemberResolvable} [owner] The owner of the guild
|
||||
* @property {Base64Resolvable} [splash] The splash screen of the guild
|
||||
*/
|
||||
@@ -884,6 +885,7 @@ class Guild {
|
||||
if (typeof data.icon !== 'undefined') _data.icon = data.icon;
|
||||
if (data.owner) _data.owner_id = this.client.resolver.resolveUser(data.owner).id;
|
||||
if (typeof data.splash !== 'undefined') _data.splash = data.splash;
|
||||
if (typeof data.banner !== 'undefined') _data.banner = data.banner;
|
||||
if (typeof data.explicitContentFilter !== 'undefined') {
|
||||
_data.explicit_content_filter = Number(data.explicitContentFilter);
|
||||
}
|
||||
@@ -895,6 +897,16 @@ class Guild {
|
||||
return this.client.rest.methods.updateGuild(this, _data, reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a new guild banner.
|
||||
* @param {BufferResolvable|Base64Resolvable} banner The new banner of the guild
|
||||
* @param {string} [reason] Reason for changing the guild's banner
|
||||
* @returns {Guild}
|
||||
*/
|
||||
setBanner(banner, reason) {
|
||||
return this.client.resolver.resolveImage(banner).then(data => this.edit({ banner: data }, reason));
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit the level of the explicit content filter.
|
||||
* @param {number} explicitContentFilter The new level of the explicit content filter
|
||||
|
||||
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@@ -570,6 +570,7 @@ declare module 'discord.js' {
|
||||
public search(options?: MessageSearchOptions): Promise<MessageSearchResult>;
|
||||
public setAFKChannel(afkChannel: ChannelResolvable, reason?: string): Promise<Guild>;
|
||||
public setAFKTimeout(afkTimeout: number, reason?: string): Promise<Guild>;
|
||||
public setBanner(banner: Base64Resolvable, reason?: string): Promise<Guild>;
|
||||
public setChannelPosition(channel: string | GuildChannel, position: number, relative?: boolean): Promise<Guild>;
|
||||
public setChannelPositions(channelPositions: ChannelPosition[]): Promise<Guild>;
|
||||
public setDefaultMessageNotifications(defaultMessageNotifications: DefaultMessageNotifications, reason?: string): Promise<Guild>;
|
||||
@@ -1877,6 +1878,7 @@ declare module 'discord.js' {
|
||||
afkChannel?: ChannelResolvable;
|
||||
systemChannel?: ChannelResolvable;
|
||||
afkTimeout?: number;
|
||||
banner?: Base64Resolvable;
|
||||
icon?: Base64Resolvable;
|
||||
owner?: GuildMemberResolvable;
|
||||
splash?: Base64Resolvable;
|
||||
|
||||
Reference in New Issue
Block a user