-
Notifications
You must be signed in to change notification settings - Fork 0
/
response.go
54 lines (43 loc) · 972 Bytes
/
response.go
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
package axiom
// Response struct
type Response struct {
Robot *Robot
Message *Message
Match []string
}
func NewResponse(robot *Robot, msg *Message) *Response {
return &Response{
Robot: robot,
Message: msg,
}
}
func (res *Response) Text() string {
return res.Message.Text
}
func (res *Response) Room() string {
return res.Message.Room
}
func (res *Response) FromUser() string {
return res.Message.FromUser.ID
}
func (res *Response) FromUserName() string {
return res.Message.FromUser.Name
}
func (res *Response) ToUser() string {
return res.Message.ToUser.ID
}
func (res *Response) ToUserName() string {
return res.Message.ToUser.Name
}
func (res *Response) Send(strings ...string) error {
if err := res.Robot.Provider().Send(res, strings...); err != nil {
return err
}
return nil
}
func (res *Response) Reply(strings ...string) error {
if err := res.Robot.Provider().Reply(res, strings...); err != nil {
return err
}
return nil
}