openplanet Download Openplanet Login with ManiaPlanet

Twitch Chat Integration

Downloads: 3 | Released: August 7 2019 | By

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();
  }
}

Download


TwitchChatLib.zip (2.24 KB)