Twitch Chat Integration

A file by Miss(Trusted developer)

Downloads 229
Created 5 years ago
Updated 4 years ago

Deprecated

This script is deprecated! Nsgr built a new Twitch base plugin which serves as a more modern replacement to this one. Check it out here!

Original description

Scripts to integrate Twitch Chat into Openplanet scripts.

Extract somewhere in C:\Users\Username\Openplanet4\Scripts\, then you can #include them.

Example usage:

#include "TwitchChat.as"

class ChatCallbacks : Twitch::ICallbacks
{
  void OnMessage(IRC::Message@ msg)
  {
    // ...
  }

  void OnUserNotice(IRC::Message@ msg)
  {
    // ...
  }
}

void Main()
{
  print("Connecting to Twitch chat...");

  auto callbacks = ChatCallbacks();
  if (!Twitch::Connect(callbacks)) {
    return;
  }

  print("Connected to Twitch chat!");

  Twitch::Login(
    Setting_TwitchToken,
    Setting_TwitchNickname,
    Setting_TwitchChannel
  );

  while (true) {
    Twitch::Update();
    yield();
  }
}