Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

openplanet-nl/twitch-integration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twitch Chat integration

Scripts to integrate Twitch Chat into Openplanet scripts.

This repository also includes an example plugin for displaying the Twitch Chat in-game in the overlay.

Usage

Put the scripts somewhere in C:\Users\Username\Openplanet4\Scripts\ so that you can #include them. Here's a quick example:

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