mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +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:
48
src/structures/WelcomeScreen.js
Normal file
48
src/structures/WelcomeScreen.js
Normal file
@@ -0,0 +1,48 @@
|
||||
'use strict';
|
||||
|
||||
const Base = require('./Base');
|
||||
const WelcomeChannel = require('./WelcomeChannel');
|
||||
const Collection = require('../util/Collection');
|
||||
|
||||
/**
|
||||
* Represents a welcome screen.
|
||||
* @extends {Base}
|
||||
*/
|
||||
class WelcomeScreen extends Base {
|
||||
constructor(guild, data) {
|
||||
super(guild.client);
|
||||
|
||||
/**
|
||||
* The guild for this welcome screen
|
||||
* @type {Guild}
|
||||
*/
|
||||
this.guild = guild;
|
||||
|
||||
/**
|
||||
* The description of this welcome screen
|
||||
* @type {?string}
|
||||
*/
|
||||
this.description = data.description ?? null;
|
||||
|
||||
/**
|
||||
* Collection of welcome channels belonging to this welcome screen
|
||||
* @type {Collection<Snowflake, WelcomeChannel>}
|
||||
*/
|
||||
this.welcomeChannels = new Collection();
|
||||
|
||||
for (const channel of data.welcome_channels) {
|
||||
const welcomeChannel = new WelcomeChannel(this.guild, channel);
|
||||
this.welcomeChannels.set(welcomeChannel.channelID, welcomeChannel);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the welcome screen is enabled on the guild or not
|
||||
* @type {boolean}
|
||||
*/
|
||||
get enabled() {
|
||||
return this.guild.features.includes('WELCOME_SCREEN_ENABLED');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = WelcomeScreen;
|
||||
Reference in New Issue
Block a user