{"id":45533408,"url":"https://github.com/gadget-bot/gadget","last_synced_at":"2026-02-23T01:30:32.373Z","repository":{"id":45254023,"uuid":"369599284","full_name":"gadget-bot/gadget","owner":"gadget-bot","description":"Gadget is a Golang bot for Slack's Events API","archived":false,"fork":false,"pushed_at":"2021-12-27T20:35:49.000Z","size":107,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2023-07-27T22:07:38.430Z","etag":null,"topics":["framework","golang","slack","slack-bot"],"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/gadget-bot.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}},"created_at":"2021-05-21T16:50:03.000Z","updated_at":"2021-12-27T20:41:49.000Z","dependencies_parsed_at":"2022-08-25T00:21:54.137Z","dependency_job_id":null,"html_url":"https://github.com/gadget-bot/gadget","commit_stats":null,"previous_names":[],"tags_count":6,"template":null,"template_full_name":null,"purl":"pkg:github/gadget-bot/gadget","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gadget-bot%2Fgadget","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gadget-bot%2Fgadget/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gadget-bot%2Fgadget/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gadget-bot%2Fgadget/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gadget-bot","download_url":"https://codeload.github.com/gadget-bot/gadget/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gadget-bot%2Fgadget/sbom","scorecard":{"id":416855,"data":{"date":"2025-08-11","repo":{"name":"github.com/gadget-bot/gadget","commit":"c72bd5f0ba45cdab0459329ad9bb3d971dcdcbdd"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":4,"reason":"Found 8/18 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: containerImage not pinned by hash: Dockerfile:1","Warn: containerImage not pinned by hash: Dockerfile:11: pin your Docker image by updating alpine to alpine@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1","Info:   0 out of   2 containerImage dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 22 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T00:08:57.219Z","repository_id":45254023,"created_at":"2025-08-19T00:08:57.219Z","updated_at":"2025-08-19T00:08:57.219Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29734468,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T20:09:16.275Z","status":"ssl_error","status_checked_at":"2026-02-22T20:09:13.750Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["framework","golang","slack","slack-bot"],"created_at":"2026-02-23T01:30:30.796Z","updated_at":"2026-02-23T01:30:32.363Z","avatar_url":"https://github.com/gadget-bot.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gadget\n\nGadget is a [Golang](https://golang.org/) bot for Slack's [Events API](https://api.slack.com/events). The concepts in Gadget are heavily inspired by [Lita](https://www.lita.io/) in that it contains support for Regular Expression-based _routing_ of requests to plugins, it supports permissions based on groups managed via the bot, and it uses a DB for persisting these details.\n\nGadget makes use of [Goroutines](https://golangbot.com/goroutines/) to support many users and to respond quickly, but it can also be scaled out as needed. For persistence, Gadget uses [GORM](https://gorm.io/) but it only supports [MySQL](https://www.mysql.com/) (and MySQL-compatible RDBMS's like [MariaDB](https://mariadb.org/)).\n\nNote that Gadget is still very much a **work in progress**, so please don't use it in production yet (or if you do, don't complain).\n\n## Why Gadget?\n\nWhy not just use [slack-go/slack](https://github.com/slack-go/slack) or some other Golang Slack client? There don't seem to be many (maybe even _any_) good, full-featured frameworks for building bots in Golang. It's true, [slack-go/slack](https://github.com/slack-go/slack) is great. So great, in fact, that Gadget _uses_ it for talking to Slack. What [slack-go/slack](https://github.com/slack-go/slack) (and other projects, it seems) are lacking are the built-in features like permissions, a simple plugin-based approach to adding capabilities, and intuitive support for persisting data.\n\nHaving a ChatBot is great, but sometimes you don't want everyone to be able to do everything. Being able to restrict certain capabilities in a straightforward way is a pretty important feature and seemed worth developing. It is also really handy to simplify making a bot, cutting out all the boiler-plate. Gadget is meant to solve these problems; making a bot that you can talk to is made very simple so you can get to work writing features.\n\n## Building Gadget\n\nJust run `make`. Builds are placed in `./dist`. Use `make help` to get a list of all targets.\n\n## Building your own Bot\n\nHere is what your bot's `main.go` should look like:\n\n```golang\npackage main\n\nimport (\n\t\"os\"\n\n\tgadget \"github.com/gadget-bot/gadget/core\"\n\t\"github.com/gadget-bot/gadget/plugins/how\"\n)\n\nfunc main() {\n\tmyBot, err := gadget.Setup()\n\tif err != nil {\n\t\tos.Exit(1)\n\t}\n\n\t// Add your custom mention plugins here\n  \n\t// Add a single Route\n\tmyBot.Router.AddMentionRoute(*myPlugin.SomeFunction())\n\t// Add a slice of Routes\n\tmyBot.Router.AddMentionRoutes(myPlugin.GetMentionRoutes())\n\n\t// This launches your bot\n\tmyBot.Run()\n}\n```\n\n## Writing a Plugin\n\nGadget is built around specialized plugins called `Routes`. A Route **must** provide:\n\n* a `Pattern` (a `string` that can be parsed as a `regexp.Regexp`) that defines when it should be called\n* a `Name` (a unique `string`) that is used for logging\n* a `Plugin`, which is the meat of what the Route should do when called. It needs to return a function, but this depends on which type of `Route` is being written. For normal `MentionRoute`s, the returned function must look something like:\n```golang\nfunc(api slack.Client, router router.Router, ev slackevents.AppMentionEvent, message string) {\n  // ... do something awesome here ...\n}\n```\n\nA `Route` can optionally provide:\n\n* a `Permissions` list (of type `[]string`) that provides a list of `Group`s that can use the `Route`. If that list is empty, not provided, or includes `\"*\"`, it will allow all users.\n* a `Help` (of type `string`) that explains how to access the `Route`\n* a `Description` (of type `string`) to describe what the `Route` does\n* a `Priority` (of type `int`) to inform Gadget's `Router` which `Route` to choose when more than one match (higher `Priority` wins)\n\nLet's work on a simple example:\n\n```golang\npackage dice\n\nimport (\n\t\"fmt\"\n\t\"math/rand\"\n\n\t\"github.com/gadget-bot/gadget/router\"\n\n\t\"github.com/slack-go/slack\"\n\t\"github.com/slack-go/slack/slackevents\"\n)\n\nfunc rollD6() *router.MentionRoute {\n\tvar pluginRoute router.MentionRoute\n\tpluginRoute.Permissions = append(pluginRoute.Permissions, \"*\")\n\tpluginRoute.Name = \"dice.rollD6\"\n\tpluginRoute.Help = \"roll some dice\"\n\tpluginRoute.Description = \"Rolls two d6 dice\"\n\tpluginRoute.Pattern = `(?i)^roll some dice[!.]?$`\n\n\t// Here is where we define what we want this plugin to do\n\tpluginRoute.Plugin = func(router router.Router, route router.Route , api slack.Client, ev slackevents.AppMentionEvent, message string) {\n\t\t// Here's how we can react to the message\n\t\tmsgRef := slack.NewRefToMessage(ev.Channel, ev.TimeStamp)\n\t\tapi.AddReaction(\"game_die\", msgRef)\n\n\t\t// Roll some virtual dice\n\t\tdice := []int{1, 2, 3, 4, 5, 6}\n\t\trollIndex1 := rand.Intn(len(dice))\n\t\trollIndex2 := rand.Intn(len(dice))\n\t\troll1 := dice[rollIndex1]\n\t\troll2 := dice[rollIndex2]\n\n\t\t// Here's how we send a reply\n\t\tapi.PostMessage(\n\t\t\tev.Channel,\n\t\t\tslack.MsgOptionText(\n\t\t\t\tfmt.Sprintf(\"\u003c@%s\u003e rolled a %d and a %d\", ev.User, roll1, roll2),\n\t\t\t\tfalse,\n\t\t\t),\n\t\t)\n\t}\n\n\t// We've got to return the MentionRoute\n\treturn \u0026pluginRoute\n}\n\n// This function is used to retrieve all Mention Routes from this plugin\nfunc GetMentionRoutes() []router.MentionRoute {\n\treturn []router.MentionRoute{\n\t\t*rollD6(),\n\t}\n}\n```\n\nFrom there, we can just extend the `main.go` above, changing the `func main()` to look like this:\n\n```golang\nfunc main() {\n\tmyBot, err := gadget.Setup()\n\tif err != nil {\n\t\tos.Exit(1)\n\t}\n\n\t// Add your custom mention plugins here\n  \n\t// Add a slice of Routes\n\tmyBot.Router.AddMentionRoutes(dice.GetMentionRoutes())\n\n\t// This launches your bot\n\tmyBot.Run()\n}\n```\n\nThat's it! The above actually _is_ a real plugin and lives in its [own repo](https://github.com/gadget-bot/gadget-plugin-dice). PRs welcome!\n\n## Starting a Demo\n\nIf you just want to try Gadget out, you can use the `main.go` in this repo like this:\n\n```sh\n#!/bin/sh\n\n# These users are global admins for Gadget\nexport GADGET_GLOBAL_ADMINS=\"U0.....,U1.....\"\n# These two variables are for connecting to Slack\nexport SLACK_OAUTH_TOKEN=\"xoxb-....\"\nexport SLACK_SIGNING_SECRET=\"a...a\"\n# DB Connection details\nexport GADGET_DB_USER=\"gadgetuser\"\nexport GADGET_DB_PASS=\"secretpassword\"\nexport GADGET_DB_HOST=\"127.0.0.1:3306\"\nexport GADGET_DB_NAME=\"gadget_dev\"\n# The port Gadget's webhook server listens on\nexport GADGET_LISTEN_PORT=\"3000\"\n\ngo run .\n```\n\nGadget will be listening on port 3000. You can use something like [`ngrok`](https://ngrok.com/) to expose Gadget in a way that you can configure Slack to talk to it. Note that it won't do much... Gadget's built-in plugins are pretty simple. This is really meant to be the core of your own bot that combines [plugins from other repos](https://github.com/search?q=org%3Agadget-bot+gadget-plugin-) (maybe even some of your own).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgadget-bot%2Fgadget","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgadget-bot%2Fgadget","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgadget-bot%2Fgadget/lists"}