#Collector not working

1 messages · Page 1 of 1 (latest)

uncut ether
#

@fickle delta

fickle delta
#

finally

#

new thread

#

ok

#

so I am going to send you my awaitMessage code and then collector

#
async execute(interaction) {
    await interaction
      .editReply({
        content:
          "Kindly send a black and white image in this channel within 15 seconds.",
      })
      .then(() => {
        interaction.channel
          .awaitMessages({ max: 1, time: 15000, errors: ["time"] })
          .then(async (collected) => {
console.log(collected.first())
}
          .catch((collected) => {
            interaction.followUp(
              "Looks like you did not send the image in time."
            );
          });
#

this is just for checking if it works

#

it does not work as it doesn't log the collected.first()

uncut ether
fickle delta
#

but it does send "Looks like you did not send the image in time."

fickle delta
uncut ether
#

ok can you log the error?

fickle delta
#

.catch(err?

uncut ether
#
.catch((collected) => {
            interaction.followUp(
              "Looks like you did not send the image in time."
            );
             console.log(collected)
          })
fickle delta
#

that is the timeout

#

15000 ms timeout

uncut ether
fickle delta
#

ok so it sends nothing

#
TypeError: Cannot read property 'attachments' of undefined
    at /Users/navdeepsharma/Documents/GitHub/Hackathon/src/PGamerX/commands/slash/colorize.js:24:42
#

UNDEFINED

fickle delta
#

Removed it

uncut ether
fickle delta
#

wait

#
            const m = collected.first();
            console.log(m)
            const attachment_url = [...m.attachments.values()][0].url;
#

this is where I think I get the error

#

yeah I get here only

uncut ether
#

can you send full code in sourcebin? And full error

fickle delta
#

this is the full error

#

and code sure

uncut ether
#

is that line 24?

fickle delta
fickle delta
uncut ether
fickle delta
#

is it ncessery

uncut ether
fickle delta
#
    const filter = (m) => m.attachments.size>0
fickle delta
#

ight

#

not working

#

problem is that it is not working

#

the .on(collect)

#

part

uncut ether
#

how are you putting the collector?

fickle delta
#
TypeError: Cannot read property 'attachments' of undefined
    at /Users/navdeepsharma/Documents/GitHub/Hackathon/src/PGamerX/commands/slash/colorize.js:25:42
fickle delta
uncut ether
fickle delta
#

I just added filter, time:time and stuff

uncut ether
fickle delta
#

yea

#

I told you that I gave up on collector

#

and choose await message

uncut ether
#

but there is no collect event... you mean resolve?

fickle delta
#

yea

#

.then(async (collected))

uncut ether
#

hmm

fickle delta
#

I still get the same error

#
undefined
TypeError: Cannot read property 'attachments' of undefined
    at /Users/navdeepsharma/Documents/GitHub/Hackathon/src/PGamerX/commands/slash/colorize.js:25:42
#
         .then(async (collected) => {
            const m = collected.first();
            console.log(m)
            const attachment_url = [...m.attachments.values()][0].url;
#

undefined is m

#

and the line 25 is attachment_url

uncut ether
fickle delta
#

undefined

#

or maybe thats the catch part

#

I log collected in catch part

#

that might be undefined

#

and the next error might be in .catch (err)

uncut ether
#

do you have partials?

fickle delta
#

which

uncut ether
fickle delta
#

HOLY SHIT

#

I DONT

#

but it still wont work

#

so yeah

uncut ether
fickle delta
#

let client = new Client({
  intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
  partials: ['MESSAGE', 'CHANNEL', 'REACTION']
});
#

I added partials

#

tried again

#

still same thing

#

ok so

#

@uncut ether

#

I figured the porblem

uncut ether
#

?

fickle delta
#

its the collected.first() that is nothing

#

because if I log (it works?) in .on collect

#

it logs tht

uncut ether
#

can you log collected in the .then()

fickle delta
#

there are 3 of em

uncut ether
#

:O

fickle delta
#

okk

#

one minute

fickle delta
uncut ether
#

Did you modify the code you put in sourcebin?

fickle delta
#

nope

fickle delta
fickle delta
#

Also, I have to go now, Please leave your thoughts here I will see the messages tomorrow.
Good Night!

uncut ether
fickle delta
#

lol

#

I will try collector one time

#

before I go

#

doesnt even log "it works?"

#

the collector method

uncut ether
fickle delta
#

no its only in one server

#

i.e mine

#

it had admin perms

#

message intent enabled

#

and slash cmd perm

#

I actually have the best Idea

#

I will just ask the user for image URL

uncut ether
#

does client.on("messageCreate", console.log) log anything? @fickle delta

fickle delta
#

lol

uncut ether