{"id":16473358,"url":"https://github.com/vikpe/twitch-chatbot","last_synced_at":"2025-07-02T14:09:55.105Z","repository":{"id":44341262,"uuid":"512138454","full_name":"vikpe/twitch-chatbot","owner":"vikpe","description":"Twitch chatbot in Go (Golang)","archived":false,"fork":false,"pushed_at":"2023-09-19T19:42:40.000Z","size":31,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-01T06:31:48.215Z","etag":null,"topics":["chatbot","irc","twitch"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vikpe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-09T08:52:35.000Z","updated_at":"2023-06-26T00:28:20.000Z","dependencies_parsed_at":"2024-06-21T07:10:58.743Z","dependency_job_id":"5f093853-5b71-4c7f-b79c-33e9ef203b10","html_url":"https://github.com/vikpe/twitch-chatbot","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikpe%2Ftwitch-chatbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikpe%2Ftwitch-chatbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikpe%2Ftwitch-chatbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikpe%2Ftwitch-chatbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vikpe","download_url":"https://codeload.github.com/vikpe/twitch-chatbot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238508925,"owners_count":19484229,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatbot","irc","twitch"],"created_at":"2024-10-11T12:26:34.167Z","updated_at":"2025-02-12T16:32:26.249Z","avatar_url":"https://github.com/vikpe.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# twitch-chatbot [![test](https://github.com/vikpe/twitch-chatbot/actions/workflows/test.yml/badge.svg)](https://github.com/vikpe/twitch-chatbot/actions/workflows/test.yml)\n\n\u003e Twitch chatbot in Go (Golang)\n\nSimple chatbot interface based on [github.com/gempir/go-twitch-irc](https://github.com/gempir/go-twitch-irc)\n\n## Install\n\n```shell\ngo get github.com/vikpe/twitch-chatbot\n```\n\n## Generate chatbot oauth token\n\n* [Twitch Chat OAuth Password Generator](https://twitchapps.com/tmi/)\n\n## Usage\n\n```go\n\npackage main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/gempir/go-twitch-irc/v4\"\n\tchatbot \"github.com/vikpe/twitch-chatbot\"\n)\n\nfunc main() {\n\t// init\n\tusername := \"bot_username\"\n\toauth := \"oauth:bbbbbbbbbbbbb\"\n\tchannel := \"channel_name\"\n\tcommandPrefix := '!'\n\n\tmyBot := chatbot.NewChatbot(username, oauth, channel, commandPrefix)\n\n\t// event callbacks\n\tmyBot.OnStarted = func() { fmt.Println(\"chatbot started\") }\n\tmyBot.OnConnected = func() { fmt.Println(\"chatbot connected\") }\n\tmyBot.OnStopped = func(sig os.Signal) {\n\t\tfmt.Println(fmt.Sprintf(\"chatbot stopped (%s)\", sig))\n\t}\n\n\t// command handlers\n\tmyBot.AddCommand(\"hello\", func(cmd chatbot.Command, msg twitch.PrivateMessage) {\n\t\tmyBot.Reply(msg, \"world!\")\n\t})\n\n\tmyBot.AddCommand(\"test\", func(cmd chatbot.Command, msg twitch.PrivateMessage) {\n\t\tmyBot.Say(fmt.Sprintf(\"%s called the test command using args %s\", msg.User.Name, cmd.ArgsToString()))\n\t})\n\n\tmyBot.AddCommand(\"mod_only\", func(cmd chatbot.Command, msg twitch.PrivateMessage) {\n\t\tif !chatbot.IsModerator(msg.User) {\n\t\t\tmyBot.Reply(msg, \"mod_only is only allowed by moderators.\")\n\t\t\treturn\n\t\t}\n\n\t\tmyBot.Say(fmt.Sprintf(\"%s called the mod_only command\", msg.User.Name))\n\t})\n\n\tmyBot.AddCommand(\"sub_only\", func(cmd chatbot.Command, msg twitch.PrivateMessage) {\n\t\tif !chatbot.IsSubscriber(msg.User) {\n\t\t\tmyBot.Reply(msg, \"sub_only is only allowed by subscribers.\")\n\t\t\treturn\n\t\t}\n\n\t\tmyBot.Say(fmt.Sprintf(\"%s called the sub_only command\", msg.User.Name))\n\t})\n\n\tfmt.Println(myBot.GetCommands(\", \")) // \"hello, test, mod_only, sub_only\"\n\n\tmyBot.Start() // blocking operation\n}\n```\n\n## Methods\n\n|                                                      |\n|------------------------------------------------------|\n| `Start()`                                            |\n| `Stop()`                                             |\n| `Say(text string)`                                   |\n| `Reply(msg twitch.PrivateMessage, replyText string)` |\n| `AddCommand(name string, handler CommandHandler)`    |\n| `GetCommands(sep string)`                            |\n\n### Callback methods\n\n|                                                            |\n|------------------------------------------------------------|\n| `OnStarted()`                                              |\n| `OnConnected()`                                            |\n| `OnStopped(os.Signal)`                                     |\n| `OnUnknownCommand(cmd Command, msg twitch.PrivateMessage)` |\n\n**`OnUnknownCommand`** defaults to:\n\n```go\nfunc(cmd Command, msg twitch.PrivateMessage) {\nreplyMessage := fmt.Sprintf(`unknown command \"%s\". available commands: %s`, cmd.Name, bot.GetCommands(\", \"))\nbot.Reply(msg, replyMessage)\n}\n```\n\n### User methods\n\n|                                                      |\n|------------------------------------------------------|\n| `IsBroadcaster(user twitch.User)`                    |\n| `IsModerator(user twitch.User)`                      |\n| `IsSubscriber(user twitch.User)`                     |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvikpe%2Ftwitch-chatbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvikpe%2Ftwitch-chatbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvikpe%2Ftwitch-chatbot/lists"}