From 67c2b459150899d5954daa97aea6ed3b68f20e20 Mon Sep 17 00:00:00 2001 From: Wise <45759535+WiseDevHelper@users.noreply.github.com> Date: Mon, 21 Jun 2021 21:18:31 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20style(*):=20Fix=20JSDoc=20spelling?= =?UTF-8?q?=20errors,=20and=20more.=20(#295)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Nico <63612668+Nico105@users.noreply.github.com> --- README.md | 14 ++--- src/Constants.js | 147 ++++++++++++++++++++++++----------------------- src/Giveaway.js | 98 +++++++++++++++---------------- 3 files changed, 130 insertions(+), 129 deletions(-) diff --git a/README.md b/README.md index 02002708..97845537 100644 --- a/README.md +++ b/README.md @@ -70,11 +70,11 @@ You can pass an options object to customize the giveaways. Here is a list of the - **options.storage**: the json file that will be used to store giveaways. - **options.updateCountdownEvery**: the number of milliseconds it will take to update the timers. - **options.endedGiveawaysLifetime**: duration for which the ended giveaways remain in the database after they are ended. āš  Giveaways deleted from the DB cannot get rerolled anymore! -- **options.hasGuildMembersIntent**: whether the bot has access to the GUILD_MEMBERS intent. It works without, but it will be faster with. -- **options.default.botsCanWin**: whether bots can win a giveaway. +- **options.hasGuildMembersIntent**: if the bot has access to the "GUILD_MEMBERS" intent. It works without, but it will be faster with. +- **options.default.botsCanWin**: if bots can win giveaways. - **options.default.exemptPermissions**: an array of discord permissions. Members who have at least one of these permissions will not be able to win a giveaway even if they react to it. -- **options.default.embedColor**: a hexadecimal color for the embeds of giveaways. -- **options.default.embedColorEnd**: a hexadecimal color for the embeds of giveaways when they are ended. +- **options.default.embedColor**: a hexadecimal color for the embeds of giveaways when they are running. +- **options.default.embedColorEnd**: a hexadecimal color for the embeds of giveaways when they have ended. - **options.default.reaction**: the reaction that users will have to react to in order to participate. - **options.default.lastChance**: the last chance system parameters. [Usage example for the giveaway object](https://github.com/Androz2091/discord-giveaways#last-chance) @@ -109,12 +109,12 @@ client.on('message', (message) => { - **options.thumbnail**: the giveaway thumbnail url. - **options.hostedBy**: the user who hosts the giveaway. - **options.winnerIDs**: the IDs of the giveaway winners. āš  You do not have to and would not even be able to set this as a start option! The array only gets filled when a giveaway ends or is rerolled! -- **options.botsCanWin**: whether bots can win the giveaway. +- **options.botsCanWin**: if bots can win the giveaway. - **options.exemptPermissions**: an array of discord permissions. Server members who have at least one of these permissions will not be able to win a giveaway even if they react to it. - **exemptMembers**: function to filter members. If true is returned, the member won't be able to win the giveaway. [Usage example](https://github.com/Androz2091/discord-giveaways#exempt-members) - **options.bonusEntries**: an array of BonusEntry objects. [Usage example](https://github.com/Androz2091/discord-giveaways#bonus-entries) -- **options.embedColor**: a hexadecimal color for the embeds of giveaways. -- **options.embedColorEnd**: a hexadecimal color the embeds of giveaways when they are ended. +- **options.embedColor**: a hexadecimal color for the embed of the giveaway when it is running. +- **options.embedColorEnd**: a hexadecimal color the embed of the giveaway when is has ended. - **options.reaction**: the reaction that users will have to react to in order to participate. - **options.extraData**: Extra data which you want to save regarding this giveaway. You can access it from the giveaway object using `giveaway.extraData`. - **options.lastChance**: the last chance system parameters. [Usage example](https://github.com/Androz2091/discord-giveaways#last-chance) diff --git a/src/Constants.js b/src/Constants.js index 56b13689..b9f14026 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -1,26 +1,27 @@ const Discord = require('discord.js'); /** - * The Giveaway messages that are used to display the giveaway content + * The Giveaway messages that are used to display the giveaway content. * @typedef GiveawayMessages * * @property {string} [giveaway='@everyone\n\nšŸŽ‰šŸŽ‰ **GIVEAWAY** šŸŽ‰šŸŽ‰'] Displayed above the giveaway embed when the giveaway is running. - * @property {string} [giveawayEnded='@everyone\n\nšŸŽ‰šŸŽ‰ **GIVEAWAY ENDED** šŸŽ‰šŸŽ‰'] Displayed above the giveaway embed when the giveaway is ended. - * @property {string} [inviteToParticipate='React with šŸŽ‰ to participate!'] Displayed in the giveaway embed. Incite people to react to the giveaway. - * @property {string} [timeRemaining='Time remaining: **{duration}**'] Displayed below inviteToParticipate in the giveaway embed. {duration} will be replaced automatically with the time remaining. + * @property {string} [giveawayEnded='@everyone\n\nšŸŽ‰šŸŽ‰ **GIVEAWAY ENDED** šŸŽ‰šŸŽ‰'] Displayed above the giveaway embed when the giveaway has ended. + * @property {string} [inviteToParticipate='React with šŸŽ‰ to participate!'] Displayed in the giveaway embed. Invite people to react to the giveaway. + * @property {string} [timeRemaining='Time remaining: **{duration}**'] Displayed below "inviteToParticipate" in the giveaway embed. "{duration}" will be replaced automatically with the time remaining. * @property {string} [winMessage='Congratulations, {winners}! You won **{prize}**!\n{messageURL}'] Sent in the channel when the giveaway is ended. * @property {string|embedFooterObject} [embedFooter='Powered by the discord-giveaways package'] The footer of the giveaway embed. - * @property {string} [noWinner='Giveaway cancelled, no valid participations.'] Sent in the channel if there's no valid winner for the giveaway. + * @property {string} [noWinner='Giveaway cancelled, no valid participations.'] Sent in the channel if there is no valid winner for the giveaway. * @property {string} [winners='winner(s)'] Displayed next to the embed footer, used to display the number of winners of the giveaways. * @property {string} [endedAt='Ended at'] Displayed next to the embed footer, used to display the giveaway end date. - * @property {string} [hostedBy='Hosted by: {user}'] Below the inviteToParticipate message, in the description of the embed. + * @property {string} [hostedBy='Hosted by: {user}'] Below the "inviteToParticipate" message, in the description of the embed. * @property {Object} [units] - * @property {string} [units.seconds='seconds'] The name of the 'seconds' units - * @property {string} [units.minutes='minutes'] The name of the 'minutes' units - * @property {string} [units.hours='hours'] The name of the 'hours' units - * @property {string} [units.days='days'] The name of the 'days' units - * @property {Boolean} [units.pluralS='false'] Whether to force removing the "S" which marks the plural when the value is lower than 2 + * @property {string} [units.seconds='seconds'] The name of the "seconds" unit. + * @property {string} [units.minutes='minutes'] The name of the "minutes" unit. + * @property {string} [units.hours='hours'] The name of the "hours" unit. + * @property {string} [units.days='days'] The name of the "days" unit. + * @property {Boolean} [units.pluralS='false'] Whether to force the removal of "S" which marks the plural when the value is lower than two. */ + exports.GiveawayMessages = { giveaway: '@everyone\n\nšŸŽ‰šŸŽ‰ **GIVEAWAY** šŸŽ‰šŸŽ‰', giveawayEnded: '@everyone\n\nšŸŽ‰šŸŽ‰ **GIVEAWAY ENDED** šŸŽ‰šŸŽ‰', @@ -50,24 +51,24 @@ exports.GiveawayMessages = { */ /** - * The start options for new giveaways + * The start options for new giveaways. * @typedef GiveawayStartOptions * - * @property {number} time The giveaway duration - * @property {number} winnerCount The number of winners for the giveaway - * @property {string} prize The giveaway prize - * @property {Discord.User} [hostedBy] The user who hosts the giveaway - * @property {Boolean} [botsCanWin] Whether the bots are able to win a giveaway. - * @property {Discord.PermissionResolvable[]} [exemptPermissions] Members with any of these permissions won't be able to win a giveaway. - * @property {Function} [exemptMembers] Function to filter members. If true is returned, the member won't be able to win the giveaway. + * @property {number} time The giveaway duration. + * @property {number} winnerCount The number of winners for the giveaway. + * @property {string} prize The giveaway prize. + * @property {Discord.User} [hostedBy] The user who hosts the giveaway. + * @property {Boolean} [botsCanWin] If bots can win the giveaway. + * @property {Discord.PermissionResolvable[]} [exemptPermissions] Members with any of these permissions will not be able to win a giveaway. + * @property {Function} [exemptMembers] Function to filter members. If true is returned, the member will not be able to win the giveaway. * @property {BonusEntry[]} [bonusEntries] An array of BonusEntry objects. - * @property {Discord.ColorResolvable} [embedColor] The giveaway embeds color when they are running - * @property {Discord.ColorResolvable} [embedColorEnd] The giveaway embeds color when they are ended - * @property {Discord.EmojiIdentifierResolvable} [reaction] The reaction to participate to the giveaways - * @property {GiveawayMessages} [messages] The giveaway messages + * @property {Discord.ColorResolvable} [embedColor] The color of the giveaway embed when it is running. + * @property {Discord.ColorResolvable} [embedColorEnd] The color of the giveaway embed when it has ended. + * @property {Discord.EmojiIdentifierResolvable} [reaction] The reaction to participate in the giveaway. + * @property {GiveawayMessages} [messages] The giveaway messages. * @property {string} [thumbnail] The URL appearing as the thumbnail on the giveaway embed. - * @property {any} [extraData] The extra data value for this giveaway - * @property {LastChanceOptions} [lastChance] The last chance system options + * @property {any} [extraData] The extra data for this giveaway. + * @property {LastChanceOptions} [lastChance] The options for the last chance system. */ exports.GiveawayStartOptions = {}; @@ -76,18 +77,18 @@ exports.GiveawayStartOptions = {}; * @typedef BonusEntry * * @property {Function} bonus The filter function that takes one parameter, a member and returns the amount of entries. - * @property {boolean} [cumulative] Whether the amount of entries from the function can get summed with other amounts of entries. + * @property {boolean} [cumulative] If the amount of entries from the function can get summed with other amounts of entries. */ exports.BonusEntry = {}; /** - * The last chance options + * The last chance options. * @typedef LastChanceOptions * - * @property {boolean} [enabled=false] Whether the last chance system is enabled - * @property {string} [content='āš ļø **LAST CHANCE TO ENTER !** āš ļø'] The text of the embed when last chance is enabled - * @property {number} [threshold=5000] The number of ms after which the last chance system will be enabled - * @property {Discord.ColorResolvable} [embedColor='#FF0000'] The color of the embed when last chance is enabled + * @property {boolean} [enabled=false] If the last chance system is enabled. + * @property {string} [content='āš ļø **LAST CHANCE TO ENTER !** āš ļø'] The text of the embed when the last chance system is enabled. + * @property {number} [threshold=5000] The number of milliseconds before the giveaway ends when the last chance system will be enabled. + * @property {Discord.ColorResolvable} [embedColor='#FF0000'] The color of the embed when last chance is enabled. */ exports.LastChanceOptions = { enabled: false, @@ -97,21 +98,21 @@ exports.LastChanceOptions = { }; /** - * The giveaways manager options + * The giveaways manager options. * @typedef GiveawaysManagerOptions * * @property {string} [storage='./giveaways.json'] The storage path for the giveaways. - * @property {number} [updateCountdownEvery=5000] The giveaway update interval (in ms). - * @property {number} [endedGiveawaysLifetime=null] The time (in ms) after which a ended giveaway should get deleted from the DB. āš  Giveaways deleted from the DB cannot get rerolled anymore! - * @property {boolean} [hasGuildMembersIntent=false] Whether the client instance has access to the GUILD_MEMBERS intent. If set to true, everything will be faster. + * @property {number} [updateCountdownEvery=5000] The giveaway update interval in milliseconds. + * @property {number} [endedGiveawaysLifetime=null] The number of milliseconds after which ended giveaways should get deleted from the DB. āš  Giveaways deleted from the DB cannot get rerolled anymore! + * @property {boolean} [hasGuildMembersIntent=false] If the client instance has access to the "GUILD_MEMBERS" intent. If set to true, certain things will be faster. * @property {Object} [default] The default options for new giveaways. - * @property {Boolean} [default.botsCanWin=false] Whether the bots are able to win a giveaway. + * @property {Boolean} [default.botsCanWin=false] If bots can win giveaways. * @property {Discord.PermissionResolvable[]} [default.exemptPermissions=[]] Members with any of these permissions won't be able to win a giveaway. * @property {Function} [default.exemptMembers] Function to filter members. If true is returned, the member won't be able to win a giveaway. - * @property {Discord.ColorResolvable} [default.embedColor='#FF0000'] The giveaways embed color when they are running - * @property {Discord.ColorResolvable} [default.embedColorEnd='#000000'] The giveaways embed color when they are ended - * @property {Discord.EmojiIdentifierResolvable} [default.reaction='šŸŽ‰'] The reaction to participate in the giveaways - * @property {LastChanceOptions} [default.lastChance] The last chance system parameters + * @property {Discord.ColorResolvable} [default.embedColor='#FF0000'] The color of the giveaway embeds when they are running. + * @property {Discord.ColorResolvable} [default.embedColorEnd='#000000'] The color of the giveaway embeds when they have ended. + * @property {Discord.EmojiIdentifierResolvable} [default.reaction='šŸŽ‰'] The reaction to participate in giveaways. + * @property {LastChanceOptions} [default.lastChance] The options for the last chance system. */ exports.GiveawaysManagerOptions = { storage: './giveaways.json', @@ -135,13 +136,13 @@ exports.GiveawaysManagerOptions = { }; /** - * The reroll method options + * The reroll method options. * @typedef GiveawayRerollOptions * - * @property {number} [winnerCount=this.winnerCount] The number of winners to pick - * @property {Object} [messages] The messages used in this method - * @property {string} [messages.congrat=':tada: New winner(s): {winners}! Congratulations, you won **{prize}**!\n{messageURL}'] The message used if there are winners - * @property {string} [messages.error='No valid participations, no new winner(s) can be chosen!'] The message used if no winner can be choosen + * @property {number} [winnerCount=this.winnerCount] The number of winners to pick. + * @property {Object} [messages] The messages used in this method. + * @property {string} [messages.congrat=':tada: New winner(s): {winners}! Congratulations, you won **{prize}**!\n{messageURL}'] The message used if there are new winners. + * @property {string} [messages.error='No valid participations, no new winner(s) can be chosen!'] The message used if no new winner(s) could be chosen. */ exports.GiveawayRerollOptions = { winnerCount: null, @@ -152,17 +153,17 @@ exports.GiveawayRerollOptions = { }; /** - * The edit method options + * The edit method options. * @typedef GiveawayEditOptions * - * @property {number} [newWinnerCount] The new number of winners - * @property {string} [newPrize] The new giveaway prize - * @property {number} [addTime] Number of milliseconds to add to the giveaway duration - * @property {number} [setEndTimestamp] The timestamp of the new end date - * @property {GiveawayMessages} [newMessages] The new giveaway messages + * @property {number} [newWinnerCount] The new number of winners. + * @property {string} [newPrize] The new giveaway prize. + * @property {number} [addTime] Number of milliseconds to add to the giveaway duration. + * @property {number} [setEndTimestamp] The timestamp of the new end date. + * @property {GiveawayMessages} [newMessages] The new giveaway messages. * @property {string} [newThumbnail] The new thumbnail url. - * @property {any} [newExtraData] The new extra data value for this giveaway - * @property {BonusEntry[]} [newBonusEntries] The new BonusEntry objects + * @property {any} [newExtraData] The new extra data for this giveaway. + * @property {BonusEntry[]} [newBonusEntries] The new BonusEntry objects. */ exports.GiveawayEditOptions = {}; @@ -170,26 +171,26 @@ exports.GiveawayEditOptions = {}; * Raw giveaway object (used to store giveaways in the database). * @typedef GiveawayData * - * @property {number} startAt The start date of the giveaway - * @property {number} endAt The end date of the giveaway - * @property {number} winnerCount The number of winners of the giveaway - * @property {GiveawayMessages} messages The giveaway messages - * @property {string} prize The prize of the giveaway + * @property {number} startAt The start date of the giveaway. + * @property {number} endAt The end date of the giveaway. + * @property {number} winnerCount The number of winners for the giveaway. + * @property {GiveawayMessages} messages The giveaway messages. + * @property {string} prize The giveaway prize. * @property {string} [thumbnail] The URL appearing as the thumbnail on the giveaway embed. - * @property {Discord.Snowflake} channelID The ID of the channel - * @property {Discord.Snowflake} guildID The ID of the guild - * @property {boolean} [ended] Whether the giveaway is ended - * @property {Discord.Snowflake[]} [winnerIDs] The winner IDs of the giveaway after it ended - * @property {Discord.Snowflake} [messageID] The ID of the message - * @property {Discord.EmojiIdentifierResolvable} [reaction] The reaction of the giveaway - * @property {boolean} [botsCanWin] Whether the bots can win the giveaway - * @property {Discord.PermissionResolvable[]} [exemptPermissions] Members with any of these permissions won't be able to win the giveaway - * @property {string} [exemptMembers] Filter function to exempt members from winning the giveaway - * @property {string} [bonusEntries] The array of BonusEntry objects for the giveaway - * @property {Discord.ColorResolvable} [embedColor] The color of the giveaway embed - * @property {Discord.ColorResolvable} [embedColorEnd] The color of the giveaway ended when it's ended - * @property {string} [hostedBy] Mention of user who hosts the giveaway - * @property {any} [extraData] The extra data value for this giveaway - * @property {LastChanceOptions} [lastChance] The last chance system options + * @property {Discord.Snowflake} channelID The ID of the channel. + * @property {Discord.Snowflake} guildID The ID of the guild. + * @property {boolean} [ended] If the giveaway has ended. + * @property {Discord.Snowflake[]} [winnerIDs] The winner IDs of the giveaway after it ended. + * @property {Discord.Snowflake} [messageID] The ID of the message. + * @property {Discord.EmojiIdentifierResolvable} [reaction] The reaction to participate in the giveaway. + * @property {boolean} [botsCanWin] If bots can win the giveaway. + * @property {Discord.PermissionResolvable[]} [exemptPermissions] Members with any of these permissions will not be able to win the giveaway. + * @property {string} [exemptMembers] Filter function to exempt members from winning the giveaway. + * @property {string} [bonusEntries] The array of BonusEntry objects for the giveaway. + * @property {Discord.ColorResolvable} [embedColor] The color of the giveaway embed when it is running. + * @property {Discord.ColorResolvable} [embedColorEnd] The color of the giveaway embed when it has ended. + * @property {string} [hostedBy] The mention of the user who hosts the giveaway. + * @property {any} [extraData] The extra data for this giveaway. + * @property {LastChanceOptions} [lastChance] The options for the last chance system. */ exports.GiveawayData = {}; diff --git a/src/Giveaway.js b/src/Giveaway.js index 024533ad..b1bd9615 100644 --- a/src/Giveaway.js +++ b/src/Giveaway.js @@ -13,77 +13,77 @@ const { const GiveawaysManager = require('./Manager.js'); /** - * Represents a Giveaway + * Represents a Giveaway. */ class Giveaway extends EventEmitter { /** - * @param {GiveawaysManager} manager The Giveaway Manager - * @param {GiveawayData} options The giveaway data + * @param {GiveawaysManager} manager The giveaway manager. + * @param {GiveawayData} options The giveaway data. */ constructor(manager, options) { super(); /** - * The Giveaway manager + * The giveaway manager. * @type {GiveawaysManager} */ this.manager = manager; /** - * The Discord Client + * The Discord client. * @type {Discord.Client} */ this.client = manager.client; /** - * The giveaway prize + * The giveaway prize. * @type {string} */ this.prize = options.prize; /** - * The start date of the giveaway + * The start date of the giveaway. * @type {Number} */ this.startAt = options.startAt; /** - * The end date of the giveaway + * The end date of the giveaway. * @type {Number} */ this.endAt = options.endAt; /** - * Whether the giveaway is ended + * Whether the giveaway is ended. * @type {Boolean} */ this.ended = options.ended || false; /** - * The channel ID of the giveaway + * The ID of the channel of the giveaway. * @type {Discord.Snowflake} */ this.channelID = options.channelID; /** - * The message ID of the giveaway + * The ID of the message of the giveaway. * @type {Discord.Snowflake} */ this.messageID = options.messageID; /** - * The guild ID of the giveaway + * The ID of the guild of the giveaway. * @type {Discord.Snowflake} */ this.guildID = options.guildID; /** - * The number of winners for this giveaway + * The number of winners for this giveaway. * @type {number} */ this.winnerCount = options.winnerCount; /** - * The winner IDs for this giveaway after it ended + * The winner IDs for this giveaway after it ended. * @type {string[]} */ this.winnerIDs = options.winnerIDs || []; /** - * The mention of the user who hosts this giveaway + * The mention of the user who hosts this giveaway. * @type {string} */ this.hostedBy = options.hostedBy; /** - * The giveaway messages + * The giveaway messages. * @type {GiveawayMessages} */ this.messages = options.messages; @@ -93,24 +93,24 @@ class Giveaway extends EventEmitter { */ this.thumbnail = options.thumbnail; /** - * Extra data concerning this giveaway + * Extra data concerning this giveaway. * @type {any} */ this.extraData = options.extraData; /** - * The giveaway data + * The giveaway data. * @type {GiveawayData} */ this.options = options; /** - * The message instance of the embed of this giveaway + * The message instance of the embed of this giveaway. * @type {?Discord.Message} */ this.message = null; } /** - * The link to the giveaway message + * The link to the giveaway message. * @type {string} * @readonly */ @@ -119,7 +119,7 @@ class Giveaway extends EventEmitter { } /** - * The remaining time before the end of the giveaway + * The remaining time before the end of the giveaway. * @type {Number} * @readonly */ @@ -128,7 +128,7 @@ class Giveaway extends EventEmitter { } /** - * The total duration of the giveaway + * The total duration of the giveaway. * @type {Number} * @readonly */ @@ -137,7 +137,7 @@ class Giveaway extends EventEmitter { } /** - * The color of the giveaway embed + * The color of the giveaway embed. * @type {Discord.ColorResolvable} */ get embedColor() { @@ -145,7 +145,7 @@ class Giveaway extends EventEmitter { } /** - * The color of the giveaway embed when it's ended + * The color of the giveaway embed when it has ended. * @type {Discord.ColorResolvable} */ get embedColorEnd() { @@ -153,7 +153,7 @@ class Giveaway extends EventEmitter { } /** - * The reaction on the giveaway message + * The reaction on the giveaway message. * @type {Discord.EmojiIdentifierResolvable} */ get reaction() { @@ -161,7 +161,7 @@ class Giveaway extends EventEmitter { } /** - * Whether the bots are able to win the giveaway + * If bots can win the giveaway. * @type {Boolean} */ get botsCanWin() { @@ -169,7 +169,7 @@ class Giveaway extends EventEmitter { } /** - * Members with any of these permissions won't be able to win a giveaway. + * Members with any of these permissions will not be able to win a giveaway. * @type {Discord.PermissionResolvable[]} */ get exemptPermissions() { @@ -177,7 +177,7 @@ class Giveaway extends EventEmitter { } /** - * Last chance options for this giveaway + * The options for the last chance system. * @type {LastChanceOptions} */ get lastChance() { @@ -185,7 +185,7 @@ class Giveaway extends EventEmitter { } /** - * The bonus entries for this giveaway + * The array of BonusEntry objects for the giveaway. * @type {BonusEntry[]} */ get bonusEntries() { @@ -194,7 +194,7 @@ class Giveaway extends EventEmitter { } /** - * The exemptMembers function of the giveaway + * The exemptMembers function of the giveaway. * @type {Function|null} */ get exemptMembersFunction() { @@ -227,7 +227,7 @@ class Giveaway extends EventEmitter { } /** - * The channel of the giveaway + * The channel of the giveaway. * @type {Discord.TextChannel} * @readonly */ @@ -236,7 +236,7 @@ class Giveaway extends EventEmitter { } /** - * Gets the content of the giveaway + * Gets the content of the giveaway. * @type {string} * @readonly */ @@ -286,7 +286,7 @@ class Giveaway extends EventEmitter { } /** - * The raw giveaway object for this giveaway + * The raw giveaway object for this giveaway. * @type {GiveawayData} */ get data() { @@ -323,7 +323,7 @@ class Giveaway extends EventEmitter { } /** - * Fetches the giveaway message in its channel + * Fetches the giveaway message from its channel. * @returns {Promise} The Discord message */ async fetchMessage() { @@ -341,8 +341,8 @@ class Giveaway extends EventEmitter { } /** - * @param {Discord.User} user The user to check - * @returns {Promise} Whether it is a valid entry + * @param {Discord.User} user The user to check. + * @returns {Promise} If the entry was valid. */ async checkWinnerEntry(user) { if (this.winnerIDs.includes(user.id)) return false; @@ -357,8 +357,8 @@ class Giveaway extends EventEmitter { } /** - * @param {Discord.User} user The user to check - * @returns {Promise} The highest bonus entries the user should get or false + * @param {Discord.User} user The user to check. + * @returns {Promise} The highest bonus entries the user should get or false. */ async checkBonusEntries(user) { const member = this.channel.guild.members.cache.get(user.id); @@ -390,9 +390,9 @@ class Giveaway extends EventEmitter { } /** - * Gets the giveaway winner(s) - * @param {number} [winnerCount=this.winnerCount] The number of winners to pick - * @returns {Promise} The winner(s) + * Gets the giveaway winner(s). + * @param {number} [winnerCount=this.winnerCount] The number of winners to pick. + * @returns {Promise} The winner(s). */ async roll(winnerCount = this.winnerCount) { if (!this.message) return []; @@ -438,7 +438,7 @@ class Giveaway extends EventEmitter { else { /** * Random mechanism like https://github.com/discordjs/collection/blob/master/src/index.ts#L193 - * because collections/maps do not allow dublicates and so we cannot use their built in "random" function + * because collections/maps do not allow duplicates and so we cannot use their built in "random" function */ rolledWinners = Array.from({ length: Math.min(winnerCount, users.size) @@ -466,9 +466,9 @@ class Giveaway extends EventEmitter { } /** - * Edits the giveaway - * @param {GiveawayEditOptions} options The edit options - * @returns {Promise} The edited giveaway + * Edits the giveaway. + * @param {GiveawayEditOptions} options The edit options. + * @returns {Promise} The edited giveaway. */ edit(options = {}) { return new Promise(async (resolve, reject) => { @@ -498,8 +498,8 @@ class Giveaway extends EventEmitter { } /** - * Ends the giveaway - * @returns {Promise} The winner(s) + * Ends the giveaway. + * @returns {Promise} The winner(s). */ end() { return new Promise(async (resolve, reject) => { @@ -552,8 +552,8 @@ class Giveaway extends EventEmitter { } /** - * Rerolls the giveaway - * @param {GiveawayRerollOptions} options + * Rerolls the giveaway. + * @param {GiveawayRerollOptions} The reroll options. * @returns {Promise} */ reroll(options) {