diff options
author | sowgro <tpoke.ferrari@gmail.com> | 2023-09-02 19:12:47 -0400 |
---|---|---|
committer | sowgro <tpoke.ferrari@gmail.com> | 2023-09-02 19:12:47 -0400 |
commit | e4450c8417624b71d779cb4f41692538f9165e10 (patch) | |
tree | b70826542223ecdf8a7a259f61b0a1abb8a217d8 /node_modules/discord.js/src/structures/GuildOnboardingPromptOption.js | |
download | sowbot3-e4450c8417624b71d779cb4f41692538f9165e10.tar.gz sowbot3-e4450c8417624b71d779cb4f41692538f9165e10.tar.bz2 sowbot3-e4450c8417624b71d779cb4f41692538f9165e10.zip |
first commit
Diffstat (limited to 'node_modules/discord.js/src/structures/GuildOnboardingPromptOption.js')
-rw-r--r-- | node_modules/discord.js/src/structures/GuildOnboardingPromptOption.js | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/node_modules/discord.js/src/structures/GuildOnboardingPromptOption.js b/node_modules/discord.js/src/structures/GuildOnboardingPromptOption.js new file mode 100644 index 0000000..3002144 --- /dev/null +++ b/node_modules/discord.js/src/structures/GuildOnboardingPromptOption.js @@ -0,0 +1,84 @@ +'use strict'; + +const { Collection } = require('@discordjs/collection'); +const Base = require('./Base'); +const { resolvePartialEmoji } = require('../util/Util'); + +/** + * Represents the data of an option from a prompt of a guilds onboarding. + * @extends {Base} + */ +class GuildOnboardingPromptOption extends Base { + constructor(client, data, guildId) { + super(client); + + /** + * The id of the guild this onboarding prompt option is from + * @type {Snowflake} + */ + this.guildId = guildId; + + const guild = this.guild; + + /** + * The id of the option + * @type {Snowflake} + */ + this.id = data.id; + + /** + * The channels a member is added to when the option is selected + * @type {Collection<Snowflake, GuildChannel>} + */ + this.channels = data.channel_ids.reduce( + (channels, channelId) => channels.set(channelId, guild.channels.cache.get(channelId)), + new Collection(), + ); + + /** + * The roles assigned to a member when the option is selected + * @type {Collection<Snowflake, Role>} + */ + this.roles = data.role_ids.reduce( + (roles, roleId) => roles.set(roleId, guild.roles.cache.get(roleId)), + new Collection(), + ); + + /** + * The data for an emoji of a guilds onboarding prompt option + * @typedef {Object} GuildOnboardingPromptOptionEmoji + * @property {?Snowflake} id The id of the emoji + * @property {string} name The name of the emoji + * @property {boolean} animated Whether the emoji is animated + */ + + /** + * The emoji of the option + * @type {?GuildOnboardingPromptOptionEmoji} + */ + this.emoji = resolvePartialEmoji(data.emoji); + + /** + * The title of the option + * @type {string} + */ + this.title = data.title; + + /** + * The description of the option + * @type {?string} + */ + this.description = data.description; + } + + /** + * The guild this onboarding prompt option is from + * @type {Guild} + * @readonly + */ + get guild() { + return this.client.guilds.cache.get(this.guildId); + } +} + +exports.GuildOnboardingPromptOption = GuildOnboardingPromptOption; |