Message is not defined!

ok so here it is ReferenceError: message is not defined

8:23 PM

Jump Toat Object. (/app/server.js:30:16)

8:23 PM

at Module._compile (internal/modules/cjs/loader.js:759:30)

8:23 PM

at Object.Module._extensions…js (internal/modules/cjs/loader.js:770:10)

8:23 PM

at Module.load (internal/modules/cjs/loader.js:628:32)

8:23 PM

at Function.Module._load (internal/modules/cjs/loader.js:555:12)

8:23 PM

at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)

8:23 PM

at internal/main/run_main_module.js:17:11

8:23 PM

4 minutes ago

Jump To/app/server.js:30

8:23 PM

var Message = message.toString();

8:23 PM

^

8:23 PM

8:23 PM

ReferenceError: message is not defined

8:23 PM

Jump Toat Object. (/app/server.js:30:16)

8:23 PM

at Module._compile (internal/modules/cjs/loader.js:759:30)

8:23 PM

at Object.Module._extensions…js (internal/modules/cjs/loader.js:770:10)

8:23 PM

at Module.load (internal/modules/cjs/loader.js:628:32)

8:23 PM

at Function.Module._load (internal/modules/cjs/loader.js:555:12)

8:23 PM

at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)

8:23 PM

at internal/main/run_main_module.js:17:11

1 Like

back in the morning in about 19 hours

1 Like

Hi brownhat, welcome!

This error says that in your file, server.js, at line 30, where you have the code:

var Message = message.toString();

…that message doesn’t exist yet.

So please could you post the rest of your server.js file, or at least the bit that matters from the context above?

Cheers!

1 Like

Moving up to related post…

Ok so I’m not at my pc but I remember this it says Message = message.tostring and it says message is undefined and the other error is coinFlip is undefined

I think it’s something about the coinFlip command I’m not at my pc and won’t be for a while but I know that’s the error I thinl

I’m gonna be back later in a few hours like 8 or 7

var Message = Message.toString();
if(Message.startsWith("!")){
var fullCmd = Message.slice(1);
if(fullCmd.startsWith(“flip”)){
coinFlipCommand(Message);
here is the code var is line 30its also says message s undefined and its says could not find coinflip

Hi again, yeah we need the code from before this, where you define Message!

It looks like the casing has changed since your last message, which could be a cause for errors/confusion… is it message or Message?

Drop the whole start of your server.js if you can.

Also, if you put it in triple backticks (```) it will do code formatting like this:

var Message = Message.toString();
if(Message.startsWith("!")){
var fullCmd = Message.slice(1);
if(fullCmd.startsWith(“flip”)){
coinFlipCommand(Message);
here is the code var is line 30its also says message s undefined and its says could not find coinflip

If you posted your entire file that would help a lot. If your bot token is in your file, first off, use .env, but also remove that line as we dont want people randomly logging into your bot.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.