Cyanic76 / discord-modmail

THIS IS A MIRROR. ISSUES AND PR MUST BE SUBMITTED TO CODEBERG.
https://codeberg.org/Cyanic76/discord-modmail
MIT License
77 stars 48 forks source link

[BUG]: [BUG NAME]TypeError: Cannot read property 'send' of undefined #9

Closed Asperse closed 3 years ago

Asperse commented 3 years ago

I was working with this modmail bot, I added a few things of my own into it actually, and it said "TypeError: Cannot read property 'send' of undefined", so I figured I would just re-set it. But when i reset it, it didn't work and it still threw the same error at me. If you can fix this, I would be very thankful. I've looked at it and I just cant seem to find an issue with it.

Cyanic76 commented 3 years ago

Where was the error you encountered? At which line?

Asperse commented 3 years ago

Where was the error you encountered? At which line?

It didnt specify, lol. It just said:

(node:1125) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined (node:1125) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

I really have no idea what to do

Cyanic76 commented 3 years ago

Can you retry, please?

Asperse commented 3 years ago

Can you retry, please?

What do you mean? Re-try copying the code? sure I can

Asperse commented 3 years ago

Can you retry, please?

I re-copied it and now its telling me /home/runner/Dank-Utils/index.js:202 return client.users.cache.get(support.targetID).("Hi! Your ticket isn't paused anymore. We're ready to continue!"); ^

SyntaxError: Unexpected token '('

Which is weird, because there needs to be a ( right there, lol

Cyanic76 commented 3 years ago

Can you put the 202nd line of your index.js file here?

Asperse commented 3 years ago

Can you put the 202nd line of your index.js file here?

its
return client.users.cache.get(support.targetID).("Hi! Your ticket isn't paused anymore. We're ready to continue!");

Cyanic76 commented 3 years ago

Can you retry with updated code ?

Asperse commented 3 years ago

Can you retry with updated code ?

(node:1646) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined (node:1646) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:1646) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Same thing as before ;-;

Cyanic76 commented 3 years ago

I'll look into this and test things. I'll keep you updated!

Asperse commented 3 years ago

I'll look into this and test things. I'll keep you updated!

Thank you for your help!

Cyanic76 commented 3 years ago

One more question, did the error happened using a command, sending a message to the bot, ...?

Asperse commented 3 years ago

One more question, did the error happened using a command, sending a message to the bot, ...?

Yes, right when I say "hello" or anything to the bot, it just sends that error in terminal.

Cyanic76 commented 3 years ago

Can you try with that?

Asperse commented 3 years ago

Can you try with that?

sure

Asperse commented 3 years ago

Can you try with that?

Oof, still not working. Same issue, i've been trying at this for hours 😂

Asperse commented 3 years ago

Can you try with that?

I'm going to try cloning the repo and seeing if it works on a separate bot.

Asperse commented 3 years ago

Can you try with that?

THIS IS WEIRD! I cloned the repo to a different bot and now it works just fine, I have no idea whats going on!

Cyanic76 commented 3 years ago

One question, have you looked into your config.json file?

Asperse commented 3 years ago

One question, have you looked into your config.json file?

yes, same error no matter what in my bot, maybe I screwed something up in another part of my code thats causing this perhaps?

Asperse commented 3 years ago

One question, have you looked into your config.json file?

Well thanks for your help, sorry if I wasted your time 😅 Its a great bot BTW, thanks for providing it here and being a good help to me.

Cyanic76 commented 3 years ago

Thanks a lot for your feedback, appreciate it!