blob: 6c2c6abfb0901ff55a9a4687e5d34225cbc2541c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
package slack
import (
"encoding/json"
"fmt"
)
// AckMessage is used for messages received in reply to other messages
type AckMessage struct {
ReplyTo int `json:"reply_to"`
Timestamp string `json:"ts"`
Text string `json:"text"`
RTMResponse
}
// RTMResponse encapsulates response details as returned by the Slack API
type RTMResponse struct {
Ok bool `json:"ok"`
Error *RTMError `json:"error"`
}
// RTMError encapsulates error information as returned by the Slack API
type RTMError struct {
Code int
Msg string
}
func (s RTMError) Error() string {
return fmt.Sprintf("Code %d - %s", s.Code, s.Msg)
}
// MessageEvent represents a Slack Message (used as the event type for an incoming message)
type MessageEvent Message
// RTMEvent is the main wrapper. You will find all the other messages attached
type RTMEvent struct {
Type string
Data interface{}
}
// HelloEvent represents the hello event
type HelloEvent struct{}
// PresenceChangeEvent represents the presence change event
type PresenceChangeEvent struct {
Type string `json:"type"`
Presence string `json:"presence"`
User string `json:"user"`
}
// UserTypingEvent represents the user typing event
type UserTypingEvent struct {
Type string `json:"type"`
User string `json:"user"`
Channel string `json:"channel"`
}
// PrefChangeEvent represents a user preferences change event
type PrefChangeEvent struct {
Type string `json:"type"`
Name string `json:"name"`
Value json.RawMessage `json:"value"`
}
// ManualPresenceChangeEvent represents the manual presence change event
type ManualPresenceChangeEvent struct {
Type string `json:"type"`
Presence string `json:"presence"`
}
// UserChangeEvent represents the user change event
type UserChangeEvent struct {
Type string `json:"type"`
User User `json:"user"`
}
// EmojiChangedEvent represents the emoji changed event
type EmojiChangedEvent struct {
Type string `json:"type"`
EventTimestamp string `json:"event_ts"`
}
// CommandsChangedEvent represents the commands changed event
type CommandsChangedEvent struct {
Type string `json:"type"`
EventTimestamp string `json:"event_ts"`
}
// EmailDomainChangedEvent represents the email domain changed event
type EmailDomainChangedEvent struct {
Type string `json:"type"`
EventTimestamp string `json:"event_ts"`
EmailDomain string `json:"email_domain"`
}
// BotAddedEvent represents the bot added event
type BotAddedEvent struct {
Type string `json:"type"`
Bot Bot `json:"bot"`
}
// BotChangedEvent represents the bot changed event
type BotChangedEvent struct {
Type string `json:"type"`
Bot Bot `json:"bot"`
}
// AccountsChangedEvent represents the accounts changed event
type AccountsChangedEvent struct {
Type string `json:"type"`
}
// ReconnectUrlEvent represents the receiving reconnect url event
type ReconnectUrlEvent struct {
Type string `json:"type"`
URL string `json:"url"`
}
|