mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
feat(WelcomeScreen): welcome screens (#5490)
Co-authored-by: Jan <66554238+vaporox@users.noreply.github.com> Co-authored-by: izexi <43889168+izexi@users.noreply.github.com> Co-authored-by: SpaceEEC <spaceeec@yahoo.com> Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
This commit is contained in:
60
src/structures/WelcomeChannel.js
Normal file
60
src/structures/WelcomeChannel.js
Normal file
@@ -0,0 +1,60 @@
|
||||
'use strict';
|
||||
|
||||
const Base = require('./Base');
|
||||
const Emoji = require('./Emoji');
|
||||
|
||||
/**
|
||||
* Represents a channel link in a guild's welcome screen.
|
||||
* @extends {Base}
|
||||
*/
|
||||
class WelcomeChannel extends Base {
|
||||
constructor(guild, data) {
|
||||
super(guild.client);
|
||||
|
||||
/**
|
||||
* The guild for this welcome channel
|
||||
* @type {Guild|WelcomeGuild}
|
||||
*/
|
||||
this.guild = guild;
|
||||
|
||||
/**
|
||||
* The description of this welcome channel
|
||||
* @type {string}
|
||||
*/
|
||||
this.description = data.description;
|
||||
|
||||
/**
|
||||
* The raw emoji data
|
||||
* @type {Object}
|
||||
* @private
|
||||
*/
|
||||
this._emoji = {
|
||||
name: data.emoji_name,
|
||||
id: data.emoji_id,
|
||||
};
|
||||
|
||||
/**
|
||||
* The id of this welcome channel
|
||||
* @type {Snowflake}
|
||||
*/
|
||||
this.channelID = data.channel_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* The channel of this welcome channel
|
||||
* @type {?TextChannel|NewsChannel}
|
||||
*/
|
||||
get channel() {
|
||||
return this.client.channels.resolve(this.channelID);
|
||||
}
|
||||
|
||||
/**
|
||||
* The emoji of this welcome channel
|
||||
* @type {GuildEmoji|Emoji}
|
||||
*/
|
||||
get emoji() {
|
||||
return this.client.emojis.resolve(this._emoji.id) ?? new Emoji(this.client, this._emoji);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = WelcomeChannel;
|
||||
Reference in New Issue
Block a user