{"id":18637513,"url":"https://github.com/dutchcoders/slackbot","last_synced_at":"2025-10-26T11:33:21.923Z","repository":{"id":28064933,"uuid":"31561830","full_name":"dutchcoders/slackbot","owner":"dutchcoders","description":"Slackbot implementation library for Go. Easy creation of new SlashCommands and Bots.","archived":false,"fork":false,"pushed_at":"2015-05-21T06:50:10.000Z","size":184,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T12:12:55.965Z","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/dutchcoders.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":"2015-03-02T20:36:25.000Z","updated_at":"2024-08-12T19:16:27.000Z","dependencies_parsed_at":"2022-09-19T05:31:14.760Z","dependency_job_id":null,"html_url":"https://github.com/dutchcoders/slackbot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dutchcoders%2Fslackbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dutchcoders%2Fslackbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dutchcoders%2Fslackbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dutchcoders%2Fslackbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dutchcoders","download_url":"https://codeload.github.com/dutchcoders/slackbot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248368345,"owners_count":21092342,"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-11-07T05:36:32.216Z","updated_at":"2025-10-26T11:33:16.906Z","avatar_url":"https://github.com/dutchcoders.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# slackbot\nSlackbot implementation library for Go. Easy creation of new SlackCommands and Bots.\n\n```\npackage main\n\nimport (\n    \"errors\"\n    \"log\"\n    \"math/rand\"\n    \"os\"\n    \"strings\"\n    \"sync\"\n    \"time\"\n\n    slackbot \"github.com/dutchcoders/slackbot\"\n    \"github.com/nlopes/slack\"\n)\n\nfunc main() {\n    engine := slackbot.NewEngine(slackbot.Config{\n        PayloadToken: os.Getenv(\"SLACK_PAYLOAD_TOKEN\"),\n    })\n\n    engine.AddCommand(\"/pick\", pick)\n\n    go func() {\n        bot, err := slackbot.NewBot(slackbot.Config{\n            Token:  os.Getenv(\"SLACK_TOKEN\"),\n            Origin: \"http://localhost\",\n        })\n\n        if err != nil {\n            log.Println(err)\n            return\n        }\n\n        bot.SetMessageHandler(func(b *slackbot.Bot, message *slackbot.Message) error {\n            log.Println(message.Text)\n            return nil\n        })\n\n        err = bot.Run()\n        if err != nil {\n            log.Println(err)\n        }\n    }()\n\n    addr := \":\" + os.Getenv(\"PORT\")\n    if err := engine.ListenAndServe(addr); err != nil {\n        panic(err)\n    }\n\n}\n\nfunc pick(sc *slackbot.Context, w http.ResponseWriter) {\n    choices := strings.Split(sc.Text, \",\")\n    choice := choices[rand.Intn(len(choices))]\n    choice = strings.Trim(choice, \" \")\n    fmt.Fprintf(w, \"Hmmm, I'd say pick %s.\", choice)\n}\n```\n\n## Testing\n\n```\ncurl -X POST --data \"text=test\u0026trigger_word={word}\u0026command={/command}\" http://127.0.0.1:5100/\n```\n\n## Contributions\n\nContributions are welcome.\n\n## Creators\n\n**Remco Verhoef**\n- \u003chttps://twitter.com/remco_verhoef\u003e\n- \u003chttps://twitter.com/dutchcoders\u003e\n\n## Copyright and license\n\nCode and documentation copyright 2011-2014 Remco Verhoef.\nCode released under [the MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdutchcoders%2Fslackbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdutchcoders%2Fslackbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdutchcoders%2Fslackbot/lists"}