mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
feat(Guild): add banner to edit method and add setBanner method (#3364)
* add setBanner method to Guild * typos fixed & typings added * more typings * docs(Guild): add banner to GuildEditData
This commit is contained in:
@@ -770,6 +770,7 @@ class Guild extends Base {
|
|||||||
* @property {Base64Resolvable} [icon] The icon of the guild
|
* @property {Base64Resolvable} [icon] The icon of the guild
|
||||||
* @property {GuildMemberResolvable} [owner] The owner of the guild
|
* @property {GuildMemberResolvable} [owner] The owner of the guild
|
||||||
* @property {Base64Resolvable} [splash] The splash screen of the guild
|
* @property {Base64Resolvable} [splash] The splash screen of the guild
|
||||||
|
* @property {Base64Resolvable} [banner] The banner of the guild
|
||||||
* @property {DefaultMessageNotifications|number} [defaultMessageNotifications] The default message notifications
|
* @property {DefaultMessageNotifications|number} [defaultMessageNotifications] The default message notifications
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -802,6 +803,7 @@ class Guild extends Base {
|
|||||||
if (typeof data.icon !== 'undefined') _data.icon = data.icon;
|
if (typeof data.icon !== 'undefined') _data.icon = data.icon;
|
||||||
if (data.owner) _data.owner_id = this.client.users.resolve(data.owner).id;
|
if (data.owner) _data.owner_id = this.client.users.resolve(data.owner).id;
|
||||||
if (data.splash) _data.splash = data.splash;
|
if (data.splash) _data.splash = data.splash;
|
||||||
|
if (data.banner) _data.banner = data.banner;
|
||||||
if (typeof data.explicitContentFilter !== 'undefined') {
|
if (typeof data.explicitContentFilter !== 'undefined') {
|
||||||
_data.explicit_content_filter = Number(data.explicitContentFilter);
|
_data.explicit_content_filter = Number(data.explicitContentFilter);
|
||||||
}
|
}
|
||||||
@@ -971,6 +973,20 @@ class Guild extends Base {
|
|||||||
return this.edit({ splash: await DataResolver.resolveImage(splash), reason });
|
return this.edit({ splash: await DataResolver.resolveImage(splash), reason });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a new guild banner.
|
||||||
|
* @param {Base64Resolvable|BufferResolvable} banner The new banner of the guild
|
||||||
|
* @param {string} [reason] Reason for changing the guild's banner
|
||||||
|
* @returns {Promise<Guild>}
|
||||||
|
* @example
|
||||||
|
* guild.setBanner('./banner.png')
|
||||||
|
* .then(updated => console.log('Updated the guild banner'))
|
||||||
|
* .catch(console.error);
|
||||||
|
*/
|
||||||
|
async setBanner(banner, reason) {
|
||||||
|
return this.edit({ banner: await DataResolver.resolveImage(banner), reason });
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The data needed for updating a channel's position.
|
* The data needed for updating a channel's position.
|
||||||
* @typedef {Object} ChannelPosition
|
* @typedef {Object} ChannelPosition
|
||||||
|
|||||||
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@@ -493,6 +493,7 @@ declare module 'discord.js' {
|
|||||||
public member(user: UserResolvable): GuildMember | null;
|
public member(user: UserResolvable): GuildMember | null;
|
||||||
public setAFKChannel(afkChannel: ChannelResolvable | null, reason?: string): Promise<Guild>;
|
public setAFKChannel(afkChannel: ChannelResolvable | null, reason?: string): Promise<Guild>;
|
||||||
public setAFKTimeout(afkTimeout: number, reason?: string): Promise<Guild>;
|
public setAFKTimeout(afkTimeout: number, reason?: string): Promise<Guild>;
|
||||||
|
public setBanner(banner: Base64Resolvable | null, reason?: string): Promise<Guild>;
|
||||||
public setChannelPositions(channelPositions: ChannelPosition[]): Promise<Guild>;
|
public setChannelPositions(channelPositions: ChannelPosition[]): Promise<Guild>;
|
||||||
public setDefaultMessageNotifications(defaultMessageNotifications: DefaultMessageNotifications | number, reason?: string): Promise<Guild>;
|
public setDefaultMessageNotifications(defaultMessageNotifications: DefaultMessageNotifications | number, reason?: string): Promise<Guild>;
|
||||||
public setEmbed(embed: GuildEmbedData, reason?: string): Promise<Guild>;
|
public setEmbed(embed: GuildEmbedData, reason?: string): Promise<Guild>;
|
||||||
@@ -1947,6 +1948,7 @@ declare module 'discord.js' {
|
|||||||
icon?: Base64Resolvable;
|
icon?: Base64Resolvable;
|
||||||
owner?: GuildMemberResolvable;
|
owner?: GuildMemberResolvable;
|
||||||
splash?: Base64Resolvable;
|
splash?: Base64Resolvable;
|
||||||
|
banner?: Base64Resolvable;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface GuildEmbedData {
|
interface GuildEmbedData {
|
||||||
|
|||||||
Reference in New Issue
Block a user