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

Option to use new buttons instead of reactions #309

Open
ririko5834 opened this issue Jun 11, 2021 · 76 comments · May be fixed by #482
Open

Option to use new buttons instead of reactions #309

ririko5834 opened this issue Jun 11, 2021 · 76 comments · May be fixed by #482
Labels
enhancement New feature or request

Comments

@ririko5834
Copy link

ririko5834 commented Jun 11, 2021

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
});
@ririko5834 ririko5834 added the enhancement New feature or request label Jun 11, 2021
@Nico105
Copy link
Collaborator

Nico105 commented Jun 11, 2021

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.

@Nico105 Nico105 added invalid This doesn't seem right won't fix This will not be worked on labels Jun 11, 2021
@ririko5834
Copy link
Author

You can save the winners in db, and it should be optional feature (disabled by default). When member clicked on the button and is already in database as parcipator, then it should be removed from database.
And in there can be that the parcipated user count will be displayed on giveaway embed

@reinacchi
Copy link
Contributor

I don't think it'll be a good idea and doesn't seems to work.

@Nico105
Copy link
Collaborator

Nico105 commented Jun 12, 2021

You can save the winners in db, and it should be optional feature (disabled by default). When member clicked on the button and is already in database as parcipator, then it should be removed from database.
And in there can be that the parcipated user count will be displayed on giveaway embed

Theoretically. But the count on the embed could only be updated with the interval because of rate limits, so you cannot know if you successfully participated or not. Also the db would be under heavy load cause we have to save every single participant. That could btw easily cause problems if let us say 20 or more users join in under 5s So it would be not scaleable when there are many gaws. And we also cannot detect people who entered a gaw when the bot is offline.

Ik it would look nice if we coulf use buttons, but they are just not intended for this task.

@ririko5834
Copy link
Author

That's why it should be optional and siabled by default.
And you can reply to the buttons to let the user know about parcipation
using that wrapper:

await button.reply.send('Your entry for this giveaway was successfull!', true); //ephemeral message

This message will be visible just to user, and when user reloads their discord client, then the message will be not there.

@twlite
Copy link

twlite commented Jun 12, 2021

using that wrapper:

await button.reply.send('Your entry for this giveaway was successfull!', true); //ephemeral message

are we talking about 3rd party package here?

@Nico105
Copy link
Collaborator

Nico105 commented Jun 12, 2021

using that wrapper:

await button.reply.send('Your entry for this giveaway was successfull!', true); //ephemeral message

are we talking about 3rd party package here?

yeah, he means discord-buttons, but I would so or so only "consider" buttons when dc.js v13 is officially out.

@Dragonizedpizza
Copy link
Contributor

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.

along with this, the iconic feature of counting giveaway reactions even after the process has been restarted wouldn't exist, since nothing would handle the interaction.

@Assassin-1234
Copy link

Assassin-1234 commented Jun 19, 2021

You can use This package instead to use Buttons with giveaways, visuals would be attached below

dbPdcey4

@Nico105
Copy link
Collaborator

Nico105 commented Jun 19, 2021

I checked the code and it is using an array, like we talked about.
And as said, this may be fine for a low number of giveaways with low participants but it won't scale well at least in my opinion.

@Assassin-1234
Copy link

I checked the code and it is using an array, like we talked about.
And as said, this may be fine for a low number of giveaways with low participants but it won't scale well at least in my opinion.

you can implement a cache system to handle the database stuff. And array getting too long shouldnt be a problem afaik since an array can contain 2^32 elements 🙂

@twlite
Copy link

twlite commented Jun 20, 2021

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

@Lebyy
Copy link
Contributor

Lebyy commented Jun 21, 2021

Exactly if the bot is offline and someone clicks they won't be entered, we need to wait for Discord IF they make something like button click count and data then it would be possible

@AngeloCore
Copy link

You can use the button id, example
When you send the button, the id is like 1, on every click you parse the id using parseInt and add 1

@twlite
Copy link

twlite commented Jun 21, 2021

Ok but the question is, how would you handle that while/when the bot is offline?

@AngeloCore
Copy link

You can't, discord have to think abou that ¯\_(ツ)_/¯

@AngeloCore
Copy link

But if you wanna have big and strong bot, you must have 24/7 strong host

@twlite
Copy link

twlite commented Jun 21, 2021

cough so called strong host can still have outages though.

Anyways, imo reactions are still far better than buttons in case of giveaways but it depends upon you on how you wanna implement it.

@AngeloCore
Copy link

I think the same

@typhoon11
Copy link
Contributor

But if you wanna have big and strong bot, you must have 24/7 strong host

Big bot's doesn't mean they are always offline. Even dyno goes offline for maintenance and stuff, so what will guilds do at that time

@Assassin-1234
Copy link

they still maintain atleast 99% uptime throughout the months

@typhoon11
Copy link
Contributor

they still maintain at least 99% uptime throughout the months

Yeah sure.
image
These are some of the outages that were mentioned in their status and the shard outages are pretty common. I have my bot too that's in 600+ servers that go offline once in 2-3 weeks. So don't say big bots means always online. Btw I use AWS, don't think I am using some cheap or localhost.

@Assassin-1234
Copy link

my bot is in 1.7k servers with 2 shards running on digitalocean linux server which I pay 18$ per month for. Even if shards disconnect it comes back online after a few hours.
image

The discussion we're having is that we need a stable host for it to function properly, The more guilds you have, the less performance you will get

@Lebyy
Copy link
Contributor

Lebyy commented Aug 30, 2021

my bot is in 1.7k servers with 2 shards running on digitalocean linux server which I pay 18$ per month for. Even if shards disconnect it comes back online after a few hours.
image

The discussion we're having is that we need a stable host for it to function properly, The more guilds you have, the less performance you will get

It's not just about the uptime there are other downsides to it as well which Nico105 explained well.

@Nico105
Copy link
Collaborator

Nico105 commented Sep 6, 2021

If discord somehow/somewhen makes additions to the system, then this can get rolled up again.
But currently, I deem it as not made for giveaways, at least when using this package, since buttons would have to many shortcomings for implementing them (within this package).

@Nico105 Nico105 closed this as completed Sep 6, 2021
@Dragonizedpizza
Copy link
Contributor

Dragonizedpizza commented Sep 6, 2021

I have a somewhat acceptable solution. Maybe you can make the functions to await input in the GiveawaysManager, and then let us extend it ourselves. Maybe you could make a Buttons.js in examples?

@Dragonizedpizza
Copy link
Contributor

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
Copy link

NamVr commented Oct 19, 2021

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
Copy link
Contributor

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
Copy link

NamVr commented Oct 19, 2021

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
Copy link
Contributor

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
Copy link

NamVr commented Oct 19, 2021

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 👀

@Dragonizedpizza
Copy link
Contributor

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
Copy link

NamVr commented Oct 20, 2021

Then you should contribute and make a pr.

@Shashank3736
Copy link
Contributor

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
Copy link
Contributor

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

@NamVr
Copy link

NamVr commented Oct 20, 2021

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
Copy link
Author

Yes, you can make PR

@Dragonizedpizza
Copy link
Contributor

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

@Androz2091
Copy link
Owner

Androz2091 commented Oct 22, 2021

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 Nico105 removed invalid This doesn't seem right won't fix This will not be worked on labels Oct 22, 2021
@Nico105
Copy link
Collaborator

Nico105 commented Oct 22, 2021

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
Copy link

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

@Lioness100
Copy link

Has there been any progress on this?

@Shaeikh
Copy link

Shaeikh commented Jun 26, 2022

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
Copy link

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
Copy link
Collaborator

Nico105 commented Aug 24, 2022

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
Copy link

Collaborator

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

@Dragonizedpizza
Copy link
Contributor

🤡

@typhoon11
Copy link
Contributor

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
Copy link

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 Nico105 linked a pull request Oct 4, 2022 that will close this issue
6 tasks
@Nico105
Copy link
Collaborator

Nico105 commented Nov 4, 2022

Feedback on #482 would be appreciated

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

Successfully merging a pull request may close this issue.