💬 Javascript library for the Twitch Messaging Interface. (Twitch.tv)
MIT License
Bot releases are hidden (Show)
Published by AlcaDesign about 3 years ago
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.node-fetch
(Node) at the option connection.fetchAgent
. Feedback on this is very welcomed, please open an issue if it doesn't work.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();
ws
v7.4.3 -> v8.0.0)
msg-id
s for ban/timeout anon/mod.Published by AlcaDesign over 3 years ago
Published by AlcaDesign over 3 years ago
client._updateEmoteset
. #463Published by AlcaDesign over 3 years ago
connection.reconnect
is now true
by default.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 } });
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.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)
Published by AlcaDesign over 3 years ago
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
});
Published by AlcaDesign over 3 years ago
Accept
header to Kraken emoticon_images
request.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.
Published by AlcaDesign almost 4 years ago
notice
event now includes unknown notices msg-id
s for future usage.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');
});
raided
event viewers parameter is now parsed as a number and includes tags as the fourth parameter.client.on('raided', (channel, username, viewers, tags) => {});
options.joinInterval
. This allows joining channels from the channels list much faster. Default is still 2000ms. As low as 300ms per Twitch rate limit.connection.secure
is now enabled by default. #394request
package with node-fetch
. This majorly reduces the dependency tree.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.no_permission
NOTICE.options.messagesLogLevel
to set the log level for chat messages, defaults to "info".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;
}
});
invalid_user
msg-id now rejects command promises.connect
are now caught and sent to the logger.bad_vip_max_vips_reached
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;
}
}
});
Published by AlcaDesign about 5 years ago
isReactNative
utility function. #354 35576181359d47c20a0feb9068fa93a8cc00c4c0client.api
to know when to use XMLHttpRequest
instead of JSONP
.const isReactNative = require('tmi.js/utils').isReactNative();
followersonly
event when followers-only mode is enabled. #351 7e27d0c4d38d53e2f712ba96e66210cb7760e290client.on('followersonly', (channel, enabled, minutes) => {
if(enabled) {
console.log('Followers-only mode was enabled without throwing an error.');
}
});
Published by AlcaDesign over 5 years ago
"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.OPEN
instead of not CLOSING
and not CLOSED
. #338"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."
channels
option to use the .join
method instead of directly sending a raw message. Errors are sent to the logger.Published by AlcaDesign over 5 years ago
badge-info
tag like badges
. This offers some information about certain badges in the badges
tag.
{ "badge-info": { subscriber: "21" }, badges: { subscriber: "12" } }
"\\s"
, "\\:"
, "\\n"
, and "\\r"
with " "
, ";"
, ""
(empty), and ""
(empty) respectively.
"Channel\\sSubscription\\s(Schmoopiie)" // Input
"Channel Subscription (Schmoopiie)" // Output
client.on("primepaidupgrade", (channel, username, methods, userstate) => {});
extra-utils
from the library. This wasn't documented nor recommended and would be better supplied by userland anyway..join()
command's callbacks to register incorrectly. (#342)