forked from nyaruka/courier
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhandler_test.go
More file actions
32 lines (25 loc) · 794 Bytes
/
handler_test.go
File metadata and controls
32 lines (25 loc) · 794 Bytes
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
package courier
import "context"
func init() {
RegisterHandler(NewHandler())
}
type dummyHandler struct {
server Server
backend Backend
}
// NewHandler returns a new Dummy handler
func NewHandler() ChannelHandler {
return &dummyHandler{}
}
func (h *dummyHandler) ChannelName() string { return "Dummy Handler" }
func (h *dummyHandler) ChannelType() ChannelType { return ChannelType("DM") }
// Initialize is called by the engine once everything is loaded
func (h *dummyHandler) Initialize(s Server) error {
h.server = s
h.backend = s.Backend()
return nil
}
// SendMsg sends the passed in message, returning any error
func (h *dummyHandler) SendMsg(ctx context.Context, msg Msg) (MsgStatus, error) {
return h.backend.NewMsgStatusForID(msg.Channel(), msg.ID(), MsgSent), nil
}