Cannot read properties of undefined (reading 'startsWith') in Commands.js of tmi.js
D3FAU4T opened this issue · 1 comments
D3FAU4T commented
Actual behaviour:
I'm getting this same error occasionally and it is crashing my bot. I'm pretty sure it's an error in the tmi.js lib and not in my bot. Please check this issue.
Expected behaviour:
I should not get any error from tmi.js while my bot is running.
Error log:
/home/runner/username/node_modules/tmi.js/lib/commands.js:342
if((message.startsWith('.') && !message.startsWith('..')) || message.startsWith('/') || message.startsWith('\\')) {
^
TypeError: Cannot read properties of undefined (reading 'startsWith')
at client.say (/home/runner/bhotianaa/node_modules/tmi.js/lib/commands.js:342:15)
at client.<anonymous> (file:///home/runner/bhotianaa/index.js:193:10)
at client.EventEmitter.emit (/home/runner/bhotianaa/node_modules/tmi.js/lib/events.js:94:44)
at client.emits (/home/runner/bhotianaa/node_modules/tmi.js/lib/client.js:90:13)
at client.handleMessage (/home/runner/bhotianaa/node_modules/tmi.js/lib/client.js:1117:13)
at /home/runner/bhotianaa/node_modules/tmi.js/lib/client.js:1228:9
at Array.forEach (<anonymous>)
at client._onMessage (/home/runner/bhotianaa/node_modules/tmi.js/lib/client.js:1225:8)
at WebSocket.onMessage (/home/runner/bhotianaa/node_modules/ws/lib/event-target.js:199:18)
repl process died unexpectedly: exit status 1
Configuration
- tmi.js version: 1.8.5 (Latest as of today)
- Node version (if applicable): v16.15.0
- Browser and version (if applicable): The bot runs in Replit website server, not sure if browser is applicable or not
- Operating system: NixOS (Replit probably uses this, I'm not sure)
Picture Preview
AlcaDesign commented
Check to make sure you're not calling client.say
without a message argument. The arguments are channel
then message
. If message
is not a string you will get an error.
client.say('alca', 'Thanks for lurking!')