Discord Integration not working on RPi

linux
discord
phantombot

#1

PhantomBot Version: 2.4.2
OS Version: Linux (Raspbian Stretch)
Java Version: 1.8.0_191-b12
Browser and Version (for Panel Support): Microsoft Edge 44.17763.1.0
Stock PhantomBot: Yes

Hi! I’ve tried my best to work out what’s causing this issue, I’ve searched the forums, I’ve searched the Internet. I am stumped.

I got the bot up and running on my PC (Windows 10) and everything worked perfectly. Set up a Raspberry PiZeroW with a fresh SD card, installed PhantomBot, copied over the config. The bot works great on Twitch, but it’s like it can’t see Discord.

I get the message that Discord authentication was successful when it starts up and the bot joins the server, but I never see any [DISCORD] chat messages and it doesn’t reply to any commands. I’m currently running it from a command line just so I can see what’s happening without needing to check logs constantly, and it never picks up chat from Discord when it’s running on the Pi. But it does when on Windows 10.

I copied the whole thing over to my PC to run a cloned version and it’s fine, it all works great. I manually updated Oracle Java to be the same version I had on my PC. I tried installing a Nightly Build (2.4.2-NB-20181205 (Revision: 7638ff3)) and nothing has got it working. I’ve checked file permissions and the botuser is the owner of everything in the bot folder (something I missed when I first FTP’d the config folder across!) I also requested a new Discord token even though the token works fine on W10, so I knew it wouldn’t help. It didn’t.

The thing that’s got me so lost is there’s not a single error. I checked all the logs and there’s nothing. I have no idea what to try next.

Any help would be greatly appreciated! It’s not a deal-breaker as we mainly needed a Twitch bot anyway and this is replacing a super basic one I had running on my PC, but Discord integration would be really nice.

Thanks in advance!


#2

When was this occurring? Discord API was having issues the other day specifically targeting bots.


#3

I’ve been testing it for almost a week now. I can shut it down on the Pi and try it on the PC and it works immediately, so I don’t think it’s a Discord issue.


#4

Someone else had some stability issues on their Pi until they went to Jessie - which I understand is an older build.

The only other files I can think to look at are the error and stacktrace logs to see if something is produced if the bot is never seeing discord messages.


#5

I could try an older build and see if it works, though I probably wouldn’t end up using the older one. Will be interesting to see if it works.

I’ve looked at all the logs and there’s no errors at all, that’s why I am so confused by it all!

I didn’t bother testing it tonight as Discord has been having a lot of issues today!


#6

I haven’t had a chance to try an older OS yet, but I have now got some errors showing! The Twitch stream went live around 19:00 GMT yesterday and it triggered the following as it’s set to post in the discord server when the stream goes live.

In the core-error and stacktraces folder:

[12-08-2018 @ 19:02:14.083 GMT] org.mozilla.javascript.WrappedException: Wrapped java.lang.NullPointerException (misc.js#99)
	at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1893)
	at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:148)
	at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)
	at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
	at org.mozilla.javascript.gen.misc_js_140._c_say_6(misc.js:99)
	at org.mozilla.javascript.gen.misc_js_140.call(misc.js)
	at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
	at org.mozilla.javascript.gen.streamHandler_js_157._c_anonymous_9(streamHandler.js:185)
	at org.mozilla.javascript.gen.streamHandler_js_157.call(streamHandler.js)
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3282)
	at org.mozilla.javascript.gen.streamHandler_js_157.call(streamHandler.js)
	at org.mozilla.javascript.Context$1.run(Context.java:490)
	at org.mozilla.javascript.Context.call(Context.java:501)
	at org.mozilla.javascript.Context.call(Context.java:488)
	at org.mozilla.javascript.JavaAdapter.callMethod(JavaAdapter.java:576)
	at adapter1.run(<adapter>)
	at java.util.TimerThread.mainLoop(Timer.java:555)
	at java.util.TimerThread.run(Timer.java:505)
Caused by: java.lang.NullPointerException
	at tv.phantombot.discord.util.DiscordUtil.getChannel(DiscordUtil.java:305)
	at tv.phantombot.discord.util.DiscordUtil.sendMessage(DiscordUtil.java:106)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
	... 17 more

[12-08-2018 @ 19:02:14.539 GMT] [run()@Logger.java:175] Failed to log [NullPointerException]: null

I’ve only just had a look and I’m about to head off to bed, but it looks like this goes beyond my problem-solving skills. Someone else may have a clue though!


#7

The Channel object returned as null which typically means either there wasn’t communication with the Discord server or the channel doesn’t exist and could not be looked up.


#8

Hmmm that still has me baffled then as it works fine on Windows…


#9

I have seen oddities on Pi lately. Even someone swapping to a different distribution has resolved strange issues.


#10

Well, I have more info for you. I figured I’d try just swapping the SD card from the PiZero W v1.1 into a Pi 3 Model B I had. It works fine! So there could be something hardware wise that isn’t good enough on the Zero to run the Discord part, but it’s weird that there’s no errors.

I would have preferred to run it on the Zero, so I’ll keep playing around to see if I can narrow down what the issue is :slight_smile:


#11

Appreciate all of your work and patience with this, especially taking the time to come back and give us feedback! Helps us in the future if someone else bumps into a problem!


#12

No problem! I know how annoying it is to search around, find someone with exactly the same issue you’re having and… no answers! :slightly_smiling_face:

I’ve downloaded Jessie too, so I’ll try that on the Pi Zero later just in case rolling back fixes it. I’ve also got a few different versions of the Zero, so might try those too. Just to really check it all out!