-
Notifications
You must be signed in to change notification settings - Fork 147
/
provider.go
36 lines (29 loc) · 876 Bytes
/
provider.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
package message
import (
"github.com/ArtisanCloud/PowerWeChat/v2/src/kernel"
"github.com/ArtisanCloud/PowerWeChat/v2/src/work/message/appChat"
"github.com/ArtisanCloud/PowerWeChat/v2/src/work/message/externalContact"
"github.com/ArtisanCloud/PowerWeChat/v2/src/work/message/linkedCorp"
"reflect"
)
func RegisterProvider(app kernel.ApplicationInterface) (*Client, *Messager,
*appChat.Client,
*externalContact.Client,
*linkedCorp.Client,
) {
config := app.GetConfig()
client := NewClient(app)
AppChat := appChat.NewClient(app)
ExternalContact := externalContact.NewClient(app)
LinkedCorp := linkedCorp.NewClient(app)
messager := NewMessager(client)
agentID := config.Get("agent_id", nil)
switch reflect.TypeOf(agentID).Kind() {
case reflect.Int:
messager.OfAgent(agentID.(int))
}
return client, messager,
AppChat,
ExternalContact,
LinkedCorp
}