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

✨ Button support #482

Open
wants to merge 30 commits into
base: develop
Choose a base branch
from
Open

Conversation

Nico105
Copy link
Collaborator

@Nico105 Nico105 commented Oct 3, 2022

Changes

Adds an option in the default manager or start() options to provide a join and optionally a leave button. (if only join is provided, it will also act as leave, if clicked twice)

Usage test

client.giveawaysManager.start(giveawayChannel, {
   buttons: {
            join: new Discord.ButtonBuilder()
                .setLabel('Join')
                .setStyle(Discord.ButtonStyle.Primary)
                .setCustomId('join'),
            leave: new Discord.ButtonBuilder() // Optional as mentioned
                .setLabel('Leave')
                .setStyle(Discord.ButtonStyle.Secondary)
                .setCustomId('leave')
        }
}

Questions

What should happen with endedGiveawayReactionAdded ? It was added because some people want to prevent users from joining in case of a reroll. This one would a little bit be the odd one out since it is reaction only, but emitting it for buttons too doesn't really make sense cause of its specific use case.
LMK

If there should be a 3rd option which takes an array for any other buttons that should get added to the message and should get checked/filled in.
Tho I have to say thats not a high priority cause that could get added later anyway.
LMK

The buttons are currently called join and leave.
I leave it up for debate if they should be called differently, like instead of join --> enter or smth.
LMK

I currently just named the button events giveawayJoined and giveawayLeft cause the reaction ones wouldn't really fit.
But so I would like to ask if we should rename the reaction ones to these names too, cause the only event argument difference is messageReaction vs ButtonInteraction, which can be detected easily via if (giveaway.buttons).
What i also leave open is the event names themselves, it doesn't have to be those I used on a whim.
LMK

Important: Currently the interactions are not deferred, so they just fail.
I did this so the dev can decide in the events on what to do.
But lmk if we should do something by default

Stuff to do

  • Proper priority handling of reaction vs button.
    Cause it is possible to provide both as the default manager option and then you could set one or the other as null in the start() options to indicate which default should be used.
    But also atm i left it open what to do when a button is provided but it is invalid. Should it automatically default to the reaction and start or reject, or whatever. Vice versa.
    Note: I left some time pass by, so Im not remembering the current behavior/priority stuff completely = the paragraph above is probably worded wrong/describes it falsly but Im too lazy atm to check it again. Still this has to get properly handled.

    Priority (if I'm not mistaken): start()-reaction > start()-buttons > default-reaction > default-buttons
  • Add proper drop compatibility.
  • Document everything properly.
  • Better README description (I guess).

Status

Tested:

  • Basic functionality
  • Event emitting
  • Detecting button changes and editing them.
  • Drop compatibility.
  • These changes have been tested and formatted properly.
  • This PR introduces some breaking changes.

@Nico105 Nico105 added enhancement New feature or request semver:major labels Oct 3, 2022
src/Giveaway.js Show resolved Hide resolved
@reinacchi
Copy link
Contributor

This looks absolutely amazing. Will definitely test this 👍🏻

src/Giveaway.js Outdated Show resolved Hide resolved
@Nico105 Nico105 linked an issue Oct 4, 2022 that may be closed by this pull request
@Nico105
Copy link
Collaborator Author

Nico105 commented Oct 12, 2022

@Androz2091, could you maybe take a look at the questions stated above

src/Manager.js Outdated Show resolved Hide resolved
Nico105 and others added 2 commits November 5, 2022 14:27
Co-authored-by: Andromeda <46562212+archaeopteryx1@users.noreply.github.com>
@Nitsugua38
Copy link

Hi, is it fully operational now or not yet ?

@SuperDzej
Copy link

SuperDzej commented Feb 6, 2023

Think it should add also others entry as component array, so user can add some info buttons they need like link to some page for giveaways, or similar buttons that they find useful?

@Nico105 Nico105 marked this pull request as ready for review February 23, 2023 22:07
@AmNobCop
Copy link

Is this PR complete?

@1887jonas
Copy link

Nice idea, but if a different database than json file is used to store the giveaways, it doesn't work yet

@Nico105
Copy link
Collaborator Author

Nico105 commented Mar 27, 2023

Nice idea, but if a different database than json file is used to store the giveaways, it doesn't work yet

will be fixed

@Nico105
Copy link
Collaborator Author

Nico105 commented Mar 27, 2023

Is this PR complete?

not yet, last changes have to be made

@AmNobCop
Copy link

Is this PR complete?

not yet, last changes have to be made

Great, thank you for the hard work you are putting into it, will it show the number of entries on the button?

@Nico105
Copy link
Collaborator Author

Nico105 commented Mar 27, 2023

Is this PR complete?

not yet, last changes have to be made

Great, thank you for the hard work you are putting into it, will it show the number of entries on the button?

it will be possible to do that

@AmNobCop
Copy link

AmNobCop commented Apr 3, 2023

Have you finished it yet?

@TejasLamba2006
Copy link

I have made modifications to the discord-giveaways forked by @Nico105 and have been successful in creating my own working button giveaways package. However, I am unsure of the potential effects of merging my changes back into the original package i.e discord-giveaways, so I have decided to create a separate NPM package for my modified version. Is it appropriate for me to do so?

@twlite
Copy link

twlite commented Apr 25, 2023

I have made modifications to the discord-giveaways forked by @Nico105 and have been successful in creating my own working button giveaways package. However, I am unsure of the potential effects of merging my changes back into the original package i.e discord-giveaways, so I have decided to create a separate NPM package for my modified version. Is it appropriate for me to do so?

Yeah it is, but consider giving credits to the original one.

@TejasLamba2006
Copy link

TejasLamba2006 commented Apr 25, 2023

@skdhg, This would be fine I guess
image

Links

@ZynxLuvsYou
Copy link

Is this ready for use yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request semver:major
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option to use new buttons instead of reactions
9 participants