tmi.js

💬 Javascript library for the Twitch Messaging Interface. (Twitch.tv)

MIT License

Downloads
12.6K
Stars
1.5K
Committers
42

Bot releases are hidden (Show)

tmi.js - tmi.js v1.8.5 Latest Release

Published by AlcaDesign about 3 years ago

v1.8.5

  • d9a3d63 Fix emoteset update timer not using sets.
tmi.js - tmi.js v1.8.4

Published by AlcaDesign about 3 years ago

v1.8.4

  • 4a21293 Removed union from utils as it only had a single use in the library. These util functions shouldn't be used outside of the library but worth mentioning.
  • b44286d Allow passing an HTTP proxy agent instance to node-fetch (Node) at the option connection.fetchAgent. Feedback on this is very welcomed, please open an issue if it doesn't work.
  • 643b2c9 Allow passing an HTTP proxy agent instance to ws (Node) at the option connection.agent. #209 #380 See this example on https-proxy-agent for more detail and available options. Feedback on this is very welcomed, please open an issue if it doesn't work.
const HttpsProxyAgent = require('https-proxy-agent');
const agent = new HttpsProxyAgent(proxyOptions);
const client = new tmi.Client({ connection: { agent } });
client.connect();
  • a3343ec Fix for some channels returning empty mod/VIP lists, potentially because all accounts on the list are closed/banned. #480
  • b477c6a Upgrade dependencies. (Notable: ws v7.4.3 -> v8.0.0)
    • ca392a0 And tests to match
  • 697c9d6 Update NOTICE msg-ids for ban/timeout anon/mod.
tmi.js - tmi.js v1.8.3

Published by AlcaDesign over 3 years ago

v1.8.3

  • b9a9a70 Clear emotesets timer
tmi.js - tmi.js v1.8.2

Published by AlcaDesign over 3 years ago

v1.8.2 [Deprecated]

  • 826e105 Remove async/await code from client._updateEmoteset. #463

v1.8.1

  • 28be1a7 Revert class and destructuring syntax.
tmi.js - tmi.js v1.8.0

Published by AlcaDesign over 3 years ago

v1.8.0

  • f9a5b3a The option connection.reconnect is now true by default.
  • 43900a9 Added option options.skipMembership (false by default) to not receive JOIN/PART messages for other users. This can reduce a lot of the spammy data that's getting blasted at the client.
const client = new tmi.Client({ options: { skipMembership: true } });
  • c74c2bb
    • Added option options.skipUpdatingEmotesets (false by default) to skip calling the emoticon_images API which can be a lot of data. The emotesets event will still be called but the second argument will just be an empty object.
    • Added option options.updateEmotesetsTimer (60000 (ms) by default) to change how often the emoticon_images API will be recalled. Set to 0 or a negative number (or false) to disable the timer entirely.
const client = new tmi.Client({ options: { skipUpdatingEmotesets: true, updateEmotesetsTimer: 0 } });
  • 33c15c7 The Client has been converted to a class style.

  • ff341d2 Client.prototype.api will now warn on use as it's deprecated and will be removed by the next minor version, 1.9.0. It's not intended to be a great choice for API requests. Either directly use fetch/node-fetch, another request library, or a Twitch-specific library like twitch on npm.

  • 76edfc8 dea8eed 5ea712f f689bc5 Remove various util functions.

  • 8f3a849 Fixed possible case fallthrough bug.

  • efc6cdb Add eslint (and many more commits related to facelifting the repo)

v1.7.5

  • 9d8ca1c Add "sub" alias for "subscription" event
tmi.js - tmi.js v1.7.3

Published by AlcaDesign over 3 years ago

v1.7.3

  • 3e46332 Added the event "globaluserstate". See the Twitch docs on the tags for the GLOBALUSERSTATE IRC command. These tags have always been available via client.globaluserstate after the command but hasn't been emitted.
client.on('globaluserstate', tags => {
    console.log('Hello, I am', tags['display-name']); // Hello, I am Alca
});
  • #461 Fixed a rare issue when a tag that is to be IRC unescaped is not a string.
  • 989bdad Updated dependencies (package-lock)
tmi.js - tmi.js v1.7.2

Published by AlcaDesign over 3 years ago

v1.7.2

  • #456 Add Accept header to Kraken emoticon_images request.
  • #458 Assume connection success on MOTD end, not MOTD line.
  • e85809b Upgrade dependencies.
tmi.js - tmi.js v1.7.1

Published by AlcaDesign almost 4 years ago

This update fixes the builds for v1.7.0. Those builds will be updated to be the same as these builds.

tmi.js - tmi.js v1.7.0

Published by AlcaDesign almost 4 years ago

v1.7.0 b9cd4b6

  • e4a58a9 notice event now includes unknown notices msg-ids for future usage.
  • #402 If an action message (/me) includes bits, it will be emitted as a cheer event instead. The message-type now reflects if it's a chat or action message.
client.on('cheer', (channel, tags, message) => {
    if(tags['message-type'] === 'action') console.log('Cheer message included /me');
});
  • 7e6f9f2 raided event viewers parameter is now parsed as a number and includes tags as the fourth parameter.
client.on('raided', (channel, username, viewers, tags) => {});
  • dc9495e Set the join interval with options.joinInterval. This allows joining channels from the channels list much faster. Default is still 2000ms. As low as 300ms per Twitch rate limit.
  • #405 Option connection.secure is now enabled by default. #394
  • 4783dba Replaced request package with node-fetch. This majorly reduces the dependency tree.
  • 1163a43 Use XHR instead of JSONP.
  • dd5ece0 Added options.globalDefaultChannel to set the default global channel instead of the default #tmijs. Only affects client.userstate. This is used in case the "tmijs" Twitch channel disappears in the future.
  • 6059f30 Whispers now reject on no_permission NOTICE.
  • #435 Add options.messagesLogLevel to set the log level for chat messages, defaults to "info".
  • #442 Add redeem event. This event will only be received for rewards and custom rewards with user text.
client.on('redeem', (channel, username, rewardType, tags, message) => {
    switch(rewardType) {
        // Message that appears "highlighted" in the chat.
        case 'highlighted-message': break;
        // Message that skips the subscriber-only mode
        case 'skip-subs-mode-message': break;
        // Custom reward ID
        case '27c8e486-a386-40cc-9a4b-dbb5cf01e439': break;
    }
});

Fixes

  • #378 Fixed warning: "possible EventEmitter memory leak detected".
  • 98ce79f invalid_user msg-id now rejects command promises.
  • a626924 Fixed "global is not defined" in Angular. #369
  • 1cea97c Internal calls to connect are now caught and sent to the logger.
  • #425 Fixed moderator tracking for USERSTATE messages.
  • ffe4f48 Add missing VIP rejection bad_vip_max_vips_reached

v1.6.0 ddced23

  • #347 Use a function for identity.password in the configuration to use a dynamically generated token.
const client = new tmi.Client({
    /* ... */
    identity: {
        username: 'alca',
        async password() {
            const user = await db.getUser({ userId: '7676884' });
            const token = await getAccessToken(user.refresh_token);
            return token;
        }
    }
});
tmi.js - tmi.js v1.5.0

Published by AlcaDesign about 5 years ago

v1.5.0

  • Add isReactNative utility function. #354 35576181359d47c20a0feb9068fa93a8cc00c4c0
    This is used by client.api to know when to use XMLHttpRequest instead of JSONP.
const isReactNative = require('tmi.js/utils').isReactNative();
  • Fixed followersonly event when followers-only mode is enabled. #351 7e27d0c4d38d53e2f712ba96e66210cb7760e290
client.on('followersonly', (channel, enabled, minutes) => {
    if(enabled) {
        console.log('Followers-only mode was enabled without throwing an error.');
    }
});
tmi.js - tmi.js v1.4.5

Published by AlcaDesign over 5 years ago

v1.4.5

  • Added the event "automod" for the "msg_rejected" and "msg_rejected_mandatory" msg-id's. #273
    client.on("automod", (channel, msgID, message) => {});
    
    The msgID of "msg_rejected" means the message was caught by Automod but may still be accepted by a human. "msg_rejected_mandatory" means the message was automatically rejected due to moderation settings.

v1.4.4

  • The client's connection must now be OPEN instead of not CLOSING and not CLOSED. #338
  • Trying to send a message while not authorized (using an anonymous identity) will reject with "Cannot send anonymous messages." but still rejecting with "Not connected to server." for disconnected clients.
    const client = new tmi.Client();
    client.say("twitch", "Hello world.")
      .catch(console.error); // Logs "Not connected to server."
    client.connect()
      .then(() => client.say("twitch", "Hello world."))
      .catch(console.error); // Logs "Cannot send anonymous messages."
    
  • Altered the auto-joiner for the channels option to use the .join method instead of directly sending a raw message. Errors are sent to the logger.
tmi.js - tmi.js v1.4.3

Published by AlcaDesign over 5 years ago

  • Parse the badge-info tag like badges. This offers some information about certain badges in the badges tag.
    • This means that the user has the 12-month subscriber badge but more specifically have subscribed for 21 months:
    { "badge-info": { subscriber: "21" }, badges: { subscriber: "12" } }
    
  • Automatically unescapes strings in the tags. This replaces "\\s", "\\:", "\\n", and "\\r" with " ", ";", "" (empty), and "" (empty) respectively.
    "Channel\\sSubscription\\s(Schmoopiie)" // Input
    "Channel Subscription (Schmoopiie)" // Output
    
  • Added the event "primepaidupgrade". Fires when a user converts from a Prime subscription to a regular subscription. Their subscription will continue after the Prime subscription ends.
    client.on("primepaidupgrade", (channel, username, methods, userstate) => {});
    
  • Removed extra-utils from the library. This wasn't documented nor recommended and would be better supplied by userland anyway.
  • Fixed a case when joining a channel that no longer exists would cause the .join() command's callbacks to register incorrectly. (#342)