#When doing the command twice and answering one of the questions, it sends the msg twice

1 messages · Page 1 of 1 (latest)

lyric rover
oak steppe
#

lemme see ur code rq

quaint cradle
#

u don't using a filter

lyric rover
#

im tryna make it be like this

lyric rover
vast ridge
#

it's because you are using the collector in the channel, not the channel. try the check the message.id in the filter?

lyric rover
vast ridge
#

give me a second to think about it

lyric rover
vast ridge
#
let filter = m => m.id === message.id```message being the message your bot is sending
vast ridge
vast ridge
#

so what you can do is only check what quesiton is this message answering

#

wait i'm confuse now

lyric rover
#

same

vast ridge
#

okay i have an idea

lyric rover
#

this problem is so confusing

vast ridge
#

yeah the problem is that questions are overlapping each other in the channel...

#

so i mean an easy way to fix this is to only allow 1 question per channel

lyric rover
vast ridge
#

or you can make that if there is multiple questions in a channel, you have to answer using the reply thing

lyric rover
#

hmm

lyric rover
vast ridge
#

so that your bot knows which question the user is answering

#

i guess they ignore the answer if it's not the correct one

lyric rover
vast ridge
#

oh i know why

#

because you are checking if it's the correct answer in the filter

#

i think you should check if the message content is the answer or not in the collector, so you should use the collector.on thing instead of awaitMessage I guess?

#

I don't know if it's the best way to do what you want to do, but if i was my code i would do that 🤔

lyric rover
vast ridge
#

idk test it

lyric rover
# lyric rover

i also realised i can only answer the newer question not the first question

#

so the new collector overwrites the old one

#

i think

spiral garden
#

show your code

smoky salmon
#

Hi, not sure if I'm just blind or if you don't initiate quiz (at least not inside the function)

#

quiz = questions[Math.floor(Math.random() * questions.length)]

#

It might overwrite quiz everytime you call the function

lyric rover
#

hmm

smoky salmon
#

A simple const quiz = ... should work

lyric rover
#

oh how did i forget to add that lol

#

i did too much python

lyric rover
#

THANK YOU SO MUCH

smoky salmon
#

Lol you're welcome

lyric rover
#

the most smallest mistake was the reason of this whole thing