Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/ColeWalker/twitchircgo

A twitch irc client for Golang
https://github.com/ColeWalker/twitchircgo

go golang irc twitch twitch-bot twitch-bots twitch-irc

Last synced: 8 days ago
JSON representation

A twitch irc client for Golang

Lists

README

        

# Go Twitch IRC Client

This repository contains a Go client for interacting with Twitch IRC channels.

# Example

main.go contains the following example which will receive each message in my channel (supcole) and log information about it and the user who sent it to the console. To be able to run this, you must have Twitch API credentials.

```go

chatToken := twitchircgo.RefreshAuth("refresh token goes here","client id goes here", "client secret goes here")

bot := newBot(chatToken, []string{"#channel", "#anotherchannel"}, "botusername")
bot.Connect()

for {
message := <-bot.OnMessage
fmt.Printf("got message %+v\n",message)
}

```

Messages in the above code segment are sent to the channel OnMessage, and saved to a local variable.
Message objects contain user information and the contents of the message itself.