#Collector not working
1 messages · Page 1 of 1 (latest)
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()
can I see ur client intents
but it does send "Looks like you did not send the image in time."
ok can you log the error?
.catch(err?
.catch((collected) => {
interaction.followUp(
"Looks like you did not send the image in time."
);
console.log(collected)
})
it's a catch
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
where is the filter?
Removed it
add it back...
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
can you send full code in sourcebin? And full error
is that line 24?
yep
you gotta add the filter
is it ncessery
yes
const filter = (m) => m.attachments.size>0
do it
how are you putting the collector?
TypeError: Cannot read property 'attachments' of undefined
at /Users/navdeepsharma/Documents/GitHub/Hackathon/src/PGamerX/commands/slash/colorize.js:25:42
I sent the code
not the new one...
I just added filter, time:time and stuff
wait that's await messages
but there is no collect event... you mean resolve?
hmm
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
what does m log?
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)
do you have partials?
which
show me the partials
you have none?
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
?
its the collected.first() that is nothing
because if I log (it works?) in .on collect
it logs tht
can you log collected in the .then()
there are 3 of em
:O
Collection(0) [Map] {}
are all the .then()s shown?
Did you modify the code you put in sourcebin?
nope
there is only one .then, others are catch
^
Also, I have to go now, Please leave your thoughts here I will see the messages tomorrow.
Good Night!
ok
It's almost noon for me lol
lol
I will try collector one time
before I go
@uncut ether https://sourceb.in/KPFqTaEnSe this doesnt work at all
doesnt even log "it works?"
the collector method
is your bot verified or smth
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
does client.on("messageCreate", console.log) log anything? @fickle delta
lol
lemme see
it doesnt
messages not being detected...