gmemstr / go-twitch-irc

go irc client to use twitch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-twitch-irc Build Status Coverage Status

This is an irc client for connecting to twitch. It handles the annoying stuff like irc tag parsing.

godoc: https://godoc.org/github.com/gempir/go-twitch-irc

Getting Started

package main

import (
	"github.com/gempir/go-twitch-irc"
	"fmt"
)

func main() {
	client := twitch.NewClient("justinfan123123", "oauth:123123123")

	client.OnNewMessage(func(channel string, user twitch.User, message twitch.Message) {
		fmt.Println(message.Text)
	})

	client.Join("gempir")

	client.Connect()
}

Available Data

The 2 structs twitch.User and twitch.Message look like this:

type User struct {
	Username    string
	DisplayName string
	UserType    string
	Color       string
	Badges      map[string]int
}

type Message struct {
	Type   msgType
	Time   time.Time
	Action bool
	Emotes []*Emote
	Tags   map[string]string
	Text   string
}

Channel is just a string like "lirik", note the absent #.

Message Types

If you ever need more than basic PRIVMSG this might be for you. These are the 3 mayor message types currently supported

PRIVMSG
ROOMSTATE
CLEARCHAT

About

go irc client to use twitch

License:MIT License


Languages

Language:Go 99.4%Language:Makefile 0.6%