Open ririko5834 opened 3 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.
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
I don't think it'll be a good idea and doesn't seems to work.
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.
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.
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?
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.
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.
You can use This package instead to use Buttons with giveaways, visuals would be attached below
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.
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 🙂
What if the bot is offline? With reactions, we could fetch it any time which would give us back every entries
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
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
Ok but the question is, how would you handle that while/when the bot is offline?
You can't, discord have to think abou that ¯\_(ツ)_/¯
But if you wanna have big and strong bot, you must have 24/7 strong host
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.
I think the same
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
they still maintain atleast 99% uptime throughout the months
they still maintain at least 99% uptime throughout the months
Yeah sure. 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.
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.
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
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.
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.
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).
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?
I can make a PR if you wish?
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?
But then again rises a question what if the bot is offline?
not discord-giveaways's problem, since you yourself decided to use buttons, and extended the class for it.
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?
correct me if I'm wrong, but wouldn't you have to add the button to every message.edit() too? = we "would have to" make small extendable functions for quite a few things. + probably expose the giveaway class to be extended But then we could also just support it in house and don't to such half backed stuff. // which probably won't happen for mentioned reasons
that solution doesn't seem really good to me. Since we basically would have to write code for it, even though we say we don't support it.
and I guess if you really burn for buttons/want them, then it would make sense to just fork the package and support it for yourself, I guess. So you take the risks yourself. IMO
What will happen when bot was restartning when there is giveaway with buttons? You can make that button custom ID will be giveaway message ID and that users who reacted will be saved to database (in array) be their Discord IDs. When user that has already parcipated giveaway clicks on the button, remove it from database and reply that entry was removed. (replies should be customisable)
I don't know why we're still discussing this but I assumed there are few disadvantages within buttons that we might not notice for now. IMO we shouldn't be implementing this at all since it just won't work out all at some points.
As Nico said a forked of this project would be suitable to implement buttons if you want to support them instead of reactions.
What will happen when bot was restartning when there is giveaway with buttons? You can make that button custom ID will be giveaway message ID and that users who reacted will be saved to database (in array) be their Discord IDs. When user that has already parcipated giveaway clicks on the button, remove it from database and reply that entry was removed. (replies should be customisable)
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?
correct me if I'm wrong, but wouldn't you have to add the button to every message.edit() too? = we "would have to" make small extendable functions for quite a few things. + probably expose the giveaway class to be extended But then we could also just support it in house and don't to such half backed stuff. // which probably won't happen for mentioned reasons
that solution doesn't seem really good to me. Since we basically would have to write code for it, even though we say we don't support it.
and I guess if you really burn for buttons/want them, then it would make sense to just fork the package and support it for yourself, I guess. So you take the risks yourself. IMO
you would, but this would allow for anything to be used as an entry system, even messages in a channel
the editing function can be inside a method in the GiveawaysManager
actually, I just ran this
const { Client, MessageActionRow, MessageButton } = require("discord.js"),
client = new Client({ intents: 513 });
client.on("ready", async () => {
console.log("ready!");
const message = await (await client.channels.fetch("766190389362819072")).send({
content: "hi",
components: [
new MessageActionRow().addComponents(
new MessageButton().setStyle("SUCCESS").setCustomId("yeet").setLabel("yeet")
),
],
});
message.edit("bye");
});
client.login(require("./config.json").token);
and got this as output
I don't think components are affected unless you edit them
plus, what's wrong with exposing the giveaway class?
plus, what's wrong with exposing the giveaway class?
nothing per se, (but people might break things then) but structuring/moving things for something which isn't really beneficial/"made" (as it is now) for the package, doesn't seem right/needed to me.
I don't think components are affected unless you edit them
When you dont specify compoenents in the message object, its not edited. If you add compoments: []
to the message object, they are removed from the message
plus, what's wrong with exposing the giveaway class?
nothing per se, (but people might break things then) but structuring/moving things for something which isn't really beneficial/"made" (as it is now) for the package, doesn't seem right/needed to me.
there's absolutely no reason why it would break tho, since you need to destructure it either way, you're just adding one more key to the object, plus, it would be very beneficial since it adds many more options for customization.
anyway, here's what I think you could do:
Maybe consider making a discussion topic about this instead of talking here?
@Androz2091 please share your opinions
@Nico105 since this is a valid issue, can this be re-opened?
till we have androz's final word, okay...
Maybe consider making a discussion topic about this instead of talking here?
What about this? We can ask Androz to enable discussion and open one for this case.
uh
@Androz2091
So is this going to be added or not?
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 :