Giveaway interection question

Hello , im new in discordjs, i actually download the foundation of discord bot from github, then on top of it i create my own commands... I am trying to make a giveaway, but interactionCreate doesn't sync the button, therefore currently i put my button interaction into my giveaway.js... Seek for some help on fixing the following: 1. how can i add button into interactionCreate.js? 2. I trying to create multiple giveaway at the same time, but shows up an error like screenshot, and at the end of the giveaway the bot spam winners.
No description
20 Replies
d.js toolkit
d.js toolkit10mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
FG
FG10mo ago
No description
FG
FG10mo ago
I didnt add any database like (MongoDB) for Giveaway
d.js docs
d.js docs10mo ago
guide Message Components: Buttons read more Common causes of DiscordAPIError[10062]: Unknown interaction: - Initial response took more than 3 seconds ➞ defer the response *. - Wrong interaction object inside a collector. - Two processes handling the same command (the first consumes the interaction, so it won't be valid for the other instance) * Note: you cannot defer modal or autocomplete value responses If you are waiting for button or select menu input from a specific message, don't create the collector on the channel. - Channel collectors return component interactions for any component within that channel.
- <Channel>.createMessageComponentCollector(…)
+ <Message>.createMessageComponentCollector(…)
- <Channel>.createMessageComponentCollector(…)
+ <Message>.createMessageComponentCollector(…)
FG
FG10mo ago
okay, let me try How can i add this? its for InteractionCreate.js or giveaway.js? ok let me see I got new update on this
d.js docs
d.js docs10mo ago
To share long code snippets, use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks or files.
FG
FG10mo ago
ok hold on
FG
FG10mo ago
SourceBin
Giveaway.js
Instantly share your code with the world.
SourceBin
InteractionCreate.js
Instantly share your code with the world.
d.js docs
d.js docs10mo ago
Finding your bot token: - Visit the application dashboard and select your application - Navigate to the Bot tab (not General Information, not OAuth2)! - Click Reset Token and copy token | https://i.imgur.com/c12eP0t.png (image) Note: Remember to change the token in your application after you reset it
FG
FG10mo ago
Kind of weird i got this error after put in : [ERROR] SyntaxError: Invalid or unexpected token owh... found it any references I can check on?
d.js docs
d.js docs10mo ago
Message formatting (mentions, timestamps, emoji, etc.): learn moremethod time Formats a date into a short date-time string.
FG
FG10mo ago
So if i wanted to have two embed: 1. Embed - giveaway started = allow all member to react the giveaway button 'join, quit & participants' 2. Embed - giveaway ended = show winner I can use timestamp to count down for it? Oh which means like the bot send two embed instead of replacing it? just do that in the end event of the collector ^ can you explain a little more? Okay.. im not really good at this.. but i try to edit the giveaway once time out
FG
FG10mo ago
This is how it works now : InteractionCreate.js https://sourceb.in/5t6OkOBO0J giveaway.js https://sourceb.in/YaL3AmL2iU
SourceBin
InteractionCreate.js
Instantly share your code with the world.
SourceBin
Giveaway.js
Instantly share your code with the world.
FG
FG10mo ago
Seems like my interaction Failed
No description
FG
FG10mo ago
which means i have to put my intereaction into below collector , not interactionCreate?
FG
FG10mo ago
also i have this 2 error :
No description
FG
FG10mo ago
oh i see... let me try define it direct send out the msg
FG
FG10mo ago
okay.. I have my ended part put into collection end, the question is 1. how can i set time out for collection? seems like i put as
const collector = giveawayMessage.createMessageComponentCollector({ componentType: ComponentType.Button, filter, time: startTime });
const collector = giveawayMessage.createMessageComponentCollector({ componentType: ComponentType.Button, filter, time: startTime });
dosnt have the exact time as startTime (example i put '1' inside command , the startTime should be 60 seconds) and after collection end, the message of giveawayEmbed doesnt edit to giveawayEndEmbed https://sourceb.in/BlIzkxoSCp
SourceBin
giveaway.js
Instantly share your code with the world.
FG
FG10mo ago
Any idea? Hi Qjuh, i have fix the issue now, and it works very well , i am very very very appreciate to have your professional help! ❤️