Message Collector Error
I'm creating a message collector like this - however after it runs and collects
m.content
and sets it to username
, which I can log into the console just fine - I receive the following error preventing further code run. Also getting a shit ton of type errors.
OG Code
Error
18 Replies
// @ts-ignore
code as actually readable coz gosh those previous lines.
The error is that something is being passed somewhere that is expected to be a string but you're passing undefined.
What that exactly is, is unclear from the given code and error. The error is a shapeshift error so there should be more to it for starters.
Please only contribute actual solutions in the help channels and not hacky workarounds.
last I know is that the collector types are f'd and there is no actual solution other than ignoring the typeerror
they have to be fucked up because im not passing in any weird arguments
im just typing in the expected string message in chat and I can log it just fine
but yeah I'd rather not just ignore it
ah no it seems I undid the ignoring at some point this year so the types are fixed, it's most likely your code at fault
Granted this is Sapphire, I get no type errors here:
And the only "sapphire" part of that is the method being called
messageRun
I have one more question
What's the best way to continue my code after I collect the max filter amount
without needing to continue writing my code inside the .on('end' function or something
like is there a linear way I can continue without nesting code too much
generally I'd say avoid the event based collectors and use the promise based ones
a lot cleaner
Okat let me switch to that
by using
channel.awaitMessages
insteadYeah its so much cleaner
thanks a ton
your're welcome 1000kg
Alternatively you can also use our package which has a MessagePrompter class
@sapphire/discord.js-utilities
Discord.js specific utilities for your JavaScript/TypeScript bots
❯ Author: sapphiredev
❯ Maintainers: favna, kyranet, and vladfrangu
❯ Latest version: 6.0.4
❯ License: MIT
❯ Date Created: <t:1609519287:d>
❯ Date Modified: <t:1679877565:d>
Dependencies:
@sapphire/discord-utilities, @sapphire/duration, @sapphire/utilities, and tslib
I'm more interested in that formatted error
did you do it manually or used some logger lib? 🤔
thats just how
@sapphire/shapeshit
logs its errors i think, so you could find it in the code for thatI see 🤔