Constructor
new Giveaway(manager, options)
Parameters:
Name | Type | Description |
---|---|---|
manager |
GiveawaysManager | The giveaway manager. |
options |
GiveawayData | The giveaway data. |
Members
allowedMentions :Discord.MessageMentionOptions
Which mentions should be parsed from the giveaway messages content.
Type:
- Discord.MessageMentionOptions
bonusEntries :Array.<BonusEntry>
The array of BonusEntry objects for the giveaway.
Type:
- Array.<BonusEntry>
botsCanWin :boolean
If bots can win the giveaway.
Type:
- boolean
channelId :Discord.Snowflake
The Id of the channel of the giveaway.
Type:
- Discord.Snowflake
client :Discord.Client
The Discord client.
Type:
- Discord.Client
data :GiveawayData
The raw giveaway object for this giveaway.
Type:
(readonly) duration :number
The total duration of the giveaway.
Type:
- number
embedColor :Discord.ColorResolvable
The color of the giveaway embed.
Type:
- Discord.ColorResolvable
embedColorEnd :Discord.ColorResolvable
The color of the giveaway embed when it has ended.
Type:
- Discord.ColorResolvable
endAt :number
The end date of the giveaway.
Type:
- number
ended :boolean
Whether the giveaway is ended.
Type:
- boolean
(private, nullable) endTimeout :NodeJS.Timeout
The end timeout for this giveaway
Type:
- NodeJS.Timeout
(nullable) exemptMembersFunction :function
The exemptMembers function of the giveaway.
Type:
- function
exemptPermissions :Array.<Discord.PermissionResolvable>
Members with any of these permissions will not be able to win a giveaway.
Type:
- Array.<Discord.PermissionResolvable>
extraData :any
Extra data concerning this giveaway.
Type:
- any
guildId :Discord.Snowflake
The Id of the guild of the giveaway.
Type:
- Discord.Snowflake
hostedBy :string
The mention of the user who hosts this giveaway.
Type:
- string
image :string
The URL appearing as the image on the giveaway embed.
Type:
- string
isDrop :boolean
If the giveaway is a drop, or not. Drop means that if the amount of valid entrants to the giveaway is the same as "winnerCount" then it immediately ends.
Type:
- boolean
lastChance :LastChanceOptions
The options for the last chance system.
Type:
manager :GiveawaysManager
The giveaway manager.
Type:
(nullable) message :Discord.Message
The message instance of the embed of this giveaway.
Type:
- Discord.Message
messageId :Discord.Snowflake
The Id of the message of the giveaway.
Type:
- Discord.Snowflake
(nullable) messageReaction :Discord.MessageReaction
The reaction on the giveaway message.
Type:
- Discord.MessageReaction
messages :GiveawayMessages
The giveaway messages.
Type:
(readonly) messageURL :string
The link to the giveaway message.
Type:
- string
options :GiveawayData
The giveaway data.
Type:
pauseOptions :PauseOptions
Pause options for this giveaway
Type:
prize :string
The giveaway prize.
Type:
- string
reaction :Discord.EmojiIdentifierResolvable
The emoji used for the reaction on the giveaway message.
Type:
- Discord.EmojiIdentifierResolvable
(readonly) remainingTime :number
The remaining time before the end of the giveaway.
Type:
- number
startAt :number
The start date of the giveaway.
Type:
- number
thumbnail :string
The URL appearing as the thumbnail on the giveaway embed.
Type:
- string
winnerCount :number
The number of winners for this giveaway.
Type:
- number
winnerIds :Array.<string>
The winner Ids for this giveaway after it ended.
Type:
- Array.<string>
Methods
(async) checkBonusEntries(user) → {Promise.<number>}
Checks if a user gets any additional entries for the giveaway.
Parameters:
Name | Type | Description |
---|---|---|
user |
Discord.User | The user to check. |
Returns:
The highest bonus entries the user should get.
- Type: Promise.<number>
(async, private) checkWinnerEntry(user) → {Promise.<boolean>}
Checks if a user fulfills the requirements to win the giveaway.
Parameters:
Name | Type | Description |
---|---|---|
user |
Discord.User | The user to check. |
Returns:
If the entry was valid.
- Type: Promise.<boolean>
edit(options) → {Promise.<Giveaway>}
Edits the giveaway.
Parameters:
Name | Type | Description |
---|---|---|
options |
GiveawayEditOptions | The edit options. |
Returns:
The edited giveaway.
- Type: Promise.<Giveaway>
end(noWinnerMessageopt) → {Promise.<Array.<Discord.GuildMember>>}
Ends the giveaway.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
noWinnerMessage |
string | MessageObject |
<optional> |
null | Sent in the channel if there is no valid winner for the giveaway. |
Returns:
The winner(s).
- Type: Promise.<Array.<Discord.GuildMember>>
(private) ensureEndTimeout() → {NodeJS.Timeout}
Ensure that an end timeout is created for this giveaway, in case it will end soon
Returns:
- Type: NodeJS.Timeout
(async) exemptMembers() → {Promise.<boolean>}
Function to filter members. If true is returned, the member won't be able to win the giveaway.
Properties:
Name | Type | Description |
---|---|---|
member |
Discord.GuildMember | The member to check |
Returns:
Whether the member should get exempted
- Type: Promise.<boolean>
(async) fetchAllEntrants() → {Promise.<Discord.Collection.<Discord.Snowflake, Discord.User>>}
Fetches all users of the giveaway reaction, except bots, if not otherwise specified.
Returns:
The collection of reaction users.
- Type: Promise.<Discord.Collection.<Discord.Snowflake, Discord.User>>
(async) fetchMessage() → {Promise.<Discord.Message>}
Fetches the giveaway message from its channel.
Returns:
The Discord message
- Type: Promise.<Discord.Message>
fillInComponents(components) → (nullable) {Array.<Discord.ActionRowBuilder.<Discord.MessageActionRowComponentBuilder>>}
Parameters:
Name | Type | Description |
---|---|---|
components |
Array.<(Discord.JSONEncodable.<Discord.APIActionRowComponent.<Discord.APIActionRowComponentTypes>>|Discord.APIActionRowComponent.<Discord.APIActionRowComponentTypes>)> | The components that should get filled in. |
Returns:
The filled in components.
- Type: Array.<Discord.ActionRowBuilder.<Discord.MessageActionRowComponentBuilder>>
fillInEmbed(embed) → (nullable) {Discord.EmbedBuilder}
Filles in a embed with giveaway properties.
Parameters:
Name | Type | Description |
---|---|---|
embed |
Discord.JSONEncodable.<Discord.APIEmbed> | Discord.APIEmbed | The embed that should get filled in. |
Returns:
The filled in embed.
- Type: Discord.EmbedBuilder
fillInString(string) → (nullable) {string}
Filles in a string with giveaway properties.
Parameters:
Name | Type | Description |
---|---|---|
string |
string | The string that should get filled in. |
Returns:
The filled in string.
- Type: string
pause(optionsopt) → {Promise.<Giveaway>}
Pauses the giveaway.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
options |
PauseOptions |
<optional> |
giveaway.pauseOptions | The pause options. |
Returns:
The paused giveaway.
- Type: Promise.<Giveaway>
reroll(optionsopt) → {Promise.<Array.<Discord.GuildMember>>}
Rerolls the giveaway.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
GiveawayRerollOptions |
<optional> |
The reroll options. |
Returns:
- Type: Promise.<Array.<Discord.GuildMember>>
(async) roll(winnerCountopt) → {Promise.<Array.<Discord.GuildMember>>}
Gets the giveaway winner(s).
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
winnerCount |
number |
<optional> |
this.winnerCount | The number of winners to pick. |
Returns:
The winner(s).
- Type: Promise.<Array.<Discord.GuildMember>>
unpause() → {Promise.<Giveaway>}
Unpauses the giveaway.
Returns:
The unpaused giveaway.
- Type: Promise.<Giveaway>