-
Notifications
You must be signed in to change notification settings - Fork 1
/
boosts_func.go
52 lines (45 loc) · 1.17 KB
/
boosts_func.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
package telebot
import "encoding/json"
type getUserChatBoosts struct {
ChatID any `json:"chat_id"`
UserID any `json:"user_id"`
}
// GetUserChatBoosts returns a list of boosts added to a chat by a user.
// <a href="https://core.telegram.org/bots/api#getuserchatboosts">/bots/api#getuserchatboosts</a>
//
// chatID: Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
//
// userID: Unique identifier of the target user
//
// Returns: (*UserChatBoosts, error)
//
// Example:
// ```go
//
// chatID := &Chat{ID:1234567890}
// userID := &User{ID:1234567890}
//
// chatBoosts, err := bot.GetUserChatBoosts(chatID, userID)
// if err != nil {
// log.Println(err)
// }
// log.Println(chatBoosts)
//
// ```
func (b *bot) GetUserChatBoosts(chatID Recipient, userID Userable) (*UserChatBoosts, error) {
params := getUserChatBoosts{
ChatID: chatID,
UserID: userID,
}
req, err := b.sendMethodRequest(methodGetUserChatBoosts, params)
if err != nil {
return nil, err
}
var resp struct {
Result UserChatBoosts `json:"result"`
}
if err = json.Unmarshal(req, &resp); err != nil {
return nil, err
}
return &resp.Result, err
}