Bot is printing "null" after each follower notification in Twitch chat


PhantomBot Version: 2.4.2

OS Version: CentOS 6.9

Java Version:
openjdk version “1.8.0_191”
OpenJDK Runtime Environment (build 1.8.0_191-b12)

Stock PhantomBot: Yes

This seems to happen the majority of the time (which in itself is weird that it isn’t happening every time) but when my streamer is followed by a new follower, and the follower notification kicks off, everything works as intended. However after it prints out the follower notification, it then simply prints out null on a separate line right after.

I have nothing in my logs directory indicating what could be the issue.

Considering there’s nothing in my logs relevant to this issue, I’m not sure what I can provide.

Let me know if this is a known issue, or if you need additional logs/information.




I am unable to reproduce in the stock version of PhantomBot. You can try the following from the Console to test a follower, let me see the output that follows; if the bot is sending two messages, then I would double check the content of the message that is used to greet a new follower, perhaps there is an additional bit of text stored that is resulting in a “null” message being generated. You can reset that message from chat with !followmessage Remember the tags (reward) and (name) are available. You may also change the message from the Console with the followmessage command (note, ! is not required from the Console).

Now, back to testing the follower message from the Console, run: followertest This will generate a random name and trigger a follow:

[01-24-2019 @ 22:58:12.235 MST] [CONSOLE] Executing followertest (User: O2vtLC5dA2)
[01-24-2019 @ 22:58:12.315 MST] [DISCORD] [#bottest] [EMBED]
[01-24-2019 @ 22:58:13.433 MST] [MUTED] o2vtlc5da2 has followed the channel and is getting 200 points for it!

If after resetting the message you still have troubles, let me know and we can look to provide a different followHandler.js module with additional debugging information to track down the issue.



Thank you for the feedback and suggestions.

Before changing the follow message, I went ahead and ran followertest for testing. Honestly I had to run it a lot before I could reproduce the problem, and I was only able to reproduce it twice. Which is different than when a real user follows because it’s almost every follower that it kicks off the null message. Here are some trimmed logs, not sure if they help:

[01-25-2019 @ 06:28:47.579 GMT] [CONSOLE] Executing followertest (User: 7CSU0eTxih)
[01-25-2019 @ 06:28:47.735 GMT] [CHAT] <3 Thanks for following, 7csu0etxih <3
[01-25-2019 @ 06:28:47.736 GMT] [CHAT] null
[01-25-2019 @ 06:30:39.079 GMT] [CONSOLE] Executing followertest (User: YHQSEdDHMo)
[01-25-2019 @ 06:30:39.737 GMT] [CHAT] <3 Thanks for following, yhqseddhmo <3
[01-25-2019 @ 06:30:50.753 GMT] [CONSOLE] Executing followertest (User: m8d1CSyDmd)
[01-25-2019 @ 06:30:51.738 GMT] [CHAT] <3 Thanks for following, m8d1csydmd <3
[01-25-2019 @ 06:30:50.753 GMT] [CONSOLE] Executing followertest (User: m8d1CSyDmd)
[01-25-2019 @ 06:30:51.738 GMT] [CHAT] <3 Thanks for following, m8d1csydmd <3
[01-25-2019 @ 06:30:51.739 GMT] [CHAT] null

That said, I checked the follower message and confirmed there were no odd characters. However what I went ahead and did was reset the follower message, and then set it again.

Once we stream again and the streamer gets some real followers, I’ll see if simply resetting the message fixed the problem. I’ll report back here.

Otherwise, let me know if you’d like me to do any additional testing. I’d be all for it.



I have an idea as to what might be wrong then, since it is random (like you show above, does great a couple of times, then prints null). I will see if I can forcefully reproduce this in my bot’s code base and see if it can be fixed.

I do appreciate your testing it a few times and showing me the output, it is a great help!




No problem! Figured I’d go ahead and give an update. It looks like it’s still printing null out even after resetting the follow message. We’ve had one follow tonight and it did it. Thanks for looking into this.



Do you have any custom scripts? This has happened in the past and it was because someone had a message being said every X minutes.



To help troubleshoot further, if you are comfortable with this, replace the runFollows() function in scripts/handlers/followHandler.js. Then we will know if it is the follower trigger or not:

     * @function runFollows
    function runFollows() {
        if (!followQueue.isEmpty() && (lastFollow + (followDelay * 1e3)) < $.systemTime()) {
            var followOutput = followQueue.poll();
            $.consoleLn('runFollows(' + followOutput + ')');
            if (followOutput !== null) {
            lastFollow = $.systemTime();

There will be a line of data spammed to the Console as well, that is to make sure that it is/isn’t the followQueue that is somehow causing an issue.

Like Scania says though, the odds are that it is elsewhere because the message is immediately presented afterwards. There is a cooldown period between each follow and that message is immediate. If you want to spam the Console with followertest that would at least see if it is the follower message or not.




Does that script use a concurrent queue? I could see it printing null if it isn’t.



@IllusionaryOne Thanks for providing that. I will give it a test run and report back.

@ScaniaTV My PhantomBot does not have any custom scripts. The only thing done is downloading the beta web panel. None of the bot files have been modified.

# phantom directory is bot / PhantomBot-2.4.2 is as is from GitHub
$ diff -rq phantom/ PhantomBot-2.4.2/ | less
Only in phantom/addons: deathctr
Files phantom/addons/followHandler/latestFollower.txt and PhantomBot-2.4.2/addons/followHandler/latestFollower.txt differ
Files phantom/addons/hostHandler/latestHostOrAutoHost.txt and PhantomBot-2.4.2/addons/hostHandler/latestHostOrAutoHost.txt differ
Files phantom/addons/hostHandler/latestHost.txt and PhantomBot-2.4.2/addons/hostHandler/latestHost.txt differ
Only in phantom/config: botlogin.txt
Only in phantom/config: phantombot.db
Only in phantom/config: phantombot.db-shm
Only in phantom/config: phantombot.db-wal
Only in phantom/: dbbackup
Only in phantom/logs: chat
Only in phantom/logs: core
Only in phantom/logs: core-debug
Only in phantom/logs: core-error
Only in phantom/logs: core-warnings
Only in phantom/logs: event
Only in phantom/logs: moderation
Only in phantom/logs: pointSystem
Only in phantom/logs: private-messages
Only in phantom/logs: stacktraces
Only in phantom/web: beta-panel
Only in phantom/web/common/js: wsConfig.js
Files phantom/web/panel/js/panelConfig.js and PhantomBot-2.4.2/web/panel/js/panelConfig.js differ
Files phantom/web/playlist/js/playerConfig.js and PhantomBot-2.4.2/web/playlist/js/playerConfig.js differ
Only in phantom/web/ytplayer/js: playerConfig.js


Another patch that could be tried in scripts/core/misc.js, in the say function, replacing the first few lines and adding the new code:

    function say(message) {
        if (reg.test(message)) {

        if (message === null || message === 'null') {
            try {
                throw new Error();
            } catch (ex) {
                $.consoleLn('Bot Message [' + message + '] Stacktrace [' + ex.stack.trim().split('\n').join(' > ').replace(/anonymous\(\)@|callHook\(\)@/g, '') + ']');

This should indicate where the message is coming from when it is null. As an example, I put a $.say(null); in the searchquote command and the trace indicates that quoteSystem.js is in the stack.

[01-27-2019 @ 21:45:30.971 MST] Bot Message [null] Stacktrace [say()@misc.js:157 > quoteSystem.js:292 > init.js:315 > init.js:510]
[01-27-2019 @ 21:45:30.972 MST] [MUTED] @IllusionaryBot, Usage: !searchquote [text] (Must provide at least 5 characters)

closed #11

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