command module
Version: v1.1.6 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2015 License: GPL-3.0 Imports: 4 Imported by: 0


Shigebot is a basic twitch IRC bot I wrote for shigetora / cookiezi.


  • Runs on Windows, Linux, Mac OS X, FreeBSD and every other os supported by the Go programming language.
  • Connects and operates on multiple channels at once.
  • Simple text commands, separate for each channel and manageable by mods through !cmdadd, !cmdedit and !cmdremove. The commands are saved and restored on start-up.
  • Text commands can be restricted to moderators only through !modonly
  • Keeps track of the message count to avoid hitting the twitch message rate cap.
  • Supports non-moderator accounts by randomizing messages and using a lower message rate limit.
  • Uses a github account to commit and update the command list as a markdown
    gist and links it instead of displaying a huge command list in chat.
  • Can be used as a library to develop your own bot.
  • Togglable case sensitivity.
  • Configurable ignore list to prevent conflicts with other bots on the channel.


  • Download the binaries from the releases section.
  • Obtain a twitch oauth token from here.
  • Obtain a gist oauth toekn by using the provided gist-token utility.
  • Enter the two oauth tokens in config.json and customize the other settings to your liking.
  • Run shigebot.

How to compile

go get
go get -tags purego
go get
go get
go install
  • Your binaries will be in GOPATH/bin

Known issues

  • If the bot randomly disconnects after some time with an EOF error, configure it to join its own channel (for example, if your bot is called mybot, you should add #mybot to the channels in config.json). I have no idea why this fixes it or why the random disconnects happen on some accounts, but I will look into it.
  • Recognizing the mods might take a while after the bot first joins a channel, so mod-only commands will only start working a few minutes after the bot joins. This is because twitch takes some time to send the operator modeset messages.

Using the shige package to make your own twitch bot

If you wish to customize the behaviour of the bot any further than what the settings allow, you can use the shige package as a library to make your own bot.

package main
import (

func main() {
	bot, err := shige.Init(
		"myuser", // twitch user
		"oauth:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", // twitch oauth
		"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", // gist oauth
		true, // moderator?
		false, // case sensitive
	if err != nil {

	bot.AddCommand("test", func(c *shige.CommandData) {
		c.Channel.Privmsgf("You are %s and this is a custom built-in command." +
			" You called this command with these params: %v", c.Nick, c.Args)

	bot.AddCommand("test2", func(c *shige.CommandData) {
		c.Channel.Privmsgf("This command should never execute")

	bot.OnPrivmsg = func(event *irc.Event) bool {
		fmt.Println("Hi from the custom PRIVMSG handler, event=", event)

		if strings.HasPrefix(event.Message(), "!test2") {
			fmt.Println("Ignoring test2 command")
			return false

		return true



The Go Gopher

There is no documentation for this package.

Source Files


Path Synopsis
Package shige implements Shigebot, a twitch irc bot.
Package shige implements Shigebot, a twitch irc bot.
Package gist implements utilities to communicate with the github gist API.
Package gist implements utilities to communicate with the github gist API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL