Skip to content

Commit

Permalink
✨ style(*): Fix JSDoc spelling errors, and more. (#295)
Browse files Browse the repository at this point in the history
Co-authored-by: Nico <63612668+Nico105@users.noreply.github.com>
  • Loading branch information
WiseDevHelper and Nico105 authored Jun 21, 2021
1 parent f1ee342 commit 67c2b45
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 129 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down
147 changes: 74 additions & 73 deletions src/Constants.js
Original file line number Diff line number Diff line change
@@ -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** 🎉🎉',
Expand Down Expand Up @@ -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 = {};

Expand All @@ -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,
Expand All @@ -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',
Expand All @@ -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,
Expand All @@ -152,44 +153,44 @@ 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 = {};

/**
* 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 = {};
Loading

0 comments on commit 67c2b45

Please sign in to comment.