Problems making setitle, setgame, and highlights work


PhantomBot Version: (Revision: 8813a27a)
Control Panel Version 1.1
Java Version: 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12
OS Version: Linux
Browser and Version (for Panel Support): Chrome
Stock PhantomBot: Yes

Hey, I just set this bot up and have a friend hosting it on their server. For the apioauth token I went directly to twitch’s oauth generator for my caster twitch channel and put that in during setup. But the bot was unable to change my title/game or do highlights so I did some googling and saw someone mention that that token should be generated through your website ( which might fix my issue. So I did that, got the token, and SSH’d into my friend’s server to edit the botinfo.txt file. I edited the “apioauth” field with the new token and uploaded it back to the server.

The bot still isn’t doing what I want. Is it because it’s still reading the old file with the wrong token? Or do I need to do something to make it recognize it has editor (I added it manually as an editor and still no dice)? Reconnecting it to my chat didn’t work, and it isn’t working through the panel nor the commands in chat.


Are you generating with the channel account you’re trying to change the game or title for? Try going in incognito mode to generate a token and it will ask you the account you want to login with.


Did you just reconnect, or did you restart the whole bot?


Ok, so, I had only reconnected it as I didn’t have the proper permissions to restart the bot till they woke up in the morning. Now I have permissions and have restarted the bot. It can properly change my game and title, which is great - and also means the oauth is correct!

That being said the highlights are still not working, and I can’t figure out why. These are the logs of what happens:

shadostruct: !highlight widow
[ERROR] [init.js:300] (, command, ./commands/highlightCommand.js) TypeError: Cannot read property "1" from null
shadostruct: !highlight
[CHAT] @Shadostruct, Usage: !highlight [description] (Using date stamp for timezone: EST)
shadostruct: !highlight widow outplay
[ERROR] [init.js:300] (, command, ./commands/highlightCommand.js) TypeError: Cannot read property "1" from null
shadostruct: !highlight [widow outplay]
[ERROR] [init.js:300] (, command, ./commands/highlightCommand.js) TypeError: Cannot read property "1" from null

Edit: Oh, also, the “highlightCommand.js” Twitch module is enabled.


So, I was able to reproduce this by modifying the script a couple of ways.

highlight this is a highlight
[03-30-2018 @ 20:28:35.419 MDT] [MUTED] @IllusionaryBot, No videos were found.
[03-30-2018 @ 20:28:35.564 MDT] [ERROR] [init.js:300] (, command, ./commands/highlightCommand.js) TypeError: Cannot read property "1" from null

I first had to remove the check to see if my stream was online, since I am not streaming, then I allowed the check that exists to see if the VOD check returns null to keep going. I guess what I am saying is, I am not sure how this can happen without the check for the current VOD in Twitch not catching the null condition (hence your null error). I suppose we can try to put some additional checks around the VOD check in Twitch, but, the fact that you are getting back null in the first place indicates that the API call to Twitch isn’t happy checking data for your channel.

If I can setup a test stream, I can try to test the command and verify it against the Twitch API.


Reproduced during a test stream. Providing a patch. Was due to uptime not being properly handled.


Cool, I’m glad to see a dev so quick to respond and help! Thanks for spending the time man.

I’m sorry to say that this fix didn’t work, though.

asulynn: !vod
[CHAT] @Asulynn, Stream Uptime: 4 hours, 18 minutes, and 35 seconds. []
asulynn: !highlight test
[ERROR] [init.js:300] (, command, ./commands/highlightCommand.js) ReferenceError: "getCurLocalTimeString" is not defined.

Using the latest stable build: v2.4.0.3

Vod command works fine apparently, but the highlights command isn’t working and is throwing a new error now. Sorry to be such a pain.


Looks like a fix for that error wasn’t applied, @IllusionaryOne talked about in our group chat, so I can only assume he forgot to git add the file before merging.

Anyway, fixed here if you want to apply the fix. Our next release probably won’t be any time soon.



I fixed highlightCommand.js and streamCommand.js as you said above, restarted bot, but still have an error:

ME: !highlight Test

[ERROR] [init.js:300] (, command, ./commands/highlightCommand.js) TypeError: Cannot read property "1" from null

Any suggestions?


Not sure:

highlight not sure
[04-06-2018 @ 15:56:14.319 MDT] [CHAT] @IllusionaryBot, Highlight successfully saved with a timestamp of 0:00.
highlight really not sure seems to work here
[04-06-2018 @ 15:56:43.180 MDT] [CHAT] @IllusionaryBot, Highlight successfully saved with a timestamp of 0:00.


I’ve recently updated. Prior to ver I was getting the same error as Wedas

Now that I’ve updated to ver I’m getting this error whenever using the !highlight command. Looks like that new getCurLocalTimeString function is referencing something that isn’t there. Not sure how to fix it myself.

[04-04-2018 @ 20:00:33.424 EST] [init.js:300] (, command, ./commands/highlightCommand.js) ReferenceError: “getCurLocalTimeString” is not defined.

Any suggestions would be great and let me know if you need me to test anything else. Thanks!


Yeah, I checked it with new copy of PhantomBot and it works well. I’ll search for mistake on my side.


Did you apply this fix from the post above?


Verified this fix works on:

PhantomBot Version: (Revision: 60fd67d6)
Control Panel Version 1.1
Java Version: 1.8.0_162-8u162-b12-0ubuntu0.16.04.2-b12
OS Version: Linux


Yep can confirm the fix from the post above does indeed work on version! Thanks you all for the help :slight_smile:


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