This fork sends the message to Twitch and waits for Twitch to send back the actual ID of the message, then, and only then, it will broadcast the message add event.
More details here: tmijs#529
Website | Documentation currently at tmijs/docs | Changelog on the release page
$ npm i tmi.js
const tmi = require('tmi.js');
const client = new tmi.Client({
options: { debug: true },
identity: {
username: 'bot_name',
password: 'oauth:my_bot_token'
},
channels: [ 'my_channel' ]
});
client.connect().catch(console.error);
client.on('message', (channel, tags, message, self) => {
if(self) return;
if(message.toLowerCase() === '!hello') {
client.say(channel, `@${tags.username}, heya!`);
}
});
Available as "tmi
" on window
.
<script src="/scripts/tmi.min.js"></script>
<script>
const client = new tmi.Client({ /* ... */ });
client.connect().catch(console.error);
</script>
$ git clone https://github.com/tmijs/tmi.js.git
$ npm install
$ npm run build
$ npm i -D @types/tmi.js
- Follow @AlcaMagic on Twitter, Alca on Twitch.
- Follow @Schmoopiie on Twitter.
- Found a bug: submit an issue.
- Discussion and help about tmi.js: Twitch API Discord Server
- For everything else: Official TwitchDev Discord Server
Thanks to all of the tmi.js contributors!
Please review the guidelines for contributing of the tmi.js repository. We reserve the right to refuse a Pull Request if it does not meet the requirements.