Storing Metadata IRC

Hi, I’m creating a bot that needs to store some information, say a JSON object. It kind of seemed like this might be able to be done according to IRCv3 specifications. Maybe something to do with USERSTATE? For example, I’m attempting to pass a state object between Twitch and my bot by somehow attaching information to the Twitch user in chat. This is actually for maintaining state between a user and my bot having a conversation. If anyone can provide implementation details on this, I’m using the ‘irc’ module for NodeJS. Thanks for any help.

There’s a better module called “tmi.js” specifically built for Twitch chat. When a user chats, their userstate and details of the message is sent if that’s the data you’re looking for. Known as “tags” in the IRC spec.



const tmi = require('tmi.js');
const client = new tmi.client({
        options: { debug: true }
        connection: {
            secure: true,
            reconnect: true
        identity: {
            username: '', // Username of the bot
            password: '' // oauth token of the bot (formatted as "oauth:oauth_token" or just the token)

.then(() => console.log('Connected'));

Listen for chat:

client.on('message', (channel, userstate, message, fromSelf) => {
    if(fromSelf) return false; // Do not respond to the bot's own messages
    console.log(userstate); // Do something with the data that is sent with every message.

9:59 Alca: Hello DendiFace

{ badges: { broadcaster: '1', subscriber: '0', turbo: '1' },
  color: '#177DE3',
  'display-name': 'Alca',
  emotes: { '58135': [ '6-14' ] },
  id: '90894b97-cc7a-4016-abe4-d5cf6eb4af9a',
  mod: false,
  'room-id': '7676884',
  'sent-ts': '1501124378629',
  subscriber: true,
  'tmi-sent-ts': '1501124376413',
  turbo: true,
  'user-id': '7676884',
  'user-type': null,
  'emotes-raw': '58135:6-14',
  'badges-raw': 'broadcaster/1,subscriber/0,turbo/1',
  username: 'alca',
  'message-type': 'chat' }

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.