From 4fa5829f2c95efff5170d0ed9ed62cd1995da236 Mon Sep 17 00:00:00 2001 From: Valerian Saliou Date: Thu, 19 Aug 2021 16:45:08 +0200 Subject: [PATCH 1/8] Fix path --- CHANGELOG.md | 34 ++++++++++----------- README.md | 14 ++++----- block_object.go | 2 +- chat.go | 2 +- errors.go | 2 +- examples/blocks/blocks.go | 2 +- examples/buttons/buttons.go | 2 +- examples/connparams/connparams.go | 2 +- examples/dialog/dialog.go | 2 +- examples/eventsapi/events.go | 4 +-- examples/files/files.go | 2 +- examples/messages/messages.go | 2 +- examples/modal/modal.go | 4 +-- examples/modal_users/users.go | 2 +- examples/pins/pins.go | 2 +- examples/reactions/reactions.go | 2 +- examples/slash/slash.go | 2 +- examples/socketmode/socketmode.go | 6 ++-- examples/stars/stars.go | 2 +- examples/team/team.go | 2 +- examples/users/users.go | 2 +- examples/webhooks/webhooks.go | 4 +-- examples/websocket/websocket.go | 2 +- examples/websocket_respond/respond.go | 2 +- go.mod | 2 +- interactions.go | 2 +- misc.go | 2 +- misc_test.go | 4 +-- slackevents/action_events.go | 2 +- slackevents/inner_events.go | 2 +- slackevents/parsers.go | 2 +- slackevents/parsers_test.go | 2 +- slacktest/data.go | 2 +- slacktest/errors.go | 2 +- slacktest/funcs.go | 2 +- slacktest/handlers.go | 2 +- slacktest/handlers_test.go | 2 +- slacktest/rtm_test.go | 2 +- slacktest/server.go | 2 +- slacktest/server_test.go | 2 +- slacktest/types.go | 2 +- socketmode/client.go | 2 +- socketmode/socket_mode_managed_conn.go | 10 +++--- socketmode/socket_mode_managed_conn_test.go | 4 +-- socketmode/socketmode.go | 2 +- socketmode/socketmode_test.go | 2 +- users.go | 4 +-- views_test.go | 2 +- websocket_managed_conn.go | 8 ++--- websocket_managed_conn_test.go | 4 +-- 50 files changed, 88 insertions(+), 88 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32da687bb..c112f0313 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,23 +24,23 @@ Thank you for many contributions! - doc: Add logo to README ([#813]) - doc: Update current project status and Add changelog for v0.7.0 ([#814]) -[#753]: https://github.com/slack-go/slack/pull/753 -[#755]: https://github.com/slack-go/slack/pull/755 -[#772]: https://github.com/slack-go/slack/pull/772 -[#773]: https://github.com/slack-go/slack/pull/773 -[#778]: https://github.com/slack-go/slack/pull/778 -[#779]: https://github.com/slack-go/slack/pull/779 -[#782]: https://github.com/slack-go/slack/pull/782 -[#783]: https://github.com/slack-go/slack/pull/783 -[#787]: https://github.com/slack-go/slack/pull/787 -[#790]: https://github.com/slack-go/slack/pull/790 -[#791]: https://github.com/slack-go/slack/pull/791 -[#793]: https://github.com/slack-go/slack/pull/793 -[#794]: https://github.com/slack-go/slack/pull/794 -[#800]: https://github.com/slack-go/slack/pull/800 -[#810]: https://github.com/slack-go/slack/pull/810 -[#813]: https://github.com/slack-go/slack/pull/813 -[#814]: https://github.com/slack-go/slack/pull/814 +[#753]: https://github.com/crisp-dev/slack/pull/753 +[#755]: https://github.com/crisp-dev/slack/pull/755 +[#772]: https://github.com/crisp-dev/slack/pull/772 +[#773]: https://github.com/crisp-dev/slack/pull/773 +[#778]: https://github.com/crisp-dev/slack/pull/778 +[#779]: https://github.com/crisp-dev/slack/pull/779 +[#782]: https://github.com/crisp-dev/slack/pull/782 +[#783]: https://github.com/crisp-dev/slack/pull/783 +[#787]: https://github.com/crisp-dev/slack/pull/787 +[#790]: https://github.com/crisp-dev/slack/pull/790 +[#791]: https://github.com/crisp-dev/slack/pull/791 +[#793]: https://github.com/crisp-dev/slack/pull/793 +[#794]: https://github.com/crisp-dev/slack/pull/794 +[#800]: https://github.com/crisp-dev/slack/pull/800 +[#810]: https://github.com/crisp-dev/slack/pull/810 +[#813]: https://github.com/crisp-dev/slack/pull/813 +[#814]: https://github.com/crisp-dev/slack/pull/814 ### v0.6.0 - August 31, 2019 full differences can be viewed using `git log --oneline --decorate --color v0.5.0..v0.6.0` diff --git a/README.md b/README.md index dc83eaa81..f24f42adb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Slack API in Go [![Go Reference](https://pkg.go.dev/badge/github.com/slack-go/slack.svg)](https://pkg.go.dev/github.com/slack-go/slack) +Slack API in Go [![Go Reference](https://pkg.go.dev/badge/github.com/crisp-dev/slack.svg)](https://pkg.go.dev/github.com/crisp-dev/slack) =============== This is the original Slack library for Go created by Norberto Lopes, transferred to a Github organization. @@ -15,13 +15,13 @@ a fully managed way. There is currently no major version released. Therefore, minor version releases may include backward incompatible changes. -See [CHANGELOG.md](https://github.com/slack-go/slack/blob/master/CHANGELOG.md) or [Releases](https://github.com/slack-go/slack/releases) for more information about the changes. +See [CHANGELOG.md](https://github.com/crisp-dev/slack/blob/master/CHANGELOG.md) or [Releases](https://github.com/crisp-dev/slack/releases) for more information about the changes. ## Installing ### *go get* - $ go get -u github.com/slack-go/slack + $ go get -u github.com/crisp-dev/slack ## Example @@ -31,7 +31,7 @@ See [CHANGELOG.md](https://github.com/slack-go/slack/blob/master/CHANGELOG.md) o import ( "fmt" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) func main() { @@ -56,7 +56,7 @@ func main() { import ( "fmt" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) func main() { @@ -72,12 +72,12 @@ func main() { ## Minimal RTM usage: -See https://github.com/slack-go/slack/blob/master/examples/websocket/websocket.go +See https://github.com/crisp-dev/slack/blob/master/examples/websocket/websocket.go ## Minimal EventsAPI usage: -See https://github.com/slack-go/slack/blob/master/examples/eventsapi/events.go +See https://github.com/crisp-dev/slack/blob/master/examples/eventsapi/events.go ## Contributing diff --git a/block_object.go b/block_object.go index 5ced7f92a..ed61ac566 100644 --- a/block_object.go +++ b/block_object.go @@ -142,7 +142,7 @@ func (s TextBlockObject) Validate() error { return errors.New("type must be either of plain_text or mrkdwn") } - // https://github.com/slack-go/slack/issues/881 + // https://github.com/crisp-dev/slack/issues/881 if s.Type == "mrkdwn" && s.Emoji { return errors.New("emoji cannot be true in mrkdown") } diff --git a/chat.go b/chat.go index 2a1e452ef..8b07cdfee 100644 --- a/chat.go +++ b/chat.go @@ -9,7 +9,7 @@ import ( "net/url" "strconv" - "github.com/slack-go/slack/slackutilsx" + "github.com/crisp-dev/slack/slackutilsx" ) const ( diff --git a/errors.go b/errors.go index 8be22a659..9d7b57cf5 100644 --- a/errors.go +++ b/errors.go @@ -1,6 +1,6 @@ package slack -import "github.com/slack-go/slack/internal/errorsx" +import "github.com/crisp-dev/slack/internal/errorsx" // Errors returned by various methods. const ( diff --git a/examples/blocks/blocks.go b/examples/blocks/blocks.go index 28d54d141..f191e0fd1 100644 --- a/examples/blocks/blocks.go +++ b/examples/blocks/blocks.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) // The functions below mock the different templates slack has as examples on their website. diff --git a/examples/buttons/buttons.go b/examples/buttons/buttons.go index 82772faa1..b5cbba8fd 100644 --- a/examples/buttons/buttons.go +++ b/examples/buttons/buttons.go @@ -6,7 +6,7 @@ import ( "net/http" "os" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) func main() { diff --git a/examples/connparams/connparams.go b/examples/connparams/connparams.go index 2bf2dce1d..2152743bc 100644 --- a/examples/connparams/connparams.go +++ b/examples/connparams/connparams.go @@ -6,7 +6,7 @@ import ( "net/url" "os" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) func main() { diff --git a/examples/dialog/dialog.go b/examples/dialog/dialog.go index 4b4d6ab18..0377f9315 100644 --- a/examples/dialog/dialog.go +++ b/examples/dialog/dialog.go @@ -8,7 +8,7 @@ import ( "net/url" "strings" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) var api = slack.New("YOUR_TOKEN") diff --git a/examples/eventsapi/events.go b/examples/eventsapi/events.go index 25049ad07..29a8d5d81 100644 --- a/examples/eventsapi/events.go +++ b/examples/eventsapi/events.go @@ -7,8 +7,8 @@ import ( "net/http" "os" - "github.com/slack-go/slack" - "github.com/slack-go/slack/slackevents" + "github.com/crisp-dev/slack" + "github.com/crisp-dev/slack/slackevents" ) // You more than likely want your "Bot User OAuth Access Token" which starts with "xoxb-" diff --git a/examples/files/files.go b/examples/files/files.go index 0eb136a50..66c6b47bf 100644 --- a/examples/files/files.go +++ b/examples/files/files.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) func main() { diff --git a/examples/messages/messages.go b/examples/messages/messages.go index dd7f02da0..36a2d8cb5 100644 --- a/examples/messages/messages.go +++ b/examples/messages/messages.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) func main() { diff --git a/examples/modal/modal.go b/examples/modal/modal.go index 78bb60e03..4a1af25c5 100644 --- a/examples/modal/modal.go +++ b/examples/modal/modal.go @@ -18,7 +18,7 @@ import ( "io/ioutil" "net/http" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) func generateModalRequest() slack.ModalViewRequest { @@ -59,7 +59,7 @@ func generateModalRequest() slack.ModalViewRequest { } // This was taken from the slash example -// https://github.com/slack-go/slack/blob/master/examples/slash/slash.go +// https://github.com/crisp-dev/slack/blob/master/examples/slash/slash.go func verifySigningSecret(r *http.Request) error { signingSecret := "YOUR_SIGNING_SECRET_HERE" verifier, err := slack.NewSecretsVerifier(r.Header, signingSecret) diff --git a/examples/modal_users/users.go b/examples/modal_users/users.go index 9706a0b9e..0d179bce1 100644 --- a/examples/modal_users/users.go +++ b/examples/modal_users/users.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) // An example how to open a modal with different kinds of input fields diff --git a/examples/pins/pins.go b/examples/pins/pins.go index d13d2d2c8..56f82a5ce 100644 --- a/examples/pins/pins.go +++ b/examples/pins/pins.go @@ -4,7 +4,7 @@ import ( "flag" "fmt" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) /* diff --git a/examples/reactions/reactions.go b/examples/reactions/reactions.go index 4e19f508a..fffacebb8 100644 --- a/examples/reactions/reactions.go +++ b/examples/reactions/reactions.go @@ -4,7 +4,7 @@ import ( "flag" "fmt" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) func main() { diff --git a/examples/slash/slash.go b/examples/slash/slash.go index c70c865ff..ac8fd6180 100644 --- a/examples/slash/slash.go +++ b/examples/slash/slash.go @@ -8,7 +8,7 @@ import ( "io/ioutil" "net/http" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) func main() { diff --git a/examples/socketmode/socketmode.go b/examples/socketmode/socketmode.go index 69e34c294..1787c9fe9 100644 --- a/examples/socketmode/socketmode.go +++ b/examples/socketmode/socketmode.go @@ -6,10 +6,10 @@ import ( "os" "strings" - "github.com/slack-go/slack/socketmode" + "github.com/crisp-dev/slack/socketmode" - "github.com/slack-go/slack" - "github.com/slack-go/slack/slackevents" + "github.com/crisp-dev/slack" + "github.com/crisp-dev/slack/slackevents" ) func main() { diff --git a/examples/stars/stars.go b/examples/stars/stars.go index cc3f9bacb..1b7064a28 100644 --- a/examples/stars/stars.go +++ b/examples/stars/stars.go @@ -4,7 +4,7 @@ import ( "flag" "fmt" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) func main() { diff --git a/examples/team/team.go b/examples/team/team.go index 8d2fcdbc6..756532424 100644 --- a/examples/team/team.go +++ b/examples/team/team.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) func main() { diff --git a/examples/users/users.go b/examples/users/users.go index d6669b18b..8ce00683e 100644 --- a/examples/users/users.go +++ b/examples/users/users.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) func main() { diff --git a/examples/webhooks/webhooks.go b/examples/webhooks/webhooks.go index 7fa5edea9..dc00b843c 100644 --- a/examples/webhooks/webhooks.go +++ b/examples/webhooks/webhooks.go @@ -6,7 +6,7 @@ import ( "strconv" "time" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) func main() { @@ -15,7 +15,7 @@ func main() { Fallback: "You successfully posted by Incoming Webhook URL!", AuthorName: "slack-go/slack", AuthorSubname: "github.com", - AuthorLink: "https://github.com/slack-go/slack", + AuthorLink: "https://github.com/crisp-dev/slack", AuthorIcon: "https://avatars2.githubusercontent.com/u/652790", Text: " All text in Slack uses the same system of escaping: chat messages, direct messages, file comments, etc. :smile:\nSee ", Footer: "slack api", diff --git a/examples/websocket/websocket.go b/examples/websocket/websocket.go index 96e110e39..de5a635dc 100644 --- a/examples/websocket/websocket.go +++ b/examples/websocket/websocket.go @@ -5,7 +5,7 @@ import ( "log" "os" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) func main() { diff --git a/examples/websocket_respond/respond.go b/examples/websocket_respond/respond.go index eed3fa834..ff2f05724 100644 --- a/examples/websocket_respond/respond.go +++ b/examples/websocket_respond/respond.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) func main() { diff --git a/go.mod b/go.mod index e93a8a4ac..0990812f7 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/slack-go/slack +module github.com/crisp-dev/slack require ( github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/interactions.go b/interactions.go index 391cb987e..87355c381 100644 --- a/interactions.go +++ b/interactions.go @@ -58,7 +58,7 @@ type InteractionCallback struct { ViewClosedCallback // FIXME(kanata2): just workaround for backward-compatibility. - // See also https://github.com/slack-go/slack/issues/816 + // See also https://github.com/crisp-dev/slack/issues/816 RawState json.RawMessage `json:"state,omitempty"` // BlockActionState stands for the `state` field in block_actions type. diff --git a/misc.go b/misc.go index 8c50305b2..44f33b69b 100644 --- a/misc.go +++ b/misc.go @@ -19,7 +19,7 @@ import ( "strings" "time" - "github.com/slack-go/slack/internal/misc" + "github.com/crisp-dev/slack/internal/misc" ) // SlackResponse handles parsing out errors from the web api. diff --git a/misc_test.go b/misc_test.go index 4dd2a6378..3e1ac01ac 100644 --- a/misc_test.go +++ b/misc_test.go @@ -8,9 +8,9 @@ import ( "sync" "testing" - "github.com/slack-go/slack/internal/misc" + "github.com/crisp-dev/slack/internal/misc" - "github.com/slack-go/slack/slackutilsx" + "github.com/crisp-dev/slack/slackutilsx" ) var ( diff --git a/slackevents/action_events.go b/slackevents/action_events.go index c6016f107..db9aff2a1 100644 --- a/slackevents/action_events.go +++ b/slackevents/action_events.go @@ -3,7 +3,7 @@ package slackevents import ( "encoding/json" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) type MessageActionResponse struct { diff --git a/slackevents/inner_events.go b/slackevents/inner_events.go index d867b406a..da3a1ff94 100644 --- a/slackevents/inner_events.go +++ b/slackevents/inner_events.go @@ -5,7 +5,7 @@ package slackevents import ( "encoding/json" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) // EventsAPIInnerEvent the inner event of a EventsAPI event_callback Event. diff --git a/slackevents/parsers.go b/slackevents/parsers.go index 07f296aeb..f94c428dd 100644 --- a/slackevents/parsers.go +++ b/slackevents/parsers.go @@ -7,7 +7,7 @@ import ( "fmt" "reflect" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) // eventsMap checks both slack.EventsMapping and diff --git a/slackevents/parsers_test.go b/slackevents/parsers_test.go index 8dcdedda0..e4ca9b35e 100644 --- a/slackevents/parsers_test.go +++ b/slackevents/parsers_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) func TestParserOuterCallBackEvent(t *testing.T) { diff --git a/slacktest/data.go b/slacktest/data.go index 37d413a0d..4a8f47b03 100644 --- a/slacktest/data.go +++ b/slacktest/data.go @@ -3,7 +3,7 @@ package slacktest import ( "fmt" - slack "github.com/slack-go/slack" + slack "github.com/crisp-dev/slack" ) const defaultBotName = "TestSlackBot" diff --git a/slacktest/errors.go b/slacktest/errors.go index ec0a9d675..8a3958d5d 100644 --- a/slacktest/errors.go +++ b/slacktest/errors.go @@ -1,7 +1,7 @@ package slacktest import ( - "github.com/slack-go/slack/internal/errorsx" + "github.com/crisp-dev/slack/internal/errorsx" ) const ( diff --git a/slacktest/funcs.go b/slacktest/funcs.go index a5b6470eb..878b2df6b 100644 --- a/slacktest/funcs.go +++ b/slacktest/funcs.go @@ -7,7 +7,7 @@ import ( "time" websocket "github.com/gorilla/websocket" - slack "github.com/slack-go/slack" + slack "github.com/crisp-dev/slack" ) func (sts *Server) queueForWebsocket(s, hubname string) { diff --git a/slacktest/handlers.go b/slacktest/handlers.go index b3f13700c..c7eee0601 100644 --- a/slacktest/handlers.go +++ b/slacktest/handlers.go @@ -11,7 +11,7 @@ import ( "time" websocket "github.com/gorilla/websocket" - slack "github.com/slack-go/slack" + slack "github.com/crisp-dev/slack" ) func contextHandler(server *Server, next http.HandlerFunc) http.Handler { diff --git a/slacktest/handlers_test.go b/slacktest/handlers_test.go index 9ad35f754..0b849bc7a 100644 --- a/slacktest/handlers_test.go +++ b/slacktest/handlers_test.go @@ -3,7 +3,7 @@ package slacktest import ( "testing" - slack "github.com/slack-go/slack" + slack "github.com/crisp-dev/slack" "github.com/stretchr/testify/assert" ) diff --git a/slacktest/rtm_test.go b/slacktest/rtm_test.go index 00a59f5fc..86ef778d9 100644 --- a/slacktest/rtm_test.go +++ b/slacktest/rtm_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" "github.com/stretchr/testify/assert" ) diff --git a/slacktest/server.go b/slacktest/server.go index aa6c0a180..de3daece1 100644 --- a/slacktest/server.go +++ b/slacktest/server.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "time" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) func newMessageChannels() *messageChannels { diff --git a/slacktest/server_test.go b/slacktest/server_test.go index 5902282c1..baa066f8a 100644 --- a/slacktest/server_test.go +++ b/slacktest/server_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" "github.com/stretchr/testify/assert" ) diff --git a/slacktest/types.go b/slacktest/types.go index 4c90ed9ba..3a60c1480 100644 --- a/slacktest/types.go +++ b/slacktest/types.go @@ -6,7 +6,7 @@ import ( "net/http/httptest" "sync" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" ) type contextKey string diff --git a/socketmode/client.go b/socketmode/client.go index c208517b8..e4120c511 100644 --- a/socketmode/client.go +++ b/socketmode/client.go @@ -4,7 +4,7 @@ import ( "encoding/json" "time" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" "github.com/gorilla/websocket" ) diff --git a/socketmode/socket_mode_managed_conn.go b/socketmode/socket_mode_managed_conn.go index 9373a6be0..60cb7564f 100644 --- a/socketmode/socket_mode_managed_conn.go +++ b/socketmode/socket_mode_managed_conn.go @@ -11,13 +11,13 @@ import ( "sync" "time" - "github.com/slack-go/slack" - "github.com/slack-go/slack/internal/backoff" - "github.com/slack-go/slack/internal/misc" - "github.com/slack-go/slack/slackevents" + "github.com/crisp-dev/slack" + "github.com/crisp-dev/slack/internal/backoff" + "github.com/crisp-dev/slack/internal/misc" + "github.com/crisp-dev/slack/slackevents" "github.com/gorilla/websocket" - "github.com/slack-go/slack/internal/timex" + "github.com/crisp-dev/slack/internal/timex" ) // Run is a blocking function that connects the Slack Socket Mode API and handles all incoming diff --git a/socketmode/socket_mode_managed_conn_test.go b/socketmode/socket_mode_managed_conn_test.go index 23bba7f50..645a9872f 100644 --- a/socketmode/socket_mode_managed_conn_test.go +++ b/socketmode/socket_mode_managed_conn_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "github.com/slack-go/slack" - "github.com/slack-go/slack/slacktest" + "github.com/crisp-dev/slack" + "github.com/crisp-dev/slack/slacktest" "github.com/stretchr/testify/assert" ) diff --git a/socketmode/socketmode.go b/socketmode/socketmode.go index 752be8cdf..45143188f 100644 --- a/socketmode/socketmode.go +++ b/socketmode/socketmode.go @@ -6,7 +6,7 @@ import ( "os" "time" - "github.com/slack-go/slack" + "github.com/crisp-dev/slack" "github.com/gorilla/websocket" ) diff --git a/socketmode/socketmode_test.go b/socketmode/socketmode_test.go index b9ce77690..77b2dcf2a 100644 --- a/socketmode/socketmode_test.go +++ b/socketmode/socketmode_test.go @@ -6,7 +6,7 @@ import ( "reflect" "testing" - "github.com/slack-go/slack/slackevents" + "github.com/crisp-dev/slack/slackevents" "github.com/pkg/errors" ) diff --git a/users.go b/users.go index 3696e37fc..1189195c0 100644 --- a/users.go +++ b/users.go @@ -46,14 +46,14 @@ type UserProfile struct { // UserProfileCustomFields represents user profile's custom fields. // Slack API's response data type is inconsistent so we use the struct. // For detail, please see below. -// https://github.com/slack-go/slack/pull/298#discussion_r185159233 +// https://github.com/crisp-dev/slack/pull/298#discussion_r185159233 type UserProfileCustomFields struct { fields map[string]UserProfileCustomField } // UnmarshalJSON is the implementation of the json.Unmarshaler interface. func (fields *UserProfileCustomFields) UnmarshalJSON(b []byte) error { - // https://github.com/slack-go/slack/pull/298#discussion_r185159233 + // https://github.com/crisp-dev/slack/pull/298#discussion_r185159233 if string(b) == "[]" { return nil } diff --git a/views_test.go b/views_test.go index 1dc1438ad..6ff8c901f 100644 --- a/views_test.go +++ b/views_test.go @@ -6,7 +6,7 @@ import ( "reflect" "testing" - "github.com/slack-go/slack/internal/errorsx" + "github.com/crisp-dev/slack/internal/errorsx" "github.com/stretchr/testify/assert" ) diff --git a/websocket_managed_conn.go b/websocket_managed_conn.go index 5555c3162..1ff68e0f7 100644 --- a/websocket_managed_conn.go +++ b/websocket_managed_conn.go @@ -9,12 +9,12 @@ import ( "reflect" "time" - "github.com/slack-go/slack/internal/backoff" - "github.com/slack-go/slack/internal/misc" + "github.com/crisp-dev/slack/internal/backoff" + "github.com/crisp-dev/slack/internal/misc" "github.com/gorilla/websocket" - "github.com/slack-go/slack/internal/errorsx" - "github.com/slack-go/slack/internal/timex" + "github.com/crisp-dev/slack/internal/errorsx" + "github.com/crisp-dev/slack/internal/timex" ) // ManageConnection can be called on a Slack RTM instance returned by the diff --git a/websocket_managed_conn_test.go b/websocket_managed_conn_test.go index bb4e3e4d5..21bafeede 100644 --- a/websocket_managed_conn_test.go +++ b/websocket_managed_conn_test.go @@ -8,8 +8,8 @@ import ( "time" websocket "github.com/gorilla/websocket" - "github.com/slack-go/slack" - "github.com/slack-go/slack/slacktest" + "github.com/crisp-dev/slack" + "github.com/crisp-dev/slack/slacktest" "github.com/stretchr/testify/assert" ) From 4f0b6d7888e3b98458fb48d051365a7eb3057117 Mon Sep 17 00:00:00 2001 From: Valerian Saliou Date: Thu, 19 Aug 2021 16:51:02 +0200 Subject: [PATCH 2/8] New events (WIP) --- slackevents/inner_events.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/slackevents/inner_events.go b/slackevents/inner_events.go index da3a1ff94..07e325062 100644 --- a/slackevents/inner_events.go +++ b/slackevents/inner_events.go @@ -328,6 +328,16 @@ const ( AppUninstalled = "app_uninstalled" // ChannelCreated is sent when a new channel is created. ChannelCreated = "channel_created" + // ChannelDeleted is sent when a channel is deleted. + ChannelDeleted = "channel_deleted" + // ChannelArchive is sent when a channel is archive. + ChannelArchive = "channel_archive" + // ChannelLeft is sent when a channel is left. + ChannelLeft = "channel_left" + // ChannelRename is sent when a channel is rename. + ChannelRename = "channel_rename" + // ChannelIDChanged is sent when a channel identifier is changed. + ChannelIDChanged = "channel_id_changed" // GridMigrationFinished An enterprise grid migration has finished on this workspace. GridMigrationFinished = "grid_migration_finished" // GridMigrationStarted An enterprise grid migration has started on this workspace. @@ -362,6 +372,11 @@ var EventsAPIInnerEventMapping = map[string]interface{}{ AppHomeOpened: AppHomeOpenedEvent{}, AppUninstalled: AppUninstalledEvent{}, ChannelCreated: ChannelCreatedEvent{}, + ChannelDeleted: ChannelDeletedEvent{}, + ChannelArchive: ChannelArchiveEvent{}, + ChannelLeft: ChannelLeftEvent{}, + ChannelRename: ChannelRenameEvent{}, + ChannelIDChanged: ChannelIDChangedEvent{}, GridMigrationFinished: GridMigrationFinishedEvent{}, GridMigrationStarted: GridMigrationStartedEvent{}, LinkShared: LinkSharedEvent{}, From 21c2d801e76eba7e05c64c9092f651a46af00732 Mon Sep 17 00:00:00 2001 From: Valerian Saliou Date: Thu, 19 Aug 2021 16:52:41 +0200 Subject: [PATCH 3/8] New events (WIP) --- slackevents/inner_events.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/slackevents/inner_events.go b/slackevents/inner_events.go index 07e325062..09a413684 100644 --- a/slackevents/inner_events.go +++ b/slackevents/inner_events.go @@ -54,6 +54,41 @@ type ChannelCreatedEvent struct { EventTimestamp string `json:"event_ts"` } +// ChannelDeletedEvent represents the Channel deleted event +type ChannelDeletedEvent struct { + Type string `json:"type"` + Channel ChannelCreatedInfo `json:"channel"` + EventTimestamp string `json:"event_ts"` +} + +// ChannelArchiveEvent represents the Channel archive event +type ChannelArchiveEvent struct { + Type string `json:"type"` + Channel ChannelCreatedInfo `json:"channel"` + EventTimestamp string `json:"event_ts"` +} + +// ChannelLeftEvent represents the Channel left event +type ChannelLeftEvent struct { + Type string `json:"type"` + Channel ChannelCreatedInfo `json:"channel"` + EventTimestamp string `json:"event_ts"` +} + +// ChannelRenameEvent represents the Channel rename event +type ChannelRenameEvent struct { + Type string `json:"type"` + Channel ChannelCreatedInfo `json:"channel"` + EventTimestamp string `json:"event_ts"` +} + +// ChannelIDChangedEvent represents the Channel identifier changed event +type ChannelIDChangedEvent struct { + Type string `json:"type"` + Channel ChannelCreatedInfo `json:"channel"` + EventTimestamp string `json:"event_ts"` +} + // ChannelCreatedInfo represents the information associated with the Channel created event type ChannelCreatedInfo struct { ID string `json:"id"` From 59057c7dc3e9fda1b5ee3342125008ce10bc7b9c Mon Sep 17 00:00:00 2001 From: Valerian Saliou Date: Thu, 19 Aug 2021 16:58:58 +0200 Subject: [PATCH 4/8] New events (WIP) --- slackevents/inner_events.go | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/slackevents/inner_events.go b/slackevents/inner_events.go index 09a413684..b240c0022 100644 --- a/slackevents/inner_events.go +++ b/slackevents/inner_events.go @@ -56,37 +56,35 @@ type ChannelCreatedEvent struct { // ChannelDeletedEvent represents the Channel deleted event type ChannelDeletedEvent struct { - Type string `json:"type"` - Channel ChannelCreatedInfo `json:"channel"` - EventTimestamp string `json:"event_ts"` + Type string `json:"type"` + Channel string `json:"channel"` } // ChannelArchiveEvent represents the Channel archive event type ChannelArchiveEvent struct { - Type string `json:"type"` - Channel ChannelCreatedInfo `json:"channel"` - EventTimestamp string `json:"event_ts"` + Type string `json:"type"` + Channel string `json:"channel"` + User string `json:"user"` } // ChannelLeftEvent represents the Channel left event type ChannelLeftEvent struct { - Type string `json:"type"` - Channel ChannelCreatedInfo `json:"channel"` - EventTimestamp string `json:"event_ts"` + Type string `json:"type"` + Channel string `json:"channel"` } // ChannelRenameEvent represents the Channel rename event type ChannelRenameEvent struct { - Type string `json:"type"` - Channel ChannelCreatedInfo `json:"channel"` - EventTimestamp string `json:"event_ts"` + Type string `json:"type"` + Channel ChannelRenameInfo `json:"channel"` } // ChannelIDChangedEvent represents the Channel identifier changed event type ChannelIDChangedEvent struct { - Type string `json:"type"` - Channel ChannelCreatedInfo `json:"channel"` - EventTimestamp string `json:"event_ts"` + Type string `json:"type"` + OldChannelID string `json:"old_channel_id"` + NewChannelID string `json:"new_channel_id"` + EventTimestamp string `json:"event_ts"` } // ChannelCreatedInfo represents the information associated with the Channel created event @@ -98,6 +96,13 @@ type ChannelCreatedInfo struct { Creator string `json:"creator"` } +// ChannelRenameInfo represents the information associated with the Channel rename event +type ChannelRenameInfo struct { + ID string `json:"id"` + Name string `json:"name"` + Created int `json:"created"` +} + // GridMigrationFinishedEvent An enterprise grid migration has finished on this workspace. type GridMigrationFinishedEvent struct { Type string `json:"type"` From 11c2397270bdb46bd6a00780418bd6465bd04dee Mon Sep 17 00:00:00 2001 From: Valerian Saliou Date: Thu, 19 Aug 2021 19:16:07 +0200 Subject: [PATCH 5/8] New events (WIP) --- slackevents/inner_events.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/slackevents/inner_events.go b/slackevents/inner_events.go index b240c0022..9a011506f 100644 --- a/slackevents/inner_events.go +++ b/slackevents/inner_events.go @@ -67,6 +67,13 @@ type ChannelArchiveEvent struct { User string `json:"user"` } +// ChannelUnarchiveEvent represents the Channel unarchive event +type ChannelUnarchiveEvent struct { + Type string `json:"type"` + Channel string `json:"channel"` + User string `json:"user"` +} + // ChannelLeftEvent represents the Channel left event type ChannelLeftEvent struct { Type string `json:"type"` @@ -370,8 +377,10 @@ const ( ChannelCreated = "channel_created" // ChannelDeleted is sent when a channel is deleted. ChannelDeleted = "channel_deleted" - // ChannelArchive is sent when a channel is archive. + // ChannelArchive is sent when a channel is archived. ChannelArchive = "channel_archive" + // ChannelUnarchive is sent when a channel is unarchived. + ChannelUnarchive = "channel_unarchive" // ChannelLeft is sent when a channel is left. ChannelLeft = "channel_left" // ChannelRename is sent when a channel is rename. @@ -414,6 +423,7 @@ var EventsAPIInnerEventMapping = map[string]interface{}{ ChannelCreated: ChannelCreatedEvent{}, ChannelDeleted: ChannelDeletedEvent{}, ChannelArchive: ChannelArchiveEvent{}, + ChannelUnarchive: ChannelUnarchiveEvent{}, ChannelLeft: ChannelLeftEvent{}, ChannelRename: ChannelRenameEvent{}, ChannelIDChanged: ChannelIDChangedEvent{}, From a64aa5318c7a481aaf5bc0c3e39ee8ec3febe3c6 Mon Sep 17 00:00:00 2001 From: Valerian Saliou Date: Fri, 20 Aug 2021 14:00:52 +0200 Subject: [PATCH 6/8] New events (WIP) --- slackevents/inner_events.go | 588 ++++++++++++++++++++---------------- 1 file changed, 320 insertions(+), 268 deletions(-) diff --git a/slackevents/inner_events.go b/slackevents/inner_events.go index 9a011506f..6a9f18140 100644 --- a/slackevents/inner_events.go +++ b/slackevents/inner_events.go @@ -3,139 +3,176 @@ package slackevents import ( - "encoding/json" + "encoding/json" - "github.com/crisp-dev/slack" + "github.com/crisp-dev/slack" ) // EventsAPIInnerEvent the inner event of a EventsAPI event_callback Event. type EventsAPIInnerEvent struct { - Type string `json:"type"` - Data interface{} + Type string `json:"type"` + Data interface{} } // AppMentionEvent is an (inner) EventsAPI subscribable event. type AppMentionEvent struct { - Type string `json:"type"` - User string `json:"user"` - Text string `json:"text"` - TimeStamp string `json:"ts"` - ThreadTimeStamp string `json:"thread_ts"` - Channel string `json:"channel"` - EventTimeStamp json.Number `json:"event_ts"` + Type string `json:"type"` + User string `json:"user"` + Text string `json:"text"` + TimeStamp string `json:"ts"` + ThreadTimeStamp string `json:"thread_ts"` + Channel string `json:"channel"` + EventTimeStamp json.Number `json:"event_ts"` - // When Message comes from a channel that is shared between workspaces - UserTeam string `json:"user_team,omitempty"` - SourceTeam string `json:"source_team,omitempty"` + // When Message comes from a channel that is shared between workspaces + UserTeam string `json:"user_team,omitempty"` + SourceTeam string `json:"source_team,omitempty"` - // BotID is filled out when a bot triggers the app_mention event - BotID string `json:"bot_id,omitempty"` + // BotID is filled out when a bot triggers the app_mention event + BotID string `json:"bot_id,omitempty"` } // AppHomeOpenedEvent Your Slack app home was opened. type AppHomeOpenedEvent struct { - Type string `json:"type"` - User string `json:"user"` - Channel string `json:"channel"` - EventTimeStamp json.Number `json:"event_ts"` - Tab string `json:"tab"` - View slack.View `json:"view"` + Type string `json:"type"` + User string `json:"user"` + Channel string `json:"channel"` + EventTimeStamp json.Number `json:"event_ts"` + Tab string `json:"tab"` + View slack.View `json:"view"` } // AppUninstalledEvent Your Slack app was uninstalled. type AppUninstalledEvent struct { - Type string `json:"type"` + Type string `json:"type"` } // ChannelCreatedEvent represents the Channel created event type ChannelCreatedEvent struct { - Type string `json:"type"` - Channel ChannelCreatedInfo `json:"channel"` - EventTimestamp string `json:"event_ts"` + Type string `json:"type"` + Channel ChannelCreatedInfo `json:"channel"` + EventTimestamp string `json:"event_ts"` } // ChannelDeletedEvent represents the Channel deleted event type ChannelDeletedEvent struct { - Type string `json:"type"` - Channel string `json:"channel"` + Type string `json:"type"` + Channel string `json:"channel"` } // ChannelArchiveEvent represents the Channel archive event type ChannelArchiveEvent struct { - Type string `json:"type"` - Channel string `json:"channel"` - User string `json:"user"` + Type string `json:"type"` + Channel string `json:"channel"` + User string `json:"user"` } // ChannelUnarchiveEvent represents the Channel unarchive event type ChannelUnarchiveEvent struct { - Type string `json:"type"` - Channel string `json:"channel"` - User string `json:"user"` + Type string `json:"type"` + Channel string `json:"channel"` + User string `json:"user"` } // ChannelLeftEvent represents the Channel left event type ChannelLeftEvent struct { - Type string `json:"type"` - Channel string `json:"channel"` + Type string `json:"type"` + Channel string `json:"channel"` } // ChannelRenameEvent represents the Channel rename event type ChannelRenameEvent struct { - Type string `json:"type"` - Channel ChannelRenameInfo `json:"channel"` + Type string `json:"type"` + Channel ChannelRenameInfo `json:"channel"` } // ChannelIDChangedEvent represents the Channel identifier changed event type ChannelIDChangedEvent struct { - Type string `json:"type"` - OldChannelID string `json:"old_channel_id"` - NewChannelID string `json:"new_channel_id"` - EventTimestamp string `json:"event_ts"` + Type string `json:"type"` + OldChannelID string `json:"old_channel_id"` + NewChannelID string `json:"new_channel_id"` + EventTimestamp string `json:"event_ts"` } // ChannelCreatedInfo represents the information associated with the Channel created event type ChannelCreatedInfo struct { - ID string `json:"id"` - IsChannel bool `json:"is_channel"` - Name string `json:"name"` - Created int `json:"created"` - Creator string `json:"creator"` + ID string `json:"id"` + IsChannel bool `json:"is_channel"` + Name string `json:"name"` + Created int `json:"created"` + Creator string `json:"creator"` } // ChannelRenameInfo represents the information associated with the Channel rename event type ChannelRenameInfo struct { - ID string `json:"id"` - Name string `json:"name"` - Created int `json:"created"` + ID string `json:"id"` + Name string `json:"name"` + Created int `json:"created"` +} + +// GroupDeletedEvent represents the Group deleted event +type GroupDeletedEvent struct { + Type string `json:"type"` + Channel string `json:"channel"` +} + +// GroupArchiveEvent represents the Group archive event +type GroupArchiveEvent struct { + Type string `json:"type"` + Channel string `json:"channel"` +} + +// GroupUnarchiveEvent represents the Group unarchive event +type GroupUnarchiveEvent struct { + Type string `json:"type"` + Channel string `json:"channel"` +} + +// GroupLeftEvent represents the Group left event +type GroupLeftEvent struct { + Type string `json:"type"` + Channel string `json:"channel"` +} + +// GroupRenameEvent represents the Group rename event +type GroupRenameEvent struct { + Type string `json:"type"` + Channel GroupRenameInfo `json:"channel"` +} + +// GroupRenameInfo represents the information associated with the Group rename event +type GroupRenameInfo struct { + ID string `json:"id"` + Name string `json:"name"` + Created int `json:"created"` } // GridMigrationFinishedEvent An enterprise grid migration has finished on this workspace. type GridMigrationFinishedEvent struct { - Type string `json:"type"` - EnterpriseID string `json:"enterprise_id"` + Type string `json:"type"` + EnterpriseID string `json:"enterprise_id"` } // GridMigrationStartedEvent An enterprise grid migration has started on this workspace. type GridMigrationStartedEvent struct { - Type string `json:"type"` - EnterpriseID string `json:"enterprise_id"` + Type string `json:"type"` + EnterpriseID string `json:"enterprise_id"` } // LinkSharedEvent A message was posted containing one or more links relevant to your application type LinkSharedEvent struct { - Type string `json:"type"` - User string `json:"user"` - TimeStamp string `json:"ts"` - Channel string `json:"channel"` - MessageTimeStamp json.Number `json:"message_ts"` - ThreadTimeStamp string `json:"thread_ts"` - Links []sharedLinks `json:"links"` + Type string `json:"type"` + User string `json:"user"` + TimeStamp string `json:"ts"` + Channel string `json:"channel"` + MessageTimeStamp json.Number `json:"message_ts"` + ThreadTimeStamp string `json:"thread_ts"` + Links []sharedLinks `json:"links"` } type sharedLinks struct { - Domain string `json:"domain"` - URL string `json:"url"` + Domain string `json:"domain"` + URL string `json:"url"` } // MessageEvent occurs when a variety of types of messages has been posted. @@ -146,80 +183,80 @@ type sharedLinks struct { // if ChannelType = "mim", A message was posted in a multiparty direct message channel // TODO: Improve this so that it is not required to manually parse ChannelType type MessageEvent struct { - // Basic Message Event - https://api.slack.com/events/message - ClientMsgID string `json:"client_msg_id"` - Type string `json:"type"` - User string `json:"user"` - Text string `json:"text"` - ThreadTimeStamp string `json:"thread_ts"` - TimeStamp string `json:"ts"` - Channel string `json:"channel"` - ChannelType string `json:"channel_type"` - EventTimeStamp json.Number `json:"event_ts"` + // Basic Message Event - https://api.slack.com/events/message + ClientMsgID string `json:"client_msg_id"` + Type string `json:"type"` + User string `json:"user"` + Text string `json:"text"` + ThreadTimeStamp string `json:"thread_ts"` + TimeStamp string `json:"ts"` + Channel string `json:"channel"` + ChannelType string `json:"channel_type"` + EventTimeStamp json.Number `json:"event_ts"` - // When Message comes from a channel that is shared between workspaces - UserTeam string `json:"user_team,omitempty"` - SourceTeam string `json:"source_team,omitempty"` + // When Message comes from a channel that is shared between workspaces + UserTeam string `json:"user_team,omitempty"` + SourceTeam string `json:"source_team,omitempty"` - // Edited Message - Message *MessageEvent `json:"message,omitempty"` - PreviousMessage *MessageEvent `json:"previous_message,omitempty"` - Edited *Edited `json:"edited,omitempty"` + // Edited Message + Message *MessageEvent `json:"message,omitempty"` + PreviousMessage *MessageEvent `json:"previous_message,omitempty"` + Edited *Edited `json:"edited,omitempty"` - // Message Subtypes - SubType string `json:"subtype,omitempty"` + // Message Subtypes + SubType string `json:"subtype,omitempty"` - // bot_message (https://api.slack.com/events/message/bot_message) - BotID string `json:"bot_id,omitempty"` - Username string `json:"username,omitempty"` - Icons *Icon `json:"icons,omitempty"` + // bot_message (https://api.slack.com/events/message/bot_message) + BotID string `json:"bot_id,omitempty"` + Username string `json:"username,omitempty"` + Icons *Icon `json:"icons,omitempty"` - Upload bool `json:"upload"` - Files []File `json:"files"` + Upload bool `json:"upload"` + Files []File `json:"files"` - Attachments []slack.Attachment `json:"attachments,omitempty"` + Attachments []slack.Attachment `json:"attachments,omitempty"` - // Root is the message that was broadcast to the channel when the SubType is - // thread_broadcast. If this is not a thread_broadcast message event, this - // value is nil. - Root *MessageEvent `json:"root"` + // Root is the message that was broadcast to the channel when the SubType is + // thread_broadcast. If this is not a thread_broadcast message event, this + // value is nil. + Root *MessageEvent `json:"root"` } // MemberJoinedChannelEvent A member joined a public or private channel type MemberJoinedChannelEvent struct { - Type string `json:"type"` - User string `json:"user"` - Channel string `json:"channel"` - ChannelType string `json:"channel_type"` - Team string `json:"team"` - Inviter string `json:"inviter"` + Type string `json:"type"` + User string `json:"user"` + Channel string `json:"channel"` + ChannelType string `json:"channel_type"` + Team string `json:"team"` + Inviter string `json:"inviter"` } // MemberLeftChannelEvent A member left a public or private channel type MemberLeftChannelEvent struct { - Type string `json:"type"` - User string `json:"user"` - Channel string `json:"channel"` - ChannelType string `json:"channel_type"` - Team string `json:"team"` + Type string `json:"type"` + User string `json:"user"` + Channel string `json:"channel"` + ChannelType string `json:"channel_type"` + Team string `json:"team"` } type pinEvent struct { - Type string `json:"type"` - User string `json:"user"` - Item Item `json:"item"` - Channel string `json:"channel_id"` - EventTimestamp string `json:"event_ts"` - HasPins bool `json:"has_pins,omitempty"` + Type string `json:"type"` + User string `json:"user"` + Item Item `json:"item"` + Channel string `json:"channel_id"` + EventTimestamp string `json:"event_ts"` + HasPins bool `json:"has_pins,omitempty"` } type reactionEvent struct { - Type string `json:"type"` - User string `json:"user"` - Reaction string `json:"reaction"` - ItemUser string `json:"item_user"` - Item Item `json:"item"` - EventTimestamp string `json:"event_ts"` + Type string `json:"type"` + User string `json:"user"` + Reaction string `json:"reaction"` + ItemUser string `json:"item_user"` + Item Item `json:"item"` + EventTimestamp string `json:"event_ts"` } // ReactionAddedEvent An reaction was added to a message - https://api.slack.com/events/reaction_added @@ -235,34 +272,34 @@ type PinAddedEvent pinEvent type PinRemovedEvent pinEvent type tokens struct { - Oauth []string `json:"oauth"` - Bot []string `json:"bot"` + Oauth []string `json:"oauth"` + Bot []string `json:"bot"` } // TokensRevokedEvent APP's API tokes are revoked - https://api.slack.com/events/tokens_revoked type TokensRevokedEvent struct { - Type string `json:"type"` - Tokens tokens `json:"tokens"` + Type string `json:"type"` + Tokens tokens `json:"tokens"` } // EmojiChangedEvent is the event of custom emoji has been added or changed type EmojiChangedEvent struct { - Type string `json:"type"` - Subtype string `json:"subtype"` - EventTimeStamp json.Number `json:"event_ts"` + Type string `json:"type"` + Subtype string `json:"subtype"` + EventTimeStamp json.Number `json:"event_ts"` - // filled out when custom emoji added - Name string `json:"name,omitempty"` + // filled out when custom emoji added + Name string `json:"name,omitempty"` - // filled out when custom emoji removed - Names []string `json:"names,omitempty"` + // filled out when custom emoji removed + Names []string `json:"names,omitempty"` - // filled out when custom emoji renamed - OldName string `json:"old_name,omitempty"` - NewName string `json:"new_name,omitempty"` + // filled out when custom emoji renamed + OldName string `json:"old_name,omitempty"` + NewName string `json:"new_name,omitempty"` - // filled out when custom emoji added or renamed - Value string `json:"value,omitempty"` + // filled out when custom emoji added or renamed + Value string `json:"value,omitempty"` } // JSONTime exists so that we can have a String method converting the date @@ -270,173 +307,188 @@ type JSONTime int64 // Comment contains all the information relative to a comment type Comment struct { - ID string `json:"id,omitempty"` - Created JSONTime `json:"created,omitempty"` - Timestamp JSONTime `json:"timestamp,omitempty"` - User string `json:"user,omitempty"` - Comment string `json:"comment,omitempty"` + ID string `json:"id,omitempty"` + Created JSONTime `json:"created,omitempty"` + Timestamp JSONTime `json:"timestamp,omitempty"` + User string `json:"user,omitempty"` + Comment string `json:"comment,omitempty"` } // File is a file upload type File struct { - ID string `json:"id"` - Created int `json:"created"` - Timestamp int `json:"timestamp"` - Name string `json:"name"` - Title string `json:"title"` - Mimetype string `json:"mimetype"` - Filetype string `json:"filetype"` - PrettyType string `json:"pretty_type"` - User string `json:"user"` - Editable bool `json:"editable"` - Size int `json:"size"` - Mode string `json:"mode"` - IsExternal bool `json:"is_external"` - ExternalType string `json:"external_type"` - IsPublic bool `json:"is_public"` - PublicURLShared bool `json:"public_url_shared"` - DisplayAsBot bool `json:"display_as_bot"` - Username string `json:"username"` - URLPrivate string `json:"url_private"` - URLPrivateDownload string `json:"url_private_download"` - Thumb64 string `json:"thumb_64"` - Thumb80 string `json:"thumb_80"` - Thumb360 string `json:"thumb_360"` - Thumb360W int `json:"thumb_360_w"` - Thumb360H int `json:"thumb_360_h"` - Thumb480 string `json:"thumb_480"` - Thumb480W int `json:"thumb_480_w"` - Thumb480H int `json:"thumb_480_h"` - Thumb160 string `json:"thumb_160"` - Thumb720 string `json:"thumb_720"` - Thumb720W int `json:"thumb_720_w"` - Thumb720H int `json:"thumb_720_h"` - Thumb800 string `json:"thumb_800"` - Thumb800W int `json:"thumb_800_w"` - Thumb800H int `json:"thumb_800_h"` - Thumb960 string `json:"thumb_960"` - Thumb960W int `json:"thumb_960_w"` - Thumb960H int `json:"thumb_960_h"` - Thumb1024 string `json:"thumb_1024"` - Thumb1024W int `json:"thumb_1024_w"` - Thumb1024H int `json:"thumb_1024_h"` - ImageExifRotation int `json:"image_exif_rotation"` - OriginalW int `json:"original_w"` - OriginalH int `json:"original_h"` - Permalink string `json:"permalink"` - PermalinkPublic string `json:"permalink_public"` + ID string `json:"id"` + Created int `json:"created"` + Timestamp int `json:"timestamp"` + Name string `json:"name"` + Title string `json:"title"` + Mimetype string `json:"mimetype"` + Filetype string `json:"filetype"` + PrettyType string `json:"pretty_type"` + User string `json:"user"` + Editable bool `json:"editable"` + Size int `json:"size"` + Mode string `json:"mode"` + IsExternal bool `json:"is_external"` + ExternalType string `json:"external_type"` + IsPublic bool `json:"is_public"` + PublicURLShared bool `json:"public_url_shared"` + DisplayAsBot bool `json:"display_as_bot"` + Username string `json:"username"` + URLPrivate string `json:"url_private"` + URLPrivateDownload string `json:"url_private_download"` + Thumb64 string `json:"thumb_64"` + Thumb80 string `json:"thumb_80"` + Thumb360 string `json:"thumb_360"` + Thumb360W int `json:"thumb_360_w"` + Thumb360H int `json:"thumb_360_h"` + Thumb480 string `json:"thumb_480"` + Thumb480W int `json:"thumb_480_w"` + Thumb480H int `json:"thumb_480_h"` + Thumb160 string `json:"thumb_160"` + Thumb720 string `json:"thumb_720"` + Thumb720W int `json:"thumb_720_w"` + Thumb720H int `json:"thumb_720_h"` + Thumb800 string `json:"thumb_800"` + Thumb800W int `json:"thumb_800_w"` + Thumb800H int `json:"thumb_800_h"` + Thumb960 string `json:"thumb_960"` + Thumb960W int `json:"thumb_960_w"` + Thumb960H int `json:"thumb_960_h"` + Thumb1024 string `json:"thumb_1024"` + Thumb1024W int `json:"thumb_1024_w"` + Thumb1024H int `json:"thumb_1024_h"` + ImageExifRotation int `json:"image_exif_rotation"` + OriginalW int `json:"original_w"` + OriginalH int `json:"original_h"` + Permalink string `json:"permalink"` + PermalinkPublic string `json:"permalink_public"` } // Edited is included when a Message is edited type Edited struct { - User string `json:"user"` - TimeStamp string `json:"ts"` + User string `json:"user"` + TimeStamp string `json:"ts"` } // Icon is used for bot messages type Icon struct { - IconURL string `json:"icon_url,omitempty"` - IconEmoji string `json:"icon_emoji,omitempty"` + IconURL string `json:"icon_url,omitempty"` + IconEmoji string `json:"icon_emoji,omitempty"` } // Item is any type of slack message - message, file, or file comment. type Item struct { - Type string `json:"type"` - Channel string `json:"channel,omitempty"` - Message *ItemMessage `json:"message,omitempty"` - File *File `json:"file,omitempty"` - Comment *Comment `json:"comment,omitempty"` - Timestamp string `json:"ts,omitempty"` + Type string `json:"type"` + Channel string `json:"channel,omitempty"` + Message *ItemMessage `json:"message,omitempty"` + File *File `json:"file,omitempty"` + Comment *Comment `json:"comment,omitempty"` + Timestamp string `json:"ts,omitempty"` } // ItemMessage is the event message type ItemMessage struct { - Type string `json:"type"` - User string `json:"user"` - Text string `json:"text"` - Timestamp string `json:"ts"` - PinnedTo []string `json:"pinned_to"` - ReplaceOriginal bool `json:"replace_original"` - DeleteOriginal bool `json:"delete_original"` + Type string `json:"type"` + User string `json:"user"` + Text string `json:"text"` + Timestamp string `json:"ts"` + PinnedTo []string `json:"pinned_to"` + ReplaceOriginal bool `json:"replace_original"` + DeleteOriginal bool `json:"delete_original"` } // IsEdited checks if the MessageEvent is caused by an edit func (e MessageEvent) IsEdited() bool { - return e.Message != nil && - e.Message.Edited != nil + return e.Message != nil && + e.Message.Edited != nil } const ( - // AppMention is an Events API subscribable event - AppMention = "app_mention" - // AppHomeOpened Your Slack app home was opened - AppHomeOpened = "app_home_opened" - // AppUninstalled Your Slack app was uninstalled. - AppUninstalled = "app_uninstalled" - // ChannelCreated is sent when a new channel is created. - ChannelCreated = "channel_created" - // ChannelDeleted is sent when a channel is deleted. - ChannelDeleted = "channel_deleted" - // ChannelArchive is sent when a channel is archived. - ChannelArchive = "channel_archive" - // ChannelUnarchive is sent when a channel is unarchived. - ChannelUnarchive = "channel_unarchive" - // ChannelLeft is sent when a channel is left. - ChannelLeft = "channel_left" - // ChannelRename is sent when a channel is rename. - ChannelRename = "channel_rename" - // ChannelIDChanged is sent when a channel identifier is changed. - ChannelIDChanged = "channel_id_changed" - // GridMigrationFinished An enterprise grid migration has finished on this workspace. - GridMigrationFinished = "grid_migration_finished" - // GridMigrationStarted An enterprise grid migration has started on this workspace. - GridMigrationStarted = "grid_migration_started" - // LinkShared A message was posted containing one or more links relevant to your application - LinkShared = "link_shared" - // Message A message was posted to a channel, private channel (group), im, or mim - Message = "message" - // Member Joined Channel - MemberJoinedChannel = "member_joined_channel" - // Member Left Channel - MemberLeftChannel = "member_left_channel" - // PinAdded An item was pinned to a channel - PinAdded = "pin_added" - // PinRemoved An item was unpinned from a channel - PinRemoved = "pin_removed" - // ReactionAdded An reaction was added to a message - ReactionAdded = "reaction_added" - // ReactionRemoved An reaction was removed from a message - ReactionRemoved = "reaction_removed" - // TokensRevoked APP's API tokes are revoked - TokensRevoked = "tokens_revoked" - // EmojiChanged A custom emoji has been added or changed - EmojiChanged = "emoji_changed" + // AppMention is an Events API subscribable event + AppMention = "app_mention" + // AppHomeOpened Your Slack app home was opened + AppHomeOpened = "app_home_opened" + // AppUninstalled Your Slack app was uninstalled. + AppUninstalled = "app_uninstalled" + // ChannelCreated is sent when a new channel is created. + ChannelCreated = "channel_created" + // ChannelDeleted is sent when a channel is deleted. + ChannelDeleted = "channel_deleted" + // ChannelArchive is sent when a channel is archived. + ChannelArchive = "channel_archive" + // ChannelUnarchive is sent when a channel is unarchived. + ChannelUnarchive = "channel_unarchive" + // ChannelLeft is sent when a channel is left. + ChannelLeft = "channel_left" + // ChannelRename is sent when a channel is rename. + ChannelRename = "channel_rename" + // ChannelIDChanged is sent when a channel identifier is changed. + ChannelIDChanged = "channel_id_changed" + // GroupDeleted is sent when a group is deleted. + GroupDeleted = "group_deleted" + // GroupArchive is sent when a group is archived. + GroupArchive = "group_archive" + // GroupUnarchive is sent when a group is unarchived. + GroupUnarchive = "group_unarchive" + // GroupLeft is sent when a group is left. + GroupLeft = "group_left" + // GroupRename is sent when a group is renamed. + GroupRename = "group_rename" + // GridMigrationFinished An enterprise grid migration has finished on this workspace. + GridMigrationFinished = "grid_migration_finished" + // GridMigrationStarted An enterprise grid migration has started on this workspace. + GridMigrationStarted = "grid_migration_started" + // LinkShared A message was posted containing one or more links relevant to your application + LinkShared = "link_shared" + // Message A message was posted to a channel, private channel (group), im, or mim + Message = "message" + // Member Joined Channel + MemberJoinedChannel = "member_joined_channel" + // Member Left Channel + MemberLeftChannel = "member_left_channel" + // PinAdded An item was pinned to a channel + PinAdded = "pin_added" + // PinRemoved An item was unpinned from a channel + PinRemoved = "pin_removed" + // ReactionAdded An reaction was added to a message + ReactionAdded = "reaction_added" + // ReactionRemoved An reaction was removed from a message + ReactionRemoved = "reaction_removed" + // TokensRevoked APP's API tokes are revoked + TokensRevoked = "tokens_revoked" + // EmojiChanged A custom emoji has been added or changed + EmojiChanged = "emoji_changed" ) // EventsAPIInnerEventMapping maps INNER Event API events to their corresponding struct // implementations. The structs should be instances of the unmarshalling // target for the matching event type. var EventsAPIInnerEventMapping = map[string]interface{}{ - AppMention: AppMentionEvent{}, - AppHomeOpened: AppHomeOpenedEvent{}, - AppUninstalled: AppUninstalledEvent{}, - ChannelCreated: ChannelCreatedEvent{}, - ChannelDeleted: ChannelDeletedEvent{}, - ChannelArchive: ChannelArchiveEvent{}, - ChannelUnarchive: ChannelUnarchiveEvent{}, - ChannelLeft: ChannelLeftEvent{}, - ChannelRename: ChannelRenameEvent{}, - ChannelIDChanged: ChannelIDChangedEvent{}, - GridMigrationFinished: GridMigrationFinishedEvent{}, - GridMigrationStarted: GridMigrationStartedEvent{}, - LinkShared: LinkSharedEvent{}, - Message: MessageEvent{}, - MemberJoinedChannel: MemberJoinedChannelEvent{}, - MemberLeftChannel: MemberLeftChannelEvent{}, - PinAdded: PinAddedEvent{}, - PinRemoved: PinRemovedEvent{}, - ReactionAdded: ReactionAddedEvent{}, - ReactionRemoved: ReactionRemovedEvent{}, - TokensRevoked: TokensRevokedEvent{}, - EmojiChanged: EmojiChangedEvent{}, + AppMention: AppMentionEvent{}, + AppHomeOpened: AppHomeOpenedEvent{}, + AppUninstalled: AppUninstalledEvent{}, + ChannelCreated: ChannelCreatedEvent{}, + ChannelDeleted: ChannelDeletedEvent{}, + ChannelArchive: ChannelArchiveEvent{}, + ChannelUnarchive: ChannelUnarchiveEvent{}, + ChannelLeft: ChannelLeftEvent{}, + ChannelRename: ChannelRenameEvent{}, + ChannelIDChanged: ChannelIDChangedEvent{}, + GroupDeleted: GroupDeletedEvent{}, + GroupArchive: GroupArchiveEvent{}, + GroupUnarchive: GroupUnarchiveEvent{}, + GroupLeft: GroupLeftEvent{}, + GroupRename: GroupRenameEvent{}, + GridMigrationFinished: GridMigrationFinishedEvent{}, + GridMigrationStarted: GridMigrationStartedEvent{}, + LinkShared: LinkSharedEvent{}, + Message: MessageEvent{}, + MemberJoinedChannel: MemberJoinedChannelEvent{}, + MemberLeftChannel: MemberLeftChannelEvent{}, + PinAdded: PinAddedEvent{}, + PinRemoved: PinRemovedEvent{}, + ReactionAdded: ReactionAddedEvent{}, + ReactionRemoved: ReactionRemovedEvent{}, + TokensRevoked: TokensRevokedEvent{}, + EmojiChanged: EmojiChangedEvent{}, } From ed585f500b20255fe93b4f4b5d70e522e94a3086 Mon Sep 17 00:00:00 2001 From: Valerian Saliou Date: Fri, 20 Aug 2021 15:18:24 +0200 Subject: [PATCH 7/8] Restore original paths --- CHANGELOG.md | 34 ++++++++++----------- README.md | 14 ++++----- block_object.go | 2 +- chat.go | 2 +- errors.go | 2 +- examples/blocks/blocks.go | 2 +- examples/buttons/buttons.go | 2 +- examples/connparams/connparams.go | 2 +- examples/dialog/dialog.go | 2 +- examples/eventsapi/events.go | 4 +-- examples/files/files.go | 2 +- examples/messages/messages.go | 2 +- examples/modal/modal.go | 4 +-- examples/modal_users/users.go | 2 +- examples/pins/pins.go | 2 +- examples/reactions/reactions.go | 2 +- examples/slash/slash.go | 2 +- examples/socketmode/socketmode.go | 6 ++-- examples/stars/stars.go | 2 +- examples/team/team.go | 2 +- examples/users/users.go | 2 +- examples/webhooks/webhooks.go | 4 +-- examples/websocket/websocket.go | 2 +- examples/websocket_respond/respond.go | 2 +- go.mod | 2 +- interactions.go | 2 +- misc.go | 2 +- misc_test.go | 4 +-- slackevents/action_events.go | 2 +- slackevents/inner_events.go | 2 +- slackevents/parsers.go | 2 +- slackevents/parsers_test.go | 2 +- slacktest/data.go | 2 +- slacktest/errors.go | 2 +- slacktest/funcs.go | 2 +- slacktest/handlers.go | 2 +- slacktest/handlers_test.go | 2 +- slacktest/rtm_test.go | 2 +- slacktest/server.go | 2 +- slacktest/server_test.go | 2 +- slacktest/types.go | 2 +- socketmode/client.go | 2 +- socketmode/socket_mode_managed_conn.go | 10 +++--- socketmode/socket_mode_managed_conn_test.go | 4 +-- socketmode/socketmode.go | 2 +- socketmode/socketmode_test.go | 2 +- users.go | 4 +-- views_test.go | 2 +- websocket_managed_conn.go | 8 ++--- websocket_managed_conn_test.go | 4 +-- 50 files changed, 88 insertions(+), 88 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c112f0313..32da687bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,23 +24,23 @@ Thank you for many contributions! - doc: Add logo to README ([#813]) - doc: Update current project status and Add changelog for v0.7.0 ([#814]) -[#753]: https://github.com/crisp-dev/slack/pull/753 -[#755]: https://github.com/crisp-dev/slack/pull/755 -[#772]: https://github.com/crisp-dev/slack/pull/772 -[#773]: https://github.com/crisp-dev/slack/pull/773 -[#778]: https://github.com/crisp-dev/slack/pull/778 -[#779]: https://github.com/crisp-dev/slack/pull/779 -[#782]: https://github.com/crisp-dev/slack/pull/782 -[#783]: https://github.com/crisp-dev/slack/pull/783 -[#787]: https://github.com/crisp-dev/slack/pull/787 -[#790]: https://github.com/crisp-dev/slack/pull/790 -[#791]: https://github.com/crisp-dev/slack/pull/791 -[#793]: https://github.com/crisp-dev/slack/pull/793 -[#794]: https://github.com/crisp-dev/slack/pull/794 -[#800]: https://github.com/crisp-dev/slack/pull/800 -[#810]: https://github.com/crisp-dev/slack/pull/810 -[#813]: https://github.com/crisp-dev/slack/pull/813 -[#814]: https://github.com/crisp-dev/slack/pull/814 +[#753]: https://github.com/slack-go/slack/pull/753 +[#755]: https://github.com/slack-go/slack/pull/755 +[#772]: https://github.com/slack-go/slack/pull/772 +[#773]: https://github.com/slack-go/slack/pull/773 +[#778]: https://github.com/slack-go/slack/pull/778 +[#779]: https://github.com/slack-go/slack/pull/779 +[#782]: https://github.com/slack-go/slack/pull/782 +[#783]: https://github.com/slack-go/slack/pull/783 +[#787]: https://github.com/slack-go/slack/pull/787 +[#790]: https://github.com/slack-go/slack/pull/790 +[#791]: https://github.com/slack-go/slack/pull/791 +[#793]: https://github.com/slack-go/slack/pull/793 +[#794]: https://github.com/slack-go/slack/pull/794 +[#800]: https://github.com/slack-go/slack/pull/800 +[#810]: https://github.com/slack-go/slack/pull/810 +[#813]: https://github.com/slack-go/slack/pull/813 +[#814]: https://github.com/slack-go/slack/pull/814 ### v0.6.0 - August 31, 2019 full differences can be viewed using `git log --oneline --decorate --color v0.5.0..v0.6.0` diff --git a/README.md b/README.md index f24f42adb..dc83eaa81 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Slack API in Go [![Go Reference](https://pkg.go.dev/badge/github.com/crisp-dev/slack.svg)](https://pkg.go.dev/github.com/crisp-dev/slack) +Slack API in Go [![Go Reference](https://pkg.go.dev/badge/github.com/slack-go/slack.svg)](https://pkg.go.dev/github.com/slack-go/slack) =============== This is the original Slack library for Go created by Norberto Lopes, transferred to a Github organization. @@ -15,13 +15,13 @@ a fully managed way. There is currently no major version released. Therefore, minor version releases may include backward incompatible changes. -See [CHANGELOG.md](https://github.com/crisp-dev/slack/blob/master/CHANGELOG.md) or [Releases](https://github.com/crisp-dev/slack/releases) for more information about the changes. +See [CHANGELOG.md](https://github.com/slack-go/slack/blob/master/CHANGELOG.md) or [Releases](https://github.com/slack-go/slack/releases) for more information about the changes. ## Installing ### *go get* - $ go get -u github.com/crisp-dev/slack + $ go get -u github.com/slack-go/slack ## Example @@ -31,7 +31,7 @@ See [CHANGELOG.md](https://github.com/crisp-dev/slack/blob/master/CHANGELOG.md) import ( "fmt" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) func main() { @@ -56,7 +56,7 @@ func main() { import ( "fmt" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) func main() { @@ -72,12 +72,12 @@ func main() { ## Minimal RTM usage: -See https://github.com/crisp-dev/slack/blob/master/examples/websocket/websocket.go +See https://github.com/slack-go/slack/blob/master/examples/websocket/websocket.go ## Minimal EventsAPI usage: -See https://github.com/crisp-dev/slack/blob/master/examples/eventsapi/events.go +See https://github.com/slack-go/slack/blob/master/examples/eventsapi/events.go ## Contributing diff --git a/block_object.go b/block_object.go index ed61ac566..5ced7f92a 100644 --- a/block_object.go +++ b/block_object.go @@ -142,7 +142,7 @@ func (s TextBlockObject) Validate() error { return errors.New("type must be either of plain_text or mrkdwn") } - // https://github.com/crisp-dev/slack/issues/881 + // https://github.com/slack-go/slack/issues/881 if s.Type == "mrkdwn" && s.Emoji { return errors.New("emoji cannot be true in mrkdown") } diff --git a/chat.go b/chat.go index 8b07cdfee..2a1e452ef 100644 --- a/chat.go +++ b/chat.go @@ -9,7 +9,7 @@ import ( "net/url" "strconv" - "github.com/crisp-dev/slack/slackutilsx" + "github.com/slack-go/slack/slackutilsx" ) const ( diff --git a/errors.go b/errors.go index 9d7b57cf5..8be22a659 100644 --- a/errors.go +++ b/errors.go @@ -1,6 +1,6 @@ package slack -import "github.com/crisp-dev/slack/internal/errorsx" +import "github.com/slack-go/slack/internal/errorsx" // Errors returned by various methods. const ( diff --git a/examples/blocks/blocks.go b/examples/blocks/blocks.go index f191e0fd1..28d54d141 100644 --- a/examples/blocks/blocks.go +++ b/examples/blocks/blocks.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) // The functions below mock the different templates slack has as examples on their website. diff --git a/examples/buttons/buttons.go b/examples/buttons/buttons.go index b5cbba8fd..82772faa1 100644 --- a/examples/buttons/buttons.go +++ b/examples/buttons/buttons.go @@ -6,7 +6,7 @@ import ( "net/http" "os" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) func main() { diff --git a/examples/connparams/connparams.go b/examples/connparams/connparams.go index 2152743bc..2bf2dce1d 100644 --- a/examples/connparams/connparams.go +++ b/examples/connparams/connparams.go @@ -6,7 +6,7 @@ import ( "net/url" "os" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) func main() { diff --git a/examples/dialog/dialog.go b/examples/dialog/dialog.go index 0377f9315..4b4d6ab18 100644 --- a/examples/dialog/dialog.go +++ b/examples/dialog/dialog.go @@ -8,7 +8,7 @@ import ( "net/url" "strings" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) var api = slack.New("YOUR_TOKEN") diff --git a/examples/eventsapi/events.go b/examples/eventsapi/events.go index 29a8d5d81..25049ad07 100644 --- a/examples/eventsapi/events.go +++ b/examples/eventsapi/events.go @@ -7,8 +7,8 @@ import ( "net/http" "os" - "github.com/crisp-dev/slack" - "github.com/crisp-dev/slack/slackevents" + "github.com/slack-go/slack" + "github.com/slack-go/slack/slackevents" ) // You more than likely want your "Bot User OAuth Access Token" which starts with "xoxb-" diff --git a/examples/files/files.go b/examples/files/files.go index 66c6b47bf..0eb136a50 100644 --- a/examples/files/files.go +++ b/examples/files/files.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) func main() { diff --git a/examples/messages/messages.go b/examples/messages/messages.go index 36a2d8cb5..dd7f02da0 100644 --- a/examples/messages/messages.go +++ b/examples/messages/messages.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) func main() { diff --git a/examples/modal/modal.go b/examples/modal/modal.go index 4a1af25c5..78bb60e03 100644 --- a/examples/modal/modal.go +++ b/examples/modal/modal.go @@ -18,7 +18,7 @@ import ( "io/ioutil" "net/http" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) func generateModalRequest() slack.ModalViewRequest { @@ -59,7 +59,7 @@ func generateModalRequest() slack.ModalViewRequest { } // This was taken from the slash example -// https://github.com/crisp-dev/slack/blob/master/examples/slash/slash.go +// https://github.com/slack-go/slack/blob/master/examples/slash/slash.go func verifySigningSecret(r *http.Request) error { signingSecret := "YOUR_SIGNING_SECRET_HERE" verifier, err := slack.NewSecretsVerifier(r.Header, signingSecret) diff --git a/examples/modal_users/users.go b/examples/modal_users/users.go index 0d179bce1..9706a0b9e 100644 --- a/examples/modal_users/users.go +++ b/examples/modal_users/users.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) // An example how to open a modal with different kinds of input fields diff --git a/examples/pins/pins.go b/examples/pins/pins.go index 56f82a5ce..d13d2d2c8 100644 --- a/examples/pins/pins.go +++ b/examples/pins/pins.go @@ -4,7 +4,7 @@ import ( "flag" "fmt" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) /* diff --git a/examples/reactions/reactions.go b/examples/reactions/reactions.go index fffacebb8..4e19f508a 100644 --- a/examples/reactions/reactions.go +++ b/examples/reactions/reactions.go @@ -4,7 +4,7 @@ import ( "flag" "fmt" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) func main() { diff --git a/examples/slash/slash.go b/examples/slash/slash.go index ac8fd6180..c70c865ff 100644 --- a/examples/slash/slash.go +++ b/examples/slash/slash.go @@ -8,7 +8,7 @@ import ( "io/ioutil" "net/http" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) func main() { diff --git a/examples/socketmode/socketmode.go b/examples/socketmode/socketmode.go index 1787c9fe9..69e34c294 100644 --- a/examples/socketmode/socketmode.go +++ b/examples/socketmode/socketmode.go @@ -6,10 +6,10 @@ import ( "os" "strings" - "github.com/crisp-dev/slack/socketmode" + "github.com/slack-go/slack/socketmode" - "github.com/crisp-dev/slack" - "github.com/crisp-dev/slack/slackevents" + "github.com/slack-go/slack" + "github.com/slack-go/slack/slackevents" ) func main() { diff --git a/examples/stars/stars.go b/examples/stars/stars.go index 1b7064a28..cc3f9bacb 100644 --- a/examples/stars/stars.go +++ b/examples/stars/stars.go @@ -4,7 +4,7 @@ import ( "flag" "fmt" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) func main() { diff --git a/examples/team/team.go b/examples/team/team.go index 756532424..8d2fcdbc6 100644 --- a/examples/team/team.go +++ b/examples/team/team.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) func main() { diff --git a/examples/users/users.go b/examples/users/users.go index 8ce00683e..d6669b18b 100644 --- a/examples/users/users.go +++ b/examples/users/users.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) func main() { diff --git a/examples/webhooks/webhooks.go b/examples/webhooks/webhooks.go index dc00b843c..7fa5edea9 100644 --- a/examples/webhooks/webhooks.go +++ b/examples/webhooks/webhooks.go @@ -6,7 +6,7 @@ import ( "strconv" "time" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) func main() { @@ -15,7 +15,7 @@ func main() { Fallback: "You successfully posted by Incoming Webhook URL!", AuthorName: "slack-go/slack", AuthorSubname: "github.com", - AuthorLink: "https://github.com/crisp-dev/slack", + AuthorLink: "https://github.com/slack-go/slack", AuthorIcon: "https://avatars2.githubusercontent.com/u/652790", Text: " All text in Slack uses the same system of escaping: chat messages, direct messages, file comments, etc. :smile:\nSee ", Footer: "slack api", diff --git a/examples/websocket/websocket.go b/examples/websocket/websocket.go index de5a635dc..96e110e39 100644 --- a/examples/websocket/websocket.go +++ b/examples/websocket/websocket.go @@ -5,7 +5,7 @@ import ( "log" "os" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) func main() { diff --git a/examples/websocket_respond/respond.go b/examples/websocket_respond/respond.go index ff2f05724..eed3fa834 100644 --- a/examples/websocket_respond/respond.go +++ b/examples/websocket_respond/respond.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) func main() { diff --git a/go.mod b/go.mod index 0990812f7..e93a8a4ac 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/crisp-dev/slack +module github.com/slack-go/slack require ( github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/interactions.go b/interactions.go index 87355c381..391cb987e 100644 --- a/interactions.go +++ b/interactions.go @@ -58,7 +58,7 @@ type InteractionCallback struct { ViewClosedCallback // FIXME(kanata2): just workaround for backward-compatibility. - // See also https://github.com/crisp-dev/slack/issues/816 + // See also https://github.com/slack-go/slack/issues/816 RawState json.RawMessage `json:"state,omitempty"` // BlockActionState stands for the `state` field in block_actions type. diff --git a/misc.go b/misc.go index 44f33b69b..8c50305b2 100644 --- a/misc.go +++ b/misc.go @@ -19,7 +19,7 @@ import ( "strings" "time" - "github.com/crisp-dev/slack/internal/misc" + "github.com/slack-go/slack/internal/misc" ) // SlackResponse handles parsing out errors from the web api. diff --git a/misc_test.go b/misc_test.go index 3e1ac01ac..4dd2a6378 100644 --- a/misc_test.go +++ b/misc_test.go @@ -8,9 +8,9 @@ import ( "sync" "testing" - "github.com/crisp-dev/slack/internal/misc" + "github.com/slack-go/slack/internal/misc" - "github.com/crisp-dev/slack/slackutilsx" + "github.com/slack-go/slack/slackutilsx" ) var ( diff --git a/slackevents/action_events.go b/slackevents/action_events.go index db9aff2a1..c6016f107 100644 --- a/slackevents/action_events.go +++ b/slackevents/action_events.go @@ -3,7 +3,7 @@ package slackevents import ( "encoding/json" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) type MessageActionResponse struct { diff --git a/slackevents/inner_events.go b/slackevents/inner_events.go index 6a9f18140..cc690f7ea 100644 --- a/slackevents/inner_events.go +++ b/slackevents/inner_events.go @@ -5,7 +5,7 @@ package slackevents import ( "encoding/json" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) // EventsAPIInnerEvent the inner event of a EventsAPI event_callback Event. diff --git a/slackevents/parsers.go b/slackevents/parsers.go index f94c428dd..07f296aeb 100644 --- a/slackevents/parsers.go +++ b/slackevents/parsers.go @@ -7,7 +7,7 @@ import ( "fmt" "reflect" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) // eventsMap checks both slack.EventsMapping and diff --git a/slackevents/parsers_test.go b/slackevents/parsers_test.go index e4ca9b35e..8dcdedda0 100644 --- a/slackevents/parsers_test.go +++ b/slackevents/parsers_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) func TestParserOuterCallBackEvent(t *testing.T) { diff --git a/slacktest/data.go b/slacktest/data.go index 4a8f47b03..37d413a0d 100644 --- a/slacktest/data.go +++ b/slacktest/data.go @@ -3,7 +3,7 @@ package slacktest import ( "fmt" - slack "github.com/crisp-dev/slack" + slack "github.com/slack-go/slack" ) const defaultBotName = "TestSlackBot" diff --git a/slacktest/errors.go b/slacktest/errors.go index 8a3958d5d..ec0a9d675 100644 --- a/slacktest/errors.go +++ b/slacktest/errors.go @@ -1,7 +1,7 @@ package slacktest import ( - "github.com/crisp-dev/slack/internal/errorsx" + "github.com/slack-go/slack/internal/errorsx" ) const ( diff --git a/slacktest/funcs.go b/slacktest/funcs.go index 878b2df6b..a5b6470eb 100644 --- a/slacktest/funcs.go +++ b/slacktest/funcs.go @@ -7,7 +7,7 @@ import ( "time" websocket "github.com/gorilla/websocket" - slack "github.com/crisp-dev/slack" + slack "github.com/slack-go/slack" ) func (sts *Server) queueForWebsocket(s, hubname string) { diff --git a/slacktest/handlers.go b/slacktest/handlers.go index c7eee0601..b3f13700c 100644 --- a/slacktest/handlers.go +++ b/slacktest/handlers.go @@ -11,7 +11,7 @@ import ( "time" websocket "github.com/gorilla/websocket" - slack "github.com/crisp-dev/slack" + slack "github.com/slack-go/slack" ) func contextHandler(server *Server, next http.HandlerFunc) http.Handler { diff --git a/slacktest/handlers_test.go b/slacktest/handlers_test.go index 0b849bc7a..9ad35f754 100644 --- a/slacktest/handlers_test.go +++ b/slacktest/handlers_test.go @@ -3,7 +3,7 @@ package slacktest import ( "testing" - slack "github.com/crisp-dev/slack" + slack "github.com/slack-go/slack" "github.com/stretchr/testify/assert" ) diff --git a/slacktest/rtm_test.go b/slacktest/rtm_test.go index 86ef778d9..00a59f5fc 100644 --- a/slacktest/rtm_test.go +++ b/slacktest/rtm_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" "github.com/stretchr/testify/assert" ) diff --git a/slacktest/server.go b/slacktest/server.go index de3daece1..aa6c0a180 100644 --- a/slacktest/server.go +++ b/slacktest/server.go @@ -8,7 +8,7 @@ import ( "net/http/httptest" "time" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) func newMessageChannels() *messageChannels { diff --git a/slacktest/server_test.go b/slacktest/server_test.go index baa066f8a..5902282c1 100644 --- a/slacktest/server_test.go +++ b/slacktest/server_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" "github.com/stretchr/testify/assert" ) diff --git a/slacktest/types.go b/slacktest/types.go index 3a60c1480..4c90ed9ba 100644 --- a/slacktest/types.go +++ b/slacktest/types.go @@ -6,7 +6,7 @@ import ( "net/http/httptest" "sync" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" ) type contextKey string diff --git a/socketmode/client.go b/socketmode/client.go index e4120c511..c208517b8 100644 --- a/socketmode/client.go +++ b/socketmode/client.go @@ -4,7 +4,7 @@ import ( "encoding/json" "time" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" "github.com/gorilla/websocket" ) diff --git a/socketmode/socket_mode_managed_conn.go b/socketmode/socket_mode_managed_conn.go index 60cb7564f..9373a6be0 100644 --- a/socketmode/socket_mode_managed_conn.go +++ b/socketmode/socket_mode_managed_conn.go @@ -11,13 +11,13 @@ import ( "sync" "time" - "github.com/crisp-dev/slack" - "github.com/crisp-dev/slack/internal/backoff" - "github.com/crisp-dev/slack/internal/misc" - "github.com/crisp-dev/slack/slackevents" + "github.com/slack-go/slack" + "github.com/slack-go/slack/internal/backoff" + "github.com/slack-go/slack/internal/misc" + "github.com/slack-go/slack/slackevents" "github.com/gorilla/websocket" - "github.com/crisp-dev/slack/internal/timex" + "github.com/slack-go/slack/internal/timex" ) // Run is a blocking function that connects the Slack Socket Mode API and handles all incoming diff --git a/socketmode/socket_mode_managed_conn_test.go b/socketmode/socket_mode_managed_conn_test.go index 645a9872f..23bba7f50 100644 --- a/socketmode/socket_mode_managed_conn_test.go +++ b/socketmode/socket_mode_managed_conn_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "github.com/crisp-dev/slack" - "github.com/crisp-dev/slack/slacktest" + "github.com/slack-go/slack" + "github.com/slack-go/slack/slacktest" "github.com/stretchr/testify/assert" ) diff --git a/socketmode/socketmode.go b/socketmode/socketmode.go index 45143188f..752be8cdf 100644 --- a/socketmode/socketmode.go +++ b/socketmode/socketmode.go @@ -6,7 +6,7 @@ import ( "os" "time" - "github.com/crisp-dev/slack" + "github.com/slack-go/slack" "github.com/gorilla/websocket" ) diff --git a/socketmode/socketmode_test.go b/socketmode/socketmode_test.go index 77b2dcf2a..b9ce77690 100644 --- a/socketmode/socketmode_test.go +++ b/socketmode/socketmode_test.go @@ -6,7 +6,7 @@ import ( "reflect" "testing" - "github.com/crisp-dev/slack/slackevents" + "github.com/slack-go/slack/slackevents" "github.com/pkg/errors" ) diff --git a/users.go b/users.go index 1189195c0..3696e37fc 100644 --- a/users.go +++ b/users.go @@ -46,14 +46,14 @@ type UserProfile struct { // UserProfileCustomFields represents user profile's custom fields. // Slack API's response data type is inconsistent so we use the struct. // For detail, please see below. -// https://github.com/crisp-dev/slack/pull/298#discussion_r185159233 +// https://github.com/slack-go/slack/pull/298#discussion_r185159233 type UserProfileCustomFields struct { fields map[string]UserProfileCustomField } // UnmarshalJSON is the implementation of the json.Unmarshaler interface. func (fields *UserProfileCustomFields) UnmarshalJSON(b []byte) error { - // https://github.com/crisp-dev/slack/pull/298#discussion_r185159233 + // https://github.com/slack-go/slack/pull/298#discussion_r185159233 if string(b) == "[]" { return nil } diff --git a/views_test.go b/views_test.go index 6ff8c901f..1dc1438ad 100644 --- a/views_test.go +++ b/views_test.go @@ -6,7 +6,7 @@ import ( "reflect" "testing" - "github.com/crisp-dev/slack/internal/errorsx" + "github.com/slack-go/slack/internal/errorsx" "github.com/stretchr/testify/assert" ) diff --git a/websocket_managed_conn.go b/websocket_managed_conn.go index 1ff68e0f7..5555c3162 100644 --- a/websocket_managed_conn.go +++ b/websocket_managed_conn.go @@ -9,12 +9,12 @@ import ( "reflect" "time" - "github.com/crisp-dev/slack/internal/backoff" - "github.com/crisp-dev/slack/internal/misc" + "github.com/slack-go/slack/internal/backoff" + "github.com/slack-go/slack/internal/misc" "github.com/gorilla/websocket" - "github.com/crisp-dev/slack/internal/errorsx" - "github.com/crisp-dev/slack/internal/timex" + "github.com/slack-go/slack/internal/errorsx" + "github.com/slack-go/slack/internal/timex" ) // ManageConnection can be called on a Slack RTM instance returned by the diff --git a/websocket_managed_conn_test.go b/websocket_managed_conn_test.go index 21bafeede..bb4e3e4d5 100644 --- a/websocket_managed_conn_test.go +++ b/websocket_managed_conn_test.go @@ -8,8 +8,8 @@ import ( "time" websocket "github.com/gorilla/websocket" - "github.com/crisp-dev/slack" - "github.com/crisp-dev/slack/slacktest" + "github.com/slack-go/slack" + "github.com/slack-go/slack/slacktest" "github.com/stretchr/testify/assert" ) From 1f136fac7183582a89d2d7b8d97844d7c991de2f Mon Sep 17 00:00:00 2001 From: Valerian Saliou Date: Fri, 20 Aug 2021 15:20:08 +0200 Subject: [PATCH 8/8] Restore original intents --- slackevents/inner_events.go | 592 ++++++++++++++++++------------------ 1 file changed, 296 insertions(+), 296 deletions(-) diff --git a/slackevents/inner_events.go b/slackevents/inner_events.go index cc690f7ea..57324ff95 100644 --- a/slackevents/inner_events.go +++ b/slackevents/inner_events.go @@ -3,176 +3,176 @@ package slackevents import ( - "encoding/json" + "encoding/json" - "github.com/slack-go/slack" + "github.com/slack-go/slack" ) // EventsAPIInnerEvent the inner event of a EventsAPI event_callback Event. type EventsAPIInnerEvent struct { - Type string `json:"type"` - Data interface{} + Type string `json:"type"` + Data interface{} } // AppMentionEvent is an (inner) EventsAPI subscribable event. type AppMentionEvent struct { - Type string `json:"type"` - User string `json:"user"` - Text string `json:"text"` - TimeStamp string `json:"ts"` - ThreadTimeStamp string `json:"thread_ts"` - Channel string `json:"channel"` - EventTimeStamp json.Number `json:"event_ts"` + Type string `json:"type"` + User string `json:"user"` + Text string `json:"text"` + TimeStamp string `json:"ts"` + ThreadTimeStamp string `json:"thread_ts"` + Channel string `json:"channel"` + EventTimeStamp json.Number `json:"event_ts"` - // When Message comes from a channel that is shared between workspaces - UserTeam string `json:"user_team,omitempty"` - SourceTeam string `json:"source_team,omitempty"` + // When Message comes from a channel that is shared between workspaces + UserTeam string `json:"user_team,omitempty"` + SourceTeam string `json:"source_team,omitempty"` - // BotID is filled out when a bot triggers the app_mention event - BotID string `json:"bot_id,omitempty"` + // BotID is filled out when a bot triggers the app_mention event + BotID string `json:"bot_id,omitempty"` } // AppHomeOpenedEvent Your Slack app home was opened. type AppHomeOpenedEvent struct { - Type string `json:"type"` - User string `json:"user"` - Channel string `json:"channel"` - EventTimeStamp json.Number `json:"event_ts"` - Tab string `json:"tab"` - View slack.View `json:"view"` + Type string `json:"type"` + User string `json:"user"` + Channel string `json:"channel"` + EventTimeStamp json.Number `json:"event_ts"` + Tab string `json:"tab"` + View slack.View `json:"view"` } // AppUninstalledEvent Your Slack app was uninstalled. type AppUninstalledEvent struct { - Type string `json:"type"` + Type string `json:"type"` } // ChannelCreatedEvent represents the Channel created event type ChannelCreatedEvent struct { - Type string `json:"type"` - Channel ChannelCreatedInfo `json:"channel"` - EventTimestamp string `json:"event_ts"` + Type string `json:"type"` + Channel ChannelCreatedInfo `json:"channel"` + EventTimestamp string `json:"event_ts"` } // ChannelDeletedEvent represents the Channel deleted event type ChannelDeletedEvent struct { - Type string `json:"type"` - Channel string `json:"channel"` + Type string `json:"type"` + Channel string `json:"channel"` } // ChannelArchiveEvent represents the Channel archive event type ChannelArchiveEvent struct { - Type string `json:"type"` - Channel string `json:"channel"` - User string `json:"user"` + Type string `json:"type"` + Channel string `json:"channel"` + User string `json:"user"` } // ChannelUnarchiveEvent represents the Channel unarchive event type ChannelUnarchiveEvent struct { - Type string `json:"type"` - Channel string `json:"channel"` - User string `json:"user"` + Type string `json:"type"` + Channel string `json:"channel"` + User string `json:"user"` } // ChannelLeftEvent represents the Channel left event type ChannelLeftEvent struct { - Type string `json:"type"` - Channel string `json:"channel"` + Type string `json:"type"` + Channel string `json:"channel"` } // ChannelRenameEvent represents the Channel rename event type ChannelRenameEvent struct { - Type string `json:"type"` - Channel ChannelRenameInfo `json:"channel"` + Type string `json:"type"` + Channel ChannelRenameInfo `json:"channel"` } // ChannelIDChangedEvent represents the Channel identifier changed event type ChannelIDChangedEvent struct { - Type string `json:"type"` - OldChannelID string `json:"old_channel_id"` - NewChannelID string `json:"new_channel_id"` - EventTimestamp string `json:"event_ts"` + Type string `json:"type"` + OldChannelID string `json:"old_channel_id"` + NewChannelID string `json:"new_channel_id"` + EventTimestamp string `json:"event_ts"` } // ChannelCreatedInfo represents the information associated with the Channel created event type ChannelCreatedInfo struct { - ID string `json:"id"` - IsChannel bool `json:"is_channel"` - Name string `json:"name"` - Created int `json:"created"` - Creator string `json:"creator"` + ID string `json:"id"` + IsChannel bool `json:"is_channel"` + Name string `json:"name"` + Created int `json:"created"` + Creator string `json:"creator"` } // ChannelRenameInfo represents the information associated with the Channel rename event type ChannelRenameInfo struct { - ID string `json:"id"` - Name string `json:"name"` - Created int `json:"created"` + ID string `json:"id"` + Name string `json:"name"` + Created int `json:"created"` } // GroupDeletedEvent represents the Group deleted event type GroupDeletedEvent struct { - Type string `json:"type"` - Channel string `json:"channel"` + Type string `json:"type"` + Channel string `json:"channel"` } // GroupArchiveEvent represents the Group archive event type GroupArchiveEvent struct { - Type string `json:"type"` - Channel string `json:"channel"` + Type string `json:"type"` + Channel string `json:"channel"` } // GroupUnarchiveEvent represents the Group unarchive event type GroupUnarchiveEvent struct { - Type string `json:"type"` - Channel string `json:"channel"` + Type string `json:"type"` + Channel string `json:"channel"` } // GroupLeftEvent represents the Group left event type GroupLeftEvent struct { - Type string `json:"type"` - Channel string `json:"channel"` + Type string `json:"type"` + Channel string `json:"channel"` } // GroupRenameEvent represents the Group rename event type GroupRenameEvent struct { - Type string `json:"type"` - Channel GroupRenameInfo `json:"channel"` + Type string `json:"type"` + Channel GroupRenameInfo `json:"channel"` } // GroupRenameInfo represents the information associated with the Group rename event type GroupRenameInfo struct { - ID string `json:"id"` - Name string `json:"name"` - Created int `json:"created"` + ID string `json:"id"` + Name string `json:"name"` + Created int `json:"created"` } // GridMigrationFinishedEvent An enterprise grid migration has finished on this workspace. type GridMigrationFinishedEvent struct { - Type string `json:"type"` - EnterpriseID string `json:"enterprise_id"` + Type string `json:"type"` + EnterpriseID string `json:"enterprise_id"` } // GridMigrationStartedEvent An enterprise grid migration has started on this workspace. type GridMigrationStartedEvent struct { - Type string `json:"type"` - EnterpriseID string `json:"enterprise_id"` + Type string `json:"type"` + EnterpriseID string `json:"enterprise_id"` } // LinkSharedEvent A message was posted containing one or more links relevant to your application type LinkSharedEvent struct { - Type string `json:"type"` - User string `json:"user"` - TimeStamp string `json:"ts"` - Channel string `json:"channel"` - MessageTimeStamp json.Number `json:"message_ts"` - ThreadTimeStamp string `json:"thread_ts"` - Links []sharedLinks `json:"links"` + Type string `json:"type"` + User string `json:"user"` + TimeStamp string `json:"ts"` + Channel string `json:"channel"` + MessageTimeStamp json.Number `json:"message_ts"` + ThreadTimeStamp string `json:"thread_ts"` + Links []sharedLinks `json:"links"` } type sharedLinks struct { - Domain string `json:"domain"` - URL string `json:"url"` + Domain string `json:"domain"` + URL string `json:"url"` } // MessageEvent occurs when a variety of types of messages has been posted. @@ -183,80 +183,80 @@ type sharedLinks struct { // if ChannelType = "mim", A message was posted in a multiparty direct message channel // TODO: Improve this so that it is not required to manually parse ChannelType type MessageEvent struct { - // Basic Message Event - https://api.slack.com/events/message - ClientMsgID string `json:"client_msg_id"` - Type string `json:"type"` - User string `json:"user"` - Text string `json:"text"` - ThreadTimeStamp string `json:"thread_ts"` - TimeStamp string `json:"ts"` - Channel string `json:"channel"` - ChannelType string `json:"channel_type"` - EventTimeStamp json.Number `json:"event_ts"` + // Basic Message Event - https://api.slack.com/events/message + ClientMsgID string `json:"client_msg_id"` + Type string `json:"type"` + User string `json:"user"` + Text string `json:"text"` + ThreadTimeStamp string `json:"thread_ts"` + TimeStamp string `json:"ts"` + Channel string `json:"channel"` + ChannelType string `json:"channel_type"` + EventTimeStamp json.Number `json:"event_ts"` - // When Message comes from a channel that is shared between workspaces - UserTeam string `json:"user_team,omitempty"` - SourceTeam string `json:"source_team,omitempty"` + // When Message comes from a channel that is shared between workspaces + UserTeam string `json:"user_team,omitempty"` + SourceTeam string `json:"source_team,omitempty"` - // Edited Message - Message *MessageEvent `json:"message,omitempty"` - PreviousMessage *MessageEvent `json:"previous_message,omitempty"` - Edited *Edited `json:"edited,omitempty"` + // Edited Message + Message *MessageEvent `json:"message,omitempty"` + PreviousMessage *MessageEvent `json:"previous_message,omitempty"` + Edited *Edited `json:"edited,omitempty"` - // Message Subtypes - SubType string `json:"subtype,omitempty"` + // Message Subtypes + SubType string `json:"subtype,omitempty"` - // bot_message (https://api.slack.com/events/message/bot_message) - BotID string `json:"bot_id,omitempty"` - Username string `json:"username,omitempty"` - Icons *Icon `json:"icons,omitempty"` + // bot_message (https://api.slack.com/events/message/bot_message) + BotID string `json:"bot_id,omitempty"` + Username string `json:"username,omitempty"` + Icons *Icon `json:"icons,omitempty"` - Upload bool `json:"upload"` - Files []File `json:"files"` + Upload bool `json:"upload"` + Files []File `json:"files"` - Attachments []slack.Attachment `json:"attachments,omitempty"` + Attachments []slack.Attachment `json:"attachments,omitempty"` - // Root is the message that was broadcast to the channel when the SubType is - // thread_broadcast. If this is not a thread_broadcast message event, this - // value is nil. - Root *MessageEvent `json:"root"` + // Root is the message that was broadcast to the channel when the SubType is + // thread_broadcast. If this is not a thread_broadcast message event, this + // value is nil. + Root *MessageEvent `json:"root"` } // MemberJoinedChannelEvent A member joined a public or private channel type MemberJoinedChannelEvent struct { - Type string `json:"type"` - User string `json:"user"` - Channel string `json:"channel"` - ChannelType string `json:"channel_type"` - Team string `json:"team"` - Inviter string `json:"inviter"` + Type string `json:"type"` + User string `json:"user"` + Channel string `json:"channel"` + ChannelType string `json:"channel_type"` + Team string `json:"team"` + Inviter string `json:"inviter"` } // MemberLeftChannelEvent A member left a public or private channel type MemberLeftChannelEvent struct { - Type string `json:"type"` - User string `json:"user"` - Channel string `json:"channel"` - ChannelType string `json:"channel_type"` - Team string `json:"team"` + Type string `json:"type"` + User string `json:"user"` + Channel string `json:"channel"` + ChannelType string `json:"channel_type"` + Team string `json:"team"` } type pinEvent struct { - Type string `json:"type"` - User string `json:"user"` - Item Item `json:"item"` - Channel string `json:"channel_id"` - EventTimestamp string `json:"event_ts"` - HasPins bool `json:"has_pins,omitempty"` + Type string `json:"type"` + User string `json:"user"` + Item Item `json:"item"` + Channel string `json:"channel_id"` + EventTimestamp string `json:"event_ts"` + HasPins bool `json:"has_pins,omitempty"` } type reactionEvent struct { - Type string `json:"type"` - User string `json:"user"` - Reaction string `json:"reaction"` - ItemUser string `json:"item_user"` - Item Item `json:"item"` - EventTimestamp string `json:"event_ts"` + Type string `json:"type"` + User string `json:"user"` + Reaction string `json:"reaction"` + ItemUser string `json:"item_user"` + Item Item `json:"item"` + EventTimestamp string `json:"event_ts"` } // ReactionAddedEvent An reaction was added to a message - https://api.slack.com/events/reaction_added @@ -272,34 +272,34 @@ type PinAddedEvent pinEvent type PinRemovedEvent pinEvent type tokens struct { - Oauth []string `json:"oauth"` - Bot []string `json:"bot"` + Oauth []string `json:"oauth"` + Bot []string `json:"bot"` } // TokensRevokedEvent APP's API tokes are revoked - https://api.slack.com/events/tokens_revoked type TokensRevokedEvent struct { - Type string `json:"type"` - Tokens tokens `json:"tokens"` + Type string `json:"type"` + Tokens tokens `json:"tokens"` } // EmojiChangedEvent is the event of custom emoji has been added or changed type EmojiChangedEvent struct { - Type string `json:"type"` - Subtype string `json:"subtype"` - EventTimeStamp json.Number `json:"event_ts"` + Type string `json:"type"` + Subtype string `json:"subtype"` + EventTimeStamp json.Number `json:"event_ts"` - // filled out when custom emoji added - Name string `json:"name,omitempty"` + // filled out when custom emoji added + Name string `json:"name,omitempty"` - // filled out when custom emoji removed - Names []string `json:"names,omitempty"` + // filled out when custom emoji removed + Names []string `json:"names,omitempty"` - // filled out when custom emoji renamed - OldName string `json:"old_name,omitempty"` - NewName string `json:"new_name,omitempty"` + // filled out when custom emoji renamed + OldName string `json:"old_name,omitempty"` + NewName string `json:"new_name,omitempty"` - // filled out when custom emoji added or renamed - Value string `json:"value,omitempty"` + // filled out when custom emoji added or renamed + Value string `json:"value,omitempty"` } // JSONTime exists so that we can have a String method converting the date @@ -307,188 +307,188 @@ type JSONTime int64 // Comment contains all the information relative to a comment type Comment struct { - ID string `json:"id,omitempty"` - Created JSONTime `json:"created,omitempty"` - Timestamp JSONTime `json:"timestamp,omitempty"` - User string `json:"user,omitempty"` - Comment string `json:"comment,omitempty"` + ID string `json:"id,omitempty"` + Created JSONTime `json:"created,omitempty"` + Timestamp JSONTime `json:"timestamp,omitempty"` + User string `json:"user,omitempty"` + Comment string `json:"comment,omitempty"` } // File is a file upload type File struct { - ID string `json:"id"` - Created int `json:"created"` - Timestamp int `json:"timestamp"` - Name string `json:"name"` - Title string `json:"title"` - Mimetype string `json:"mimetype"` - Filetype string `json:"filetype"` - PrettyType string `json:"pretty_type"` - User string `json:"user"` - Editable bool `json:"editable"` - Size int `json:"size"` - Mode string `json:"mode"` - IsExternal bool `json:"is_external"` - ExternalType string `json:"external_type"` - IsPublic bool `json:"is_public"` - PublicURLShared bool `json:"public_url_shared"` - DisplayAsBot bool `json:"display_as_bot"` - Username string `json:"username"` - URLPrivate string `json:"url_private"` - URLPrivateDownload string `json:"url_private_download"` - Thumb64 string `json:"thumb_64"` - Thumb80 string `json:"thumb_80"` - Thumb360 string `json:"thumb_360"` - Thumb360W int `json:"thumb_360_w"` - Thumb360H int `json:"thumb_360_h"` - Thumb480 string `json:"thumb_480"` - Thumb480W int `json:"thumb_480_w"` - Thumb480H int `json:"thumb_480_h"` - Thumb160 string `json:"thumb_160"` - Thumb720 string `json:"thumb_720"` - Thumb720W int `json:"thumb_720_w"` - Thumb720H int `json:"thumb_720_h"` - Thumb800 string `json:"thumb_800"` - Thumb800W int `json:"thumb_800_w"` - Thumb800H int `json:"thumb_800_h"` - Thumb960 string `json:"thumb_960"` - Thumb960W int `json:"thumb_960_w"` - Thumb960H int `json:"thumb_960_h"` - Thumb1024 string `json:"thumb_1024"` - Thumb1024W int `json:"thumb_1024_w"` - Thumb1024H int `json:"thumb_1024_h"` - ImageExifRotation int `json:"image_exif_rotation"` - OriginalW int `json:"original_w"` - OriginalH int `json:"original_h"` - Permalink string `json:"permalink"` - PermalinkPublic string `json:"permalink_public"` + ID string `json:"id"` + Created int `json:"created"` + Timestamp int `json:"timestamp"` + Name string `json:"name"` + Title string `json:"title"` + Mimetype string `json:"mimetype"` + Filetype string `json:"filetype"` + PrettyType string `json:"pretty_type"` + User string `json:"user"` + Editable bool `json:"editable"` + Size int `json:"size"` + Mode string `json:"mode"` + IsExternal bool `json:"is_external"` + ExternalType string `json:"external_type"` + IsPublic bool `json:"is_public"` + PublicURLShared bool `json:"public_url_shared"` + DisplayAsBot bool `json:"display_as_bot"` + Username string `json:"username"` + URLPrivate string `json:"url_private"` + URLPrivateDownload string `json:"url_private_download"` + Thumb64 string `json:"thumb_64"` + Thumb80 string `json:"thumb_80"` + Thumb360 string `json:"thumb_360"` + Thumb360W int `json:"thumb_360_w"` + Thumb360H int `json:"thumb_360_h"` + Thumb480 string `json:"thumb_480"` + Thumb480W int `json:"thumb_480_w"` + Thumb480H int `json:"thumb_480_h"` + Thumb160 string `json:"thumb_160"` + Thumb720 string `json:"thumb_720"` + Thumb720W int `json:"thumb_720_w"` + Thumb720H int `json:"thumb_720_h"` + Thumb800 string `json:"thumb_800"` + Thumb800W int `json:"thumb_800_w"` + Thumb800H int `json:"thumb_800_h"` + Thumb960 string `json:"thumb_960"` + Thumb960W int `json:"thumb_960_w"` + Thumb960H int `json:"thumb_960_h"` + Thumb1024 string `json:"thumb_1024"` + Thumb1024W int `json:"thumb_1024_w"` + Thumb1024H int `json:"thumb_1024_h"` + ImageExifRotation int `json:"image_exif_rotation"` + OriginalW int `json:"original_w"` + OriginalH int `json:"original_h"` + Permalink string `json:"permalink"` + PermalinkPublic string `json:"permalink_public"` } // Edited is included when a Message is edited type Edited struct { - User string `json:"user"` - TimeStamp string `json:"ts"` + User string `json:"user"` + TimeStamp string `json:"ts"` } // Icon is used for bot messages type Icon struct { - IconURL string `json:"icon_url,omitempty"` - IconEmoji string `json:"icon_emoji,omitempty"` + IconURL string `json:"icon_url,omitempty"` + IconEmoji string `json:"icon_emoji,omitempty"` } // Item is any type of slack message - message, file, or file comment. type Item struct { - Type string `json:"type"` - Channel string `json:"channel,omitempty"` - Message *ItemMessage `json:"message,omitempty"` - File *File `json:"file,omitempty"` - Comment *Comment `json:"comment,omitempty"` - Timestamp string `json:"ts,omitempty"` + Type string `json:"type"` + Channel string `json:"channel,omitempty"` + Message *ItemMessage `json:"message,omitempty"` + File *File `json:"file,omitempty"` + Comment *Comment `json:"comment,omitempty"` + Timestamp string `json:"ts,omitempty"` } // ItemMessage is the event message type ItemMessage struct { - Type string `json:"type"` - User string `json:"user"` - Text string `json:"text"` - Timestamp string `json:"ts"` - PinnedTo []string `json:"pinned_to"` - ReplaceOriginal bool `json:"replace_original"` - DeleteOriginal bool `json:"delete_original"` + Type string `json:"type"` + User string `json:"user"` + Text string `json:"text"` + Timestamp string `json:"ts"` + PinnedTo []string `json:"pinned_to"` + ReplaceOriginal bool `json:"replace_original"` + DeleteOriginal bool `json:"delete_original"` } // IsEdited checks if the MessageEvent is caused by an edit func (e MessageEvent) IsEdited() bool { - return e.Message != nil && - e.Message.Edited != nil + return e.Message != nil && + e.Message.Edited != nil } const ( - // AppMention is an Events API subscribable event - AppMention = "app_mention" - // AppHomeOpened Your Slack app home was opened - AppHomeOpened = "app_home_opened" - // AppUninstalled Your Slack app was uninstalled. - AppUninstalled = "app_uninstalled" - // ChannelCreated is sent when a new channel is created. - ChannelCreated = "channel_created" - // ChannelDeleted is sent when a channel is deleted. - ChannelDeleted = "channel_deleted" - // ChannelArchive is sent when a channel is archived. - ChannelArchive = "channel_archive" - // ChannelUnarchive is sent when a channel is unarchived. - ChannelUnarchive = "channel_unarchive" - // ChannelLeft is sent when a channel is left. - ChannelLeft = "channel_left" - // ChannelRename is sent when a channel is rename. - ChannelRename = "channel_rename" - // ChannelIDChanged is sent when a channel identifier is changed. - ChannelIDChanged = "channel_id_changed" - // GroupDeleted is sent when a group is deleted. - GroupDeleted = "group_deleted" - // GroupArchive is sent when a group is archived. - GroupArchive = "group_archive" - // GroupUnarchive is sent when a group is unarchived. - GroupUnarchive = "group_unarchive" - // GroupLeft is sent when a group is left. - GroupLeft = "group_left" - // GroupRename is sent when a group is renamed. - GroupRename = "group_rename" - // GridMigrationFinished An enterprise grid migration has finished on this workspace. - GridMigrationFinished = "grid_migration_finished" - // GridMigrationStarted An enterprise grid migration has started on this workspace. - GridMigrationStarted = "grid_migration_started" - // LinkShared A message was posted containing one or more links relevant to your application - LinkShared = "link_shared" - // Message A message was posted to a channel, private channel (group), im, or mim - Message = "message" - // Member Joined Channel - MemberJoinedChannel = "member_joined_channel" - // Member Left Channel - MemberLeftChannel = "member_left_channel" - // PinAdded An item was pinned to a channel - PinAdded = "pin_added" - // PinRemoved An item was unpinned from a channel - PinRemoved = "pin_removed" - // ReactionAdded An reaction was added to a message - ReactionAdded = "reaction_added" - // ReactionRemoved An reaction was removed from a message - ReactionRemoved = "reaction_removed" - // TokensRevoked APP's API tokes are revoked - TokensRevoked = "tokens_revoked" - // EmojiChanged A custom emoji has been added or changed - EmojiChanged = "emoji_changed" + // AppMention is an Events API subscribable event + AppMention = "app_mention" + // AppHomeOpened Your Slack app home was opened + AppHomeOpened = "app_home_opened" + // AppUninstalled Your Slack app was uninstalled. + AppUninstalled = "app_uninstalled" + // ChannelCreated is sent when a new channel is created. + ChannelCreated = "channel_created" + // ChannelDeleted is sent when a channel is deleted. + ChannelDeleted = "channel_deleted" + // ChannelArchive is sent when a channel is archived. + ChannelArchive = "channel_archive" + // ChannelUnarchive is sent when a channel is unarchived. + ChannelUnarchive = "channel_unarchive" + // ChannelLeft is sent when a channel is left. + ChannelLeft = "channel_left" + // ChannelRename is sent when a channel is rename. + ChannelRename = "channel_rename" + // ChannelIDChanged is sent when a channel identifier is changed. + ChannelIDChanged = "channel_id_changed" + // GroupDeleted is sent when a group is deleted. + GroupDeleted = "group_deleted" + // GroupArchive is sent when a group is archived. + GroupArchive = "group_archive" + // GroupUnarchive is sent when a group is unarchived. + GroupUnarchive = "group_unarchive" + // GroupLeft is sent when a group is left. + GroupLeft = "group_left" + // GroupRename is sent when a group is renamed. + GroupRename = "group_rename" + // GridMigrationFinished An enterprise grid migration has finished on this workspace. + GridMigrationFinished = "grid_migration_finished" + // GridMigrationStarted An enterprise grid migration has started on this workspace. + GridMigrationStarted = "grid_migration_started" + // LinkShared A message was posted containing one or more links relevant to your application + LinkShared = "link_shared" + // Message A message was posted to a channel, private channel (group), im, or mim + Message = "message" + // Member Joined Channel + MemberJoinedChannel = "member_joined_channel" + // Member Left Channel + MemberLeftChannel = "member_left_channel" + // PinAdded An item was pinned to a channel + PinAdded = "pin_added" + // PinRemoved An item was unpinned from a channel + PinRemoved = "pin_removed" + // ReactionAdded An reaction was added to a message + ReactionAdded = "reaction_added" + // ReactionRemoved An reaction was removed from a message + ReactionRemoved = "reaction_removed" + // TokensRevoked APP's API tokes are revoked + TokensRevoked = "tokens_revoked" + // EmojiChanged A custom emoji has been added or changed + EmojiChanged = "emoji_changed" ) // EventsAPIInnerEventMapping maps INNER Event API events to their corresponding struct // implementations. The structs should be instances of the unmarshalling // target for the matching event type. var EventsAPIInnerEventMapping = map[string]interface{}{ - AppMention: AppMentionEvent{}, - AppHomeOpened: AppHomeOpenedEvent{}, - AppUninstalled: AppUninstalledEvent{}, - ChannelCreated: ChannelCreatedEvent{}, - ChannelDeleted: ChannelDeletedEvent{}, - ChannelArchive: ChannelArchiveEvent{}, - ChannelUnarchive: ChannelUnarchiveEvent{}, - ChannelLeft: ChannelLeftEvent{}, - ChannelRename: ChannelRenameEvent{}, - ChannelIDChanged: ChannelIDChangedEvent{}, - GroupDeleted: GroupDeletedEvent{}, - GroupArchive: GroupArchiveEvent{}, - GroupUnarchive: GroupUnarchiveEvent{}, - GroupLeft: GroupLeftEvent{}, - GroupRename: GroupRenameEvent{}, - GridMigrationFinished: GridMigrationFinishedEvent{}, - GridMigrationStarted: GridMigrationStartedEvent{}, - LinkShared: LinkSharedEvent{}, - Message: MessageEvent{}, - MemberJoinedChannel: MemberJoinedChannelEvent{}, - MemberLeftChannel: MemberLeftChannelEvent{}, - PinAdded: PinAddedEvent{}, - PinRemoved: PinRemovedEvent{}, - ReactionAdded: ReactionAddedEvent{}, - ReactionRemoved: ReactionRemovedEvent{}, - TokensRevoked: TokensRevokedEvent{}, - EmojiChanged: EmojiChangedEvent{}, + AppMention: AppMentionEvent{}, + AppHomeOpened: AppHomeOpenedEvent{}, + AppUninstalled: AppUninstalledEvent{}, + ChannelCreated: ChannelCreatedEvent{}, + ChannelDeleted: ChannelDeletedEvent{}, + ChannelArchive: ChannelArchiveEvent{}, + ChannelUnarchive: ChannelUnarchiveEvent{}, + ChannelLeft: ChannelLeftEvent{}, + ChannelRename: ChannelRenameEvent{}, + ChannelIDChanged: ChannelIDChangedEvent{}, + GroupDeleted: GroupDeletedEvent{}, + GroupArchive: GroupArchiveEvent{}, + GroupUnarchive: GroupUnarchiveEvent{}, + GroupLeft: GroupLeftEvent{}, + GroupRename: GroupRenameEvent{}, + GridMigrationFinished: GridMigrationFinishedEvent{}, + GridMigrationStarted: GridMigrationStartedEvent{}, + LinkShared: LinkSharedEvent{}, + Message: MessageEvent{}, + MemberJoinedChannel: MemberJoinedChannelEvent{}, + MemberLeftChannel: MemberLeftChannelEvent{}, + PinAdded: PinAddedEvent{}, + PinRemoved: PinRemovedEvent{}, + ReactionAdded: ReactionAddedEvent{}, + ReactionRemoved: ReactionRemovedEvent{}, + TokensRevoked: TokensRevokedEvent{}, + EmojiChanged: EmojiChangedEvent{}, }