Skip to content

Commit

Permalink
✨ make NEVER text customizable | pauseOptions.infiniteDurationText (#…
Browse files Browse the repository at this point in the history
…367)

Co-authored-by: Nico105 <63612668+Nico105@users.noreply.github.com>
  • Loading branch information
Demir and Nico105 authored Oct 15, 2021
1 parent 82fcf30 commit 427d1cd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ client.giveawaysManager.start(interaction.channel, {
^^^ You can [access giveaway properties](https://github.com/Androz2091/discord-giveaways#access-giveaway-properties-in-messages).
- **pauseOptions.unPauseAfter**: the number of milliseconds after which the giveaway will automatically unpause.
- **pauseOptions.embedColor**: the color of the embed when the giveaway is paused.
- **pauseOptions.infiniteDurationText**: The text that gets displayed next to "GiveawayMessages#drawing" in the paused embed, when there is no "unPauseAfter".
^^^ You can [access giveaway properties](https://github.com/Androz2091/discord-giveaways#access-giveaway-properties-in-messages).

<a href="https://zupimages.net/viewer.php?id=21/24/dxhk.png">
<img src="https://zupimages.net/up/21/24/dxhk.png"/>
Expand Down
4 changes: 3 additions & 1 deletion src/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,15 @@ exports.LastChanceOptions = {
* @property {number} [unPauseAfter=null] The number of milliseconds after which the giveaway will automatically unpause.
* @property {Discord.EmbedColorResolveAble} [embedColor='#FFFF00'] The color of the embed when the giveaway is paused.
* @property {number} [durationAfterPause=null|giveaway.remainingTime] The remaining duration after the giveaway is unpaused. ⚠ This property gets set by the manager so that the pause system works properly. It is not recommended to set it manually!
* @property {string} [infiniteDurationText='`NEVER`'] The text that gets displayed next to "GiveawayMessages#drawing" in the paused embed, when there is no "unPauseAfter".
*/
exports.PauseOptions = {
isPaused: false,
content: '⚠️ **THIS GIVEAWAY IS PAUSED !** ⚠️',
unPauseAfter: null,
embedColor: '#FFFF00',
durationAfterPause: null
durationAfterPause: null,
infiniteDurationText: '`NEVER`'
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class GiveawaysManager extends EventEmitter {
'\n' +
giveaway.messages.drawing.replace(
'{timestamp}',
giveaway.endAt === Infinity ? '`NEVER`' : `<t:${Math.round(giveaway.endAt / 1000)}:R>`
giveaway.endAt === Infinity ? giveaway.pauseOptions.infiniteDurationText : `<t:${Math.round(giveaway.endAt / 1000)}:R>`
)
) +
(giveaway.hostedBy ? '\n' + giveaway.messages.hostedBy : '')
Expand Down
1 change: 1 addition & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ declare module 'discord-giveaways' {
unPauseAfter: number;
embedColor: ColorResolvable;
durationAfterPause: number;
infiniteDurationText: string;
}
interface GiveawaysManagerOptions {
storage?: string;
Expand Down

0 comments on commit 427d1cd

Please sign in to comment.