Error when bot receives whisper

Hi, stacktrace when the bot receives a whisper in the latest nightly (OpenJDK) as of posting:

[10-17-2019 @ 19:09:30.220 GMT] [init.js:325] Error with Event Handler [ircPrivateMessage] Script [./core/whisper.js] Stacktrace [whisper.js:88 > init.js:323 > init.js:717] Exception [TypeError: Cannot find function includes in object sipsbot,sipsbot,theonlytermin, (continued comma delimited list of users).]

I had the same problem. With commit “80fa182” (Performance improvements for js user arrays) --> Performance improvements for js user arrays · PhantomBot/[email protected] · GitHub the “hasKey” check was replaced with “includes” which does not work.

Should work if you replace line 88:
if (message.startsWith('!') && $.isMod(sender) && $.users.includes(sender)) {
if (message.startsWith('!') && $.isMod(sender) && hasKey($.users, sender)) {

line 38:
function hasKey(list, value, subIndex) {
function hasKey(list, value) {

and line 42:
if (list[i][subIndex].equalsIgnoreCase(value)) {
if (list[i].equalsIgnoreCase(value)) {

Would make a PR, but I didn’t do that before and must have a look into it. :smile:

1 Like

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