Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adde entriesAmount variable for Giveaway when ended #480

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@
"jsdoc-skyceil": "Androz2091/jsdoc-skyceil",
"typescript": "^4.7.4"
},
"peerDependencies": {
"discord.js": ">=14.0.0"
},
"engines": {
"node": ">=16.9.0"
}
Expand Down
7 changes: 7 additions & 0 deletions src/Giveaway.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ class Giveaway extends EventEmitter {
* @type {?Discord.Message}
*/
this.message = null;
/**
* The Entries amount of how many entered the Giveaway (Amount will be valid, once rolled (ended)!)
* @type {number}
*/
this.finalEntrantAmount = null;
}

/**
Expand Down Expand Up @@ -550,6 +555,8 @@ class Giveaway extends EventEmitter {
const users = await this.fetchAllEntrants().catch(() => {});
if (!users?.size) return [];

this.finalEntrantAmount = users.size;

// Bonus Entries
let userArray;
if (!this.isDrop && this.bonusEntries.length) {
Expand Down
2 changes: 1 addition & 1 deletion src/Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class GiveawaysManager extends EventEmitter {
constructor(client, options, init = true) {
super();
if (!client?.options) throw new Error(`Client is a required option. (val=${client})`);
if (
if (!options?.ignoreMissingIntents &&
!new Discord.IntentsBitField(client.options.intents).has(
Discord.IntentsBitField.Flags.GuildMessageReactions
)
Expand Down
1 change: 1 addition & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export interface PauseOptions {
export interface GiveawaysManagerOptions<ExtraData> {
storage?: string;
forceUpdateEvery?: number;
ignoreMissingIntents?: boolean;
endedGiveawaysLifetime?: number;
default?: {
botsCanWin?: boolean;
Expand Down