Androz2091 / discord-giveaways

🎉 Complete framework to facilitate the creation of giveaways using discord.js
https://discord-giveaways.js.org
MIT License
335 stars 127 forks source link

Option to use new buttons instead of reactions #309

Open ririko5834 opened 3 years ago

ririko5834 commented 3 years ago

Hi, could you please add option to use Discord buttons instead of reactions?

Info: https://discord.com/developers/docs/interactions/message-components

or can be done using https://www.npmjs.com/package/discord-buttons :

const { MessageButton } = require('discord-buttons');
let button = new MessageButton()
    .setLabel("Parcipate in this giveaway")
    .setStyle("blurple")
    .setEmoji("🎉") // giveaway reaction emoji
    .setID("giveaway_id")

message.channel.send({
    component: button,
    embed: giveawayembed
});
reinacchi commented 3 years ago

I'm thinking probably not, no

Shashank3736 commented 3 years ago

What if the bot is offline? With reactions, we could fetch it any time which would give us back every entries

It is double edge sword. If the bot is offline then it can't check reactions and may be blocked users can join giveaways but in the case of buttons, it is not possible they have to wait for bot to come online.

Having buttons is better as it provides an interactive session which will stop us from sending participants a dm every time they react. Adding userID in the database will not cause any database trouble as it is saved in form of string[] which do not require a large amount of space.

Having buttons like Enter and Leave will allow members to participate or not at the same time will not show the exact amt. of participants. Reactions have a lot of rate limit which is not in buttons. So in my opinion button has its own profit and loss having it as an option do not look like a bad idea to me personally.

NamVr commented 3 years ago

It is double edge sword. If the bot is offline then it can't check reactions and may be blocked users can join giveaways but in the case of buttons, it is not possible they have to wait for bot to come online.

What do you mean by blocked users? You mean requirement giveaways that is done at the end of the giveaway, regardless of bot is offline or online.

Shashank3736 commented 3 years ago

It is double edge sword. If the bot is offline then it can't check reactions and may be blocked users can join giveaways but in the case of buttons, it is not possible they have to wait for bot to come online.

What do you mean by blocked users? You mean requirement giveaways that is done at the end of the giveaway, regardless of bot is offline or online.

For e.g I like to remove their reaction if they do not meet the requirements to participate in the giveaway like Santa Wumpus. And many others are there who like the same thing.

It can be executed by creating a new class GiveawayButtonManager. So all the current giveaway bots can still continue with the reaction thing.

Dragonizedpizza commented 3 years ago

alright @Nico105, I have an idea. Perhaps you can make a specific option to use buttons, but default to reactions, and give a warning in the README about how this won't work when the bot is offline, making it so they're activating it at their own risk.

NamVr commented 3 years ago

It is double edge sword. If the bot is offline then it can't check reactions and may be blocked users can join giveaways but in the case of buttons, it is not possible they have to wait for bot to come online.

What do you mean by blocked users? You mean requirement giveaways that is done at the end of the giveaway, regardless of bot is offline or online.

For e.g I like to remove their reaction if they do not meet the requirements to participate in the giveaway like Santa Wumpus. And many others are there who like the same thing.

Well, actually makes no sense, because exemptMembers exists!

When the giveaway is completed, even if the reactions were collected when the bot was offline, it will not let that invalid entry to win. In buttons this is not the case. On reactions, you are not stopping anyone to participate in the giveaway in case the bot is offline, later handled by bot itself when the giveaway completes. On buttons, you are just stopping everyone to participate in the giveaway when the bot is oflfine, which actually makes no sense.

Shashank3736 commented 3 years ago

It is double edge sword. If the bot is offline then it can't check reactions and may be blocked users can join giveaways but in the case of buttons, it is not possible they have to wait for bot to come online.

What do you mean by blocked users? You mean requirement giveaways that is done at the end of the giveaway, regardless of bot is offline or online.

For e.g I like to remove their reaction if they do not meet the requirements to participate in the giveaway like Santa Wumpus. And many others are there who like the same thing.

Well, actually makes no sense, because exemptMembers exists!

When the giveaway is completed, even if the reactions were collected when the bot was offline, it will not let that invalid entry to win. In buttons this is not the case. On reactions, you are not stopping anyone to participate in the giveaway in case the bot is offline, later handled by bot itself when the giveaway completes. On buttons, you are just stopping everyone to participate in the giveaway when the bot is oflfine, which actually makes no sense.

exemptMembers can filter out participants at the end of the giveaway. That is not something most of the users like. We want the reaction to be removed if requirements do not meet. But even that can be achieved if we add a function to check every giveaway, every reaction after the restart as they met the requirement or not but that may cause rate limits so using Buttons comes in handy here.

As buttons do not allow anyone to participate while the bot is offline so they simply need to wait for the bot. Usually bot goes offline for around 5-10 mins if you use a nice VPS.

NamVr commented 3 years ago

Who is stopping you to use reaction events? lol. What you are saying is impossible for any discord bot on earth. No bot can monitor reactions while being offline.

But even that can be achieved if we add a function to check every giveaway, every reaction after the restart as they met the requirement or not but that may cause rate limits so using Buttons comes in handy here.

Then simply do it? It's better than letting users NOT to participate in the giveaway, just for the sake to validate their entry.

Shashank3736 commented 3 years ago

Who is stopping you to use reaction events? lol. Then simply do it? It's better than letting users NOT to participate in the giveaway, just for the sake to validate their entry.

I guess you got it wrong. I m not complaining about it or saying that buttons are better than reactions. I m just saying that I like buttons more than reactions because of the discord rate limit and interaction feature which allow me to respond even if the bot is not allowed to send messages to that user or in that channel. I said buttons and reaction have their own profit and loss, depending on your requirements you may like buttons more than reaction or vice versa.

For e.g, if someone has a good VPS which improve their bot uptime then buttons are better for them. Some users close their DM so the bot is not able to send messages when they participate but the interaction does not need any of that permission to work.

But if your bot stays offline for a long time then the reaction may be a better option for you considering participation thing. If you apply periodic checks on every participation then removing invalid entries is also not impossible.

What you are saying is impossible for any discord bot on earth. No bot can monitor reactions while being offline. Not on earth, on discord. :p

NamVr commented 3 years ago

Well, I saw Dyno giveaways, clearly not liked by communities I'm in. Still an opinion, but you need to see labels of this issue :eyes:

Dragonizedpizza commented 3 years ago

Well, I saw Dyno giveaways, clearly not liked by communities I'm in. Still an opinion, but you need to see labels of this issue eyes

reactions can still be used by default, buttons could just be optional to use, at your own risk

NamVr commented 3 years ago

Then you should contribute and make a pr.

Shashank3736 commented 3 years ago

Then you should contribute and make a pr.

The issue has won't fix label so most likely they will not accept any PR related to this issue. Otherwise, I planned to implement this by creating a new GiveawayButtonManager which will support buttons only.

Not making any promises

Dragonizedpizza commented 3 years ago

I too wanted to make a pr, but I'm not sure it will be accepted

NamVr commented 3 years ago

You can try always. What you have to do is create an option for user to use buttons or reactions, try to make almost no breaking changes and standard typings etc. I mean, you can try and at least use that for yourself if you need.

ririko5834 commented 3 years ago

Yes, you can make PR

Dragonizedpizza commented 3 years ago

ok, so how should I make it work? should I add only one button, a participate button?

Androz2091 commented 3 years ago

Hello, I'm sorry, I really don't have a lot of time these days. In my opinion, adding buttons would be great. Bots can be online 24/24 7/7 and the fact that some may be unstable should not be a valid reason to discard such improvements. I think that we should however keep the reactions way (it has some advantages like showing to the users the number of participants and let the users enter even if the bot is offline). We would definitely have to refactor the code to keep a good maintainability. It will require some work but that's in my opinion the direction we should follow.

Nico105 commented 3 years ago

ok, so how should I make it work? should I add only one button, a participate button?

i'm no expert, but I guess just make a "button" object option, like lastChance, with label, style, emoji and maybe url property, no?

Positive2022 commented 3 years ago

I guess, we can count number of participants in this way because a button interaction can be edited! image

Lioness100 commented 2 years ago

Has there been any progress on this?

Shaeikh commented 2 years ago

Hello, I'm sorry, I really don't have a lot of time these days. In my opinion, adding buttons would be great. Bots can be online 24/24 7/7 and the fact that some may be unstable should not be a valid reason to discard such improvements. I think that we should however keep the reactions way (it has some advantages like showing to the users the number of participants and let the users enter even if the bot is offline). We would definitely have to refactor the code to keep a good maintainability. It will require some work but that's in my opinion the direction we should follow.

You cant add user counter on button label, and you can store user somewhere maybe but still it wont get user who clicked button when bot was offline

eric48906 commented 2 years ago

Ahem the thing is, buttons do not count users, so we would have no option to roll the giveaway and determine winners. Theoretically we could use a event to manually save the users into an array. But if we would store that in the DB it would be way to big and also "unclicking" a button is not possible / another button would be needed etc. It just does not work out IMO.

What do you mean it doesn't work out?? GiveawayBot is using them and it's working fine for them, and everyone else and, you can add a button to leave a giveaway. Idiot 🤦‍♂️

Nico105 commented 2 years ago

Ahem the thing is, buttons do not count users, so we would have no option to roll the giveaway and determine winners. Theoretically we could use a event to manually save the users into an array. But if we would store that in the DB it would be way to big and also "unclicking" a button is not possible / another button would be needed etc. It just does not work out IMO.

What do you mean it doesn't work out?? GiveawayBot is using them and it's working fine for them, and everyone else and, you can add a button to leave a giveaway. Idiot 🤦‍♂️

First of all, you don't have to insult me. If you would read this whole thread you would understand the difficulties that can arise with buttons and giveaways. And I already changed my line of thought after the constructive conversations/suggestions other people contributed. At that time buttons were new.... I didn't have anything against the idea per se, just its difficulties. The thing with your mentioned bot and such is that they aren't a package which has to make it work for a broader audience. I already mentioned the leave button in my message myself....

But anyway, as mentioned I wrote that over 1 year ago...

You are free to make a pr to add the feature yourself. #391 was already a start but still in v13. Its just a bunch of work.

eric48906 commented 2 years ago

Collaborator

No thanks, I'm not doing your work. 😂

Dragonizedpizza commented 2 years ago

:clown_face:

typhoon11 commented 2 years ago

Collaborator

No thanks, I'm not doing your work. 😂

Nico is not a staff that his job is to add all things, he is also a contributor. Try to be polite towards people who are contributing to maintain this package

eric48906 commented 2 years ago

Collaborator

No thanks, I'm not doing your work. 😂

Nico is not a staff that his job is to add all things, he is also a contributor. Try to be polite towards people who are contributing to maintain this package

Bro shut up 🤡 Your location is literally india 🗑

Nico105 commented 2 years ago

Feedback on #482 would be appreciated