{"id":24956854,"url":"https://github.com/andrewstuart/slot","last_synced_at":"2025-03-28T20:38:07.518Z","repository":{"id":57480255,"uuid":"110929838","full_name":"andrewstuart/slot","owner":"andrewstuart","description":"Slot is a golang slack bot library for simplifying common slack bot use cases","archived":false,"fork":false,"pushed_at":"2017-11-16T16:09:22.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-03T06:41:55.932Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrewstuart.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":"2017-11-16T05:59:35.000Z","updated_at":"2017-11-16T05:59:49.000Z","dependencies_parsed_at":"2022-09-26T17:41:38.975Z","dependency_job_id":null,"html_url":"https://github.com/andrewstuart/slot","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/andrewstuart%2Fslot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewstuart%2Fslot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewstuart%2Fslot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewstuart%2Fslot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewstuart","download_url":"https://codeload.github.com/andrewstuart/slot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246100418,"owners_count":20723466,"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":"2025-02-03T06:41:24.890Z","updated_at":"2025-03-28T20:38:07.491Z","avatar_url":"https://github.com/andrewstuart.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GoDoc](https://godoc.org/astuart.co/slot?status.svg)](https://godoc.org/astuart.co/slot)\n[![Build Status](https://travis-ci.org/andrewstuart/slot.svg?branch=master)](https://travis-ci.org/andrewstuart/slot)\n[![Coverage Status](https://coveralls.io/repos/github/andrewstuart/slot/badge.svg?branch=master)](https://coveralls.io/github/andrewstuart/slot?branch=master)\n[![Go Report Card](https://goreportcard.com/badge/astuart.co/slot)](https://goreportcard.com/report/astuart.co/slot)\n\n# slot\n--\n    import \"astuart.co/slot\"\n\npackage slot gives some helpful abstractions over the nlopes/slack RTM\nintegrations. Most use cases are intended to be made easier. The common bot\nresponse abstraction is the Responder. Many implementations will be created to\nassist in most of the common bot use cases.\n\n## Usage\n\n#### func  GetAction\n\n```go\nfunc GetAction(ev *slack.MessageEvent) string\n```\nGetAction takes an event and returns either the empty string, or the first\n!action string in the message text.\n\n#### func  MaybeRespond\n\n```go\nfunc MaybeRespond(r *slack.RTM, ev *slack.MessageEvent, res Responder) error\n```\nMaybeRespond checks if a Responder is a MatchResponder and conditionally exits\nif there is no match.\n\n#### type ActionMap\n\n```go\ntype ActionMap map[string]Responder\n```\n\nActionMap holds action words and responders, calling the appropriate responder\nwhen an !action message is received.\n\n#### func (ActionMap) Match\n\n```go\nfunc (m ActionMap) Match(r *slack.RTM, ev *slack.MessageEvent) bool\n```\nMatch implements MatchResponder for efficiency\n\n#### func (ActionMap) Respond\n\n```go\nfunc (m ActionMap) Respond(r *slack.RTM, ev *slack.MessageEvent) error\n```\nRespond implements Responder\n\n#### type Bot\n\n```go\ntype Bot struct {\n\tResponders []Responder\n}\n```\n\nA Bot handles a client\n\n#### func (*Bot) Handle\n\n```go\nfunc (b *Bot) Handle(cli *slack.Client) error\n```\nHandle manages an RTM based on the configured Handlers\n\n#### type BotMentionAction\n\n```go\ntype BotMentionAction struct {\n\tFollowingText string\n\tResponder     Responder\n}\n```\n\nBotMentionAction executes a responder if the bot's name is @mentioned\n\n#### func (*BotMentionAction) Match\n\n```go\nfunc (b *BotMentionAction) Match(rtm *slack.RTM, ev *slack.MessageEvent) bool\n```\nMatch implements MatchResponder\n\n#### func (*BotMentionAction) Respond\n\n```go\nfunc (b *BotMentionAction) Respond(rtm *slack.RTM, ev *slack.MessageEvent) error\n```\nRespond implements Responder\n\n#### type MatchResponder\n\n```go\ntype MatchResponder interface {\n\tResponder\n\tMatch(*slack.RTM, *slack.MessageEvent) bool\n}\n```\n\nA MatchResponder conditionally acts on a message\n\n#### type RegexResponder\n\n```go\ntype RegexResponder struct {\n\tRegexp    *regexp.Regexp\n\tResponder Responder\n}\n```\n\nRegexResponder matches a regex against an incoming string and executes a\nresponse if a match occurred\n\n#### func (*RegexResponder) Match\n\n```go\nfunc (r *RegexResponder) Match(rtm *slack.RTM, ev *slack.MessageEvent) bool\n```\nMatch implements MatchResponder\n\n#### func (*RegexResponder) Respond\n\n```go\nfunc (r *RegexResponder) Respond(rtm *slack.RTM, ev *slack.MessageEvent) error\n```\nRespond implements Responder\n\n#### type Responder\n\n```go\ntype Responder interface {\n\tRespond(*slack.RTM, *slack.MessageEvent) error\n}\n```\n\nA Responder handles an event\n\n#### type ResponderFunc\n\n```go\ntype ResponderFunc func(*slack.RTM, *slack.MessageEvent) error\n```\n\nAn ResponderFunc is a function that can respond to a slack event\n\n#### func (ResponderFunc) Respond\n\n```go\nfunc (f ResponderFunc) Respond(r *slack.RTM, ev *slack.MessageEvent) error\n```\nRespond implements Responder.\n\n#### type StringFuncResponder\n\n```go\ntype StringFuncResponder func() string\n```\n\nStringFuncResponder always responds with the result of calling the function\n\n#### func (StringFuncResponder) Respond\n\n```go\nfunc (s StringFuncResponder) Respond(r *slack.RTM, ev *slack.MessageEvent) error\n```\nRespond implements Responder\n\n#### type TextResponder\n\n```go\ntype TextResponder string\n```\n\nTextResponder always responds with a string\n\n#### func (TextResponder) Respond\n\n```go\nfunc (p TextResponder) Respond(r *slack.RTM, ev *slack.MessageEvent) error\n```\nRespond implements Responder\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewstuart%2Fslot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewstuart%2Fslot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewstuart%2Fslot/lists"}