From e4450c8417624b71d779cb4f41692538f9165e10 Mon Sep 17 00:00:00 2001 From: sowgro Date: Sat, 2 Sep 2023 19:12:47 -0400 Subject: first commit --- .../discord.js/src/structures/GuildOnboarding.js | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 node_modules/discord.js/src/structures/GuildOnboarding.js (limited to 'node_modules/discord.js/src/structures/GuildOnboarding.js') diff --git a/node_modules/discord.js/src/structures/GuildOnboarding.js b/node_modules/discord.js/src/structures/GuildOnboarding.js new file mode 100644 index 0000000..119f905 --- /dev/null +++ b/node_modules/discord.js/src/structures/GuildOnboarding.js @@ -0,0 +1,58 @@ +'use strict'; + +const { Collection } = require('@discordjs/collection'); +const Base = require('./Base'); +const { GuildOnboardingPrompt } = require('./GuildOnboardingPrompt'); + +/** + * Represents the onboarding data of a guild. + * @extends {Base} + */ +class GuildOnboarding extends Base { + constructor(client, data) { + super(client); + + /** + * The id of the guild this onboarding data is for + * @type {Snowflake} + */ + this.guildId = data.guild_id; + + const guild = this.guild; + + /** + * The prompts shown during onboarding and in customize community + * @type {Collection} + */ + this.prompts = data.prompts.reduce( + (prompts, prompt) => prompts.set(prompt.id, new GuildOnboardingPrompt(client, prompt, this.guildId)), + new Collection(), + ); + + /** + * The ids of the channels that new members get opted into automatically + * @type {Collection} + */ + this.defaultChannels = data.default_channel_ids.reduce( + (channels, channelId) => channels.set(channelId, guild.channels.cache.get(channelId)), + new Collection(), + ); + + /** + * Whether onboarding is enabled + * @type {boolean} + */ + this.enabled = data.enabled; + } + + /** + * The guild this onboarding is from + * @type {Guild} + * @readonly + */ + get guild() { + return this.client.guilds.cache.get(this.guildId); + } +} + +exports.GuildOnboarding = GuildOnboarding; -- cgit v1.2.3