{"id":13409245,"url":"https://github.com/go-chat-bot/bot","last_synced_at":"2025-03-14T14:31:04.989Z","repository":{"id":44744784,"uuid":"42946991","full_name":"go-chat-bot/bot","owner":"go-chat-bot","description":"IRC, Slack, Telegram and RocketChat bot written in go","archived":true,"fork":false,"pushed_at":"2024-03-11T17:26:22.000Z","size":372,"stargazers_count":826,"open_issues_count":12,"forks_count":194,"subscribers_count":49,"default_branch":"master","last_synced_at":"2024-10-25T05:23:28.887Z","etag":null,"topics":[],"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/go-chat-bot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2015-09-22T16:41:13.000Z","updated_at":"2024-10-16T10:34:31.000Z","dependencies_parsed_at":"2024-01-08T14:30:44.695Z","dependency_job_id":"66522f15-2419-4ff0-9790-40601281cb02","html_url":"https://github.com/go-chat-bot/bot","commit_stats":{"total_commits":291,"total_committers":34,"mean_commits":8.558823529411764,"dds":"0.31958762886597936","last_synced_commit":"71bc1bfb492cec9afcf0aeb2f92170cec0d13d1e"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-chat-bot%2Fbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-chat-bot%2Fbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-chat-bot%2Fbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-chat-bot%2Fbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-chat-bot","download_url":"https://codeload.github.com/go-chat-bot/bot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243593325,"owners_count":20316166,"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":[],"created_at":"2024-07-30T20:00:59.190Z","updated_at":"2025-03-14T14:31:04.960Z","avatar_url":"https://github.com/go-chat-bot.png","language":"Go","readme":"# go-bot\n\n[![Circle CI](https://circleci.com/gh/go-chat-bot/bot/tree/master.svg?style=svg)](https://circleci.com/gh/go-chat-bot/bot/tree/master) [![GoDoc](https://godoc.org/github.com/go-chat-bot/bot?status.png)](https://godoc.org/github.com/go-chat-bot/bot) [![Coverage Status](https://coveralls.io/repos/github/go-chat-bot/bot/badge.svg?branch=master)](https://coveralls.io/github/go-chat-bot/bot?branch=master) ![Go report](https://goreportcard.com/badge/github.com/go-chat-bot/bot) [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)\n\nIRC, Slack \u0026 Telegram bot written in [Go][go] using [go-ircevent][go-ircevent] for IRC connectivity, [nlopes/slack](https://github.com/nlopes/slack) for Slack and [Syfaro/telegram-bot-api](https://github.com/Syfaro/telegram-bot-api) for Telegram.\n\n![2016-01-17 11 21 38 036](https://cloud.githubusercontent.com/assets/1084729/12377689/5bf7d5f2-bd0d-11e5-87d9-525481f01c3a.gif)\n\n## Plugins\n\nPlease see the [plugins repository](https://github.com/go-chat-bot/plugins) for a complete list of plugins.\n\nYou can also write your own, it's really simple.\n\n## Compiling and testing the bot and plugins (Debug)\n\nThis project uses the new [Go 1.11 modules](https://github.com/golang/go/wiki/Modules) if you have Go 1.11 installed, just clone the project and follow the instructions bellow, when you build Go will automatically download all dependencies.\n\nTo test the bot, use the [debug](https://github.com/go-chat-bot/bot/tree/master/debug) console app.\n\n- Clone this repository or use `go get github.com/go-chat-bot/bot`\n- Build everything: `go build ./...`\n- Build and execute the debug app:\n  -  `cd debug`\n  -  `go build`\n  -  `./debug`\n- This will open a console where you can type commands\n- Type `!help` to see the list of available commands\n\n### Testing your plugin\n\n- Add your plugin to `debug/main.go` import list\n- Build the debug app\n- Execute it and test with the interactive console\n\n## Protocols\n\n### Slack\n\nTo deploy your go-bot to Slack, you need to:\n\n* [Create a new bot user](https://my.slack.com/services/new/bot) integration on Slack and get your token\n* Import the package `github.com/go-chat-bot/bot/slack`\n* Import the commands you would like to use\n* Call `slack.Run(token)`\n\nHere is a full example reading the Slack token from the `SLACK_TOKEN` env var:\n\n```Go\npackage main\n\nimport (\n    \"os\"\n\n    \"github.com/go-chat-bot/bot/slack\"\n    _ \"github.com/go-chat-bot/plugins/catfacts\"\n    _ \"github.com/go-chat-bot/plugins/catgif\"\n    _ \"github.com/go-chat-bot/plugins/chucknorris\"\n    // Import all the commands you wish to use\n)\n\nfunc main() {\n    slack.Run(os.Getenv(\"SLACK_TOKEN\"))\n}\n```\n\n### IRC\n\nTo deploy your own go-bot to IRC, you need to:\n\n* Import the package `github.com/go-chat-bot/bot/irc`\n* Import the commands you would like to use\n* Fill the Config struct\n* Call `irc.Run(config)`\n\nHere is a full example:\n```Go\npackage main\n\nimport (\n\t\"github.com/go-chat-bot/bot/irc\"\n\t_ \"github.com/go-chat-bot/plugins/catfacts\"\n\t_ \"github.com/go-chat-bot/plugins/catgif\"\n\t_ \"github.com/go-chat-bot/plugins/chucknorris\"\n\t// Import all the commands you wish to use\n\t\"os\"\n\t\"strings\"\n)\n\nfunc main() {\n\tirc.Run(\u0026irc.Config{\n\t\tServer:   os.Getenv(\"IRC_SERVER\"),\n\t\tChannels: strings.Split(os.Getenv(\"IRC_CHANNELS\"), \",\"),\n\t\tUser:     os.Getenv(\"IRC_USER\"),\n\t\tNick:     os.Getenv(\"IRC_NICK\"),\n\t\tPassword: os.Getenv(\"IRC_PASSWORD\"),\n\t\tUseTLS:   true,\n\t\tDebug:    os.Getenv(\"DEBUG\") != \"\",})\n}\n```\n\nTo join channels with passwords just put the password after the channel name separated by a space:\n\n    Channels: []string{\"#mychannel mypassword\", \"#go-bot\"}\n\n### Telegram\n\nTo deploy your go-bot to Telegram, you need to:\n\n* Follow Telegram instructions to [create a new bot user](https://core.telegram.org/bots#3-how-do-i-create-a-bot) and get your token\n* Import the package `github.com/go-chat-bot/bot/telegram`\n* Import the commands you would like to use\n* Call `telegram.Run(token, debug)`\n\nHere is a full example reading the telegram token from the `TELEGRAM_TOKEN` env var:\n\n```Go\npackage main\n\nimport (\n    \"os\"\n\n    \"github.com/go-chat-bot/bot/telegram\"\n    _ \"github.com/go-chat-bot/plugins/catfacts\"\n    _ \"github.com/go-chat-bot/plugins/catgif\"\n    _ \"github.com/go-chat-bot/plugins/chucknorris\"\n    // Import all the commands you wish to use\n)\n\nfunc main() {\n    telegram.Run(os.Getenv(\"TELEGRAM_TOKEN\"), os.Getenv(\"DEBUG\") != \"\")\n}\n```\n\n### Rocket.chat\n\nTo deploy your go-bot to Rocket.chat, you need to:\n\n* Import the package `github.com/go-chat-bot/bot/rocket`\n* Import the commands you would like to use\n* Call `rocket.Run(config)`\n\nHere is a full example:\n\n```Go\npackage main\n\nimport (\n\t\"os\"\n\n\t\"github.com/go-chat-bot/bot/rocket\"\n\t_ \"github.com/go-chat-bot/plugins/godoc\"\n\t_ \"github.com/go-chat-bot/plugins/catfacts\"\n\t_ \"github.com/go-chat-bot/plugins/catgif\"\n\t_ \"github.com/go-chat-bot/plugins/chucknorris\"\n)\n\nfunc main() {\n\tconfig := \u0026rocket.Config{\n\t\tServer:   os.Getenv(\"ROCKET_SERVER\"),\n\t\tPort:     os.Getenv(\"ROCKET_PORT\"),\n\t\tUser:     os.Getenv(\"ROCKET_USER\"),\n\t\tEmail:    os.Getenv(\"ROCKET_EMAIL\"),\n\t\tPassword: os.Getenv(\"ROCKET_PASSWORD\"),\n\t\tUseTLS:   false,\n\t\tDebug:    os.Getenv(\"DEBUG\") != \"\",\n\t}\n\trocket.Run(config)\n}\n```\n\n### Google Chat\n\nTo deploy your go-bot to Google Chat (also known as Hangouts Chat, not plain\nHangouts) you will first need to follow documentation to [setup pub/sub\nproject](https://developers.google.com/hangouts/chat/how-tos/pub-sub) in Google\nCloud. This will enable your bot to receive messages even when it is behind a\nfirewall.\n\nCondensed, the steps you will need to take are as follows:\n* Create new project in google cloud console\n  * ID of the project will be used in Config.PubSubProject\n* Create service credentials for this project\n  * Path to downloaded credentials file should be in env variable GOOGLE_APPLICATION_CREDENTIALS\n  * Choose \"Pub/Sub Editor\" role for the credential\n* Enable Pub/Sub API in cloud console\n* Create new topic in the Pub/Sub (say \"google-chat\")\n  * Use the value of \"Topic Name\" (**not** \"Topic ID\") for Config.TopicName (e.g. /project/\u003cproj_name\u003e/topics/\u003ctopic_name\u003e)\n* Modify permissions on created topic so that\n  \"chat-api-push@system.gserviceaccount.com\" has Pub/Sub Publisher permissions\n* Enable hangouts chat api in Cloud Console\n* Go to hangouts chat API config in the Cloud Console and fill in info\n  * Connection settings - use Pub/Sub and fill in topic string you created\n    above\n\nConfig.SubscriptionName should be unique for each environment or you'll not\nprocess messages correctly. If you encounter issues make sure your credentials\nare correct and permissions for topics/queues are set up correctly.\n\nConfig.WelcomeMessage is sent each time the bot joins a new room or private chat.\n\nFull example is here:\n```Go\npackage main\n\nimport (\n\t\"os\"\n\n\t\"github.com/go-chat-bot/bot/google-chat\"\n\t_ \"github.com/go-chat-bot/plugins/godoc\"\n\t_ \"github.com/go-chat-bot/plugins/catfacts\"\n\t_ \"github.com/go-chat-bot/plugins/catgif\"\n\t_ \"github.com/go-chat-bot/plugins/chucknorris\"\n)\n\nfunc main() {\n\tgooglechat.Run(\u0026googlechat.Config{\n\t\tPubSubProject:    os.Getenv(\"HANGOUTS_PROJECT\"),\n\t\tTopicName:        os.Getenv(\"HANGOUTS_TOPIC\"),\n\t\tSubscriptionName: os.Getenv(\"HANGOUTS_SUB\"),\n\t\tWelcomeMessage:   os.Getenv(\"HANGOUTS_WELCOME\"),\n}\n\n```\n\n## Deploying your own bot\n\nTo see an example project on how to deploy your bot, please see my own configuration:\n\n- **IRC**: https://github.com/fabioxgn/go-bot-heroku\n- **Slack**: https://github.com/fabioxgn/go-bot-slack\n\n[go]: http://golang.org\n[go-ircevent]: https://github.com/thoj/go-ircevent\n[slack]: http://slack.com\n[giphy.com]: http://giphy.com\n[thecatapi.com]: http://thecatapi.com\n","funding_links":[],"categories":["Bot Building","Miscellaneous","Bot建设","Uncategorized","机器人相关` 构建和使用机器人的库`","\u003cspan id=\"其他-miscellaneous\"\u003e其他 Miscellaneous\u003c/span\u003e","机器人开发库","杂项","其他","Chat Bots","Go","机器人相关","Intermediário"],"sub_categories":["Advanced Console UIs","Contents","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","最常用的工具","Free e-books","交流"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-chat-bot%2Fbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-chat-bot%2Fbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-chat-bot%2Fbot/lists"}