-
Notifications
You must be signed in to change notification settings - Fork 2
/
channel.go
51 lines (43 loc) · 1.39 KB
/
channel.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
package account
import (
"github.com/dezhishen/onebot-sdk/pkg/channel"
"github.com/dezhishen/onebot-sdk/pkg/model"
)
type ChannelApiAccountClient struct {
channel.ApiChannel
}
func NewChannelApiAccountClient(channel channel.ApiChannel) (OnebotApiAccountClient, error) {
return &ChannelApiAccountClient{
channel,
}, nil
}
func (cli *ChannelApiAccountClient) GetLoginInfo() (*model.AccountResult, error) {
var result model.AccountResult
if err := cli.PostForResult(API_GET_LOGIN_INFO, &result); err != nil {
return nil, err
}
return &result, nil
}
func (cli *ChannelApiAccountClient) SetQQProfile(profile *model.QQProfile) error {
return cli.PostByRequest(API_SET_QQ_PROFILE, profile)
}
func (cli *ChannelApiAccountClient) GetModelShow() (*model.ModelShowResult, error) {
var result model.ModelShowResult
if err := cli.PostForResult(API__GET_MODEL_SHOW, &result); err != nil {
return nil, err
}
return &result, nil
}
func (cli *ChannelApiAccountClient) SetModelShow(model, modelshow string) error {
req := make(map[string]interface{})
req["model"] = model
req["modelshow"] = modelshow
return cli.PostByRequest(API__SET_MODEL_SHOW, req)
}
func (cli *ChannelApiAccountClient) GetOnlineClients() (*model.OnlineClientsResult, error) {
var result model.OnlineClientsResult
if err := cli.PostForResult(API_GET_ONLINE_CLIENTS, &result); err != nil {
return nil, err
}
return &result, nil
}