tmijs / tmi.js

💬 Javascript library for the Twitch Messaging Interface. (Twitch.tv)
https://tmijs.com
MIT License
1.54k stars 217 forks source link

Anonymous error message when hosting twitchbot locally but not on Glitch #382

Closed KyleStiers closed 2 years ago

KyleStiers commented 4 years ago

Hello, I followed a tutorial for writing a twitchbot using tmi.js and have the bot up and running - currently hosted on Glitch.com. I wanted to break away from the restrictions fo the site and host it locally. It appears it is due to an anonymous message being sent, despite the user details being supplies from an external .env file (to avoid putting the OAuth token in the JS file).

Actual behaviour: When keyword is using that bot should reply to I get: (node:6568) UnhandledPromiseRejectionWarning: Cannot send anonymous messages.

This occurs inside of the client.js _sendMessage function prototype (line 1196 of client.js). This error does not occur when hosted on Glitch.

Expected behaviour: Expected the same behavior as Glitch where it successfully retrieves user details from .env file and sends a message with credentials (not anonymously).

Error log:

(node:6568) UnhandledPromiseRejectionWarning: Cannot send anonymous messages.
warning.js:32
(node:6568) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
warning.js:32
(node:6568) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Server configuration

itsAnuga commented 4 years ago

Which Node version are you using? I think it broke i Node 14.

itsAnuga commented 4 years ago

Additional information, Outdated and Deprecated Dependency:

https://www.npmjs.com/package/request