MSFTserver / TipBot

Crypto coin TipBot for discord
MIT License
40 stars 117 forks source link

Unexpected token function #22

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hello

First of all thank you for this bot! But I'm getting an error I'm not able to fix. The bot comes online, I can run the command ".tiphelp" but nothings else works. When I go in to the log file I'm getting this error:

0|TipBot | Improper setup of the 'aexTipper.js' plugin. : SyntaxError: Unexpected token function

This is where it throws the error:

image

any idea where I should look at?

Greetings

MSFTserver commented 5 years ago

that's the error handler, look farther up in the error output call tree for the line of code that is throwing the error in your aexTipper.js file

ghost commented 5 years ago

Can't find it, the aexTipper.js is the exampleTipper.js with a different name and different coinname.

ghost commented 5 years ago

In TipBot/bot/modules you have examples of FTC, UFO, RVN. But how does the bot know which plugin it has to use? Where should you define this? Because I can't find this.

MSFTserver commented 5 years ago

https://github.com/MSFTserver/TipBot/blob/3910e52c9234d944bffbb8cb9be97d1840091feb/bot/modules/exampleTipper.js#L24

MSFTserver commented 5 years ago

without seeing your aexTipper.js I can't help much, certain the error is in there somewhere

ghost commented 5 years ago

aexTipper.txt

MSFTserver commented 5 years ago

do you possibly have the full error output it was showing

ghost commented 5 years ago

Loaded 2 chat commands and 0 custom functions. [05-02-2019 05:45 pm PST][tipaex] type .tiphelp in Discord for a commands list. [05-02-2019 05:46 pm PST][tipaex] 3 aliases Loaded! [05-02-2019 05:46 pm PST][tipaex] AEX TipBot Logged in! Serving in 1 servers Improper setup of the 'aexTipper.js' plugin. : SyntaxError: Unexpected token function Loaded 2 chat commands and 0 custom functions. [05-02-2019 05:46 pm PST][tipaex] type .tiphelp in Discord for a commands list.

ghost commented 5 years ago

It doesn't give a lot of information.

MSFTserver commented 5 years ago

did you check both log files to see if the error got shoved in there depending on how your looking at the log, pm2 log doesnt output it but puts it in a log file

MSFTserver commented 5 years ago

regardless ill fire up your script in a little and see what causing the issue

ghost commented 5 years ago

I looked at the log files with the tail & nano command.

There are two log files.

Tipbot-err.log gives:

WARNING: NODE_APP_INSTANCE value of '0' did not match any instance config file names. WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode

tipbout-out.log gives:

[05-02-2019 12:01 am PST][TipBot] 3 aliases Loaded! [05-02-2019 12:01 am PST][TipBot] AEX TipBot Logged in! Serving in 1 servers Improper setup of the 'aexTipper.js' plugin. : SyntaxError: Unexpected token function Loaded 2 chat commands and 0 custom functions. [05-02-2019 12:01 am PST][TipBot] type !tiphelp in Discord for a commands list. treating !tiphelp from turtlepleb as command [05-02-2019 12:16 am PST][AEXBOT] 3 aliases Loaded! [05-02-2019 12:16 am PST][AEXBOT] AEX TipBot Logged in! Serving in 1 servers Improper setup of the 'aexTipper.js' plugin. : SyntaxError: Unexpected token function Loaded 2 chat commands and 0 custom functions. [05-02-2019 12:16 am PST][AEXBOT] type .tiphelp in Discord for a commands list. treating .tiphelp from turtlepleb as command treating .tiphelp from turtlepleb as command [05-02-2019 12:29 am PST][tipaex] 3 aliases Loaded! [05-02-2019 12:29 am PST][tipaex] AEX TipBot Logged in! Serving in 1 servers Improper setup of the 'aexTipper.js' plugin. : SyntaxError: Unexpected token function Loaded 2 chat commands and 0 custom functions. [05-02-2019 12:29 am PST][tipaex] type .tiphelp in Discord for a commands list. treating .tiphelp from turtlepleb as command [05-02-2019 12:42 am PST][tipaex] 3 aliases Loaded! [05-02-2019 12:42 am PST][tipaex] AEX TipBot Logged in! Serving in 1 servers Improper setup of the 'aexTipper.js' plugin. : SyntaxError: Unexpected token function Loaded 2 chat commands and 0 custom functions. [05-02-2019 12:42 am PST][tipaex] type .tiphelp in Discord for a commands list. treating .tiphelp from turtlepleb as command [05-02-2019 05:45 pm PST][tipaex] 3 aliases Loaded!

MSFTserver commented 5 years ago

first one is normal some issue with clashing with nodes config really not an issue though, but dang yea no helpful output ill look into that in little bit here

ghost commented 5 years ago

Could you find anything? Because I really can't find anything wrong.

luxleather commented 5 years ago

Same issue was in my code, I solve it finding what was missing. Must be my typo or copy from some other file.

In embed we have fields. Only last section should be without , (comma), but there was also in one before last (marked in code below).

fields:[
{
name:
value:
inline:
},
{
name:
value:
inline:
}, <<<here
{
name:
value:
inline:
}
]
ghost commented 5 years ago

I started over and now everything is working great. You can close this ticket. Thanks for the help.

MSFTserver commented 5 years ago

awesome