-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmethods.go
73 lines (65 loc) · 1.63 KB
/
methods.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package telegram
import (
"context"
"errors"
)
var (
ErrNotDeleted = errors.New("telegram: message not deleted")
ErrNotEdited = errors.New("telegram: message not edited")
ErrNotAnswered = errors.New("telegram: query not answered")
)
// https://core.telegram.org/bots/api#getupdates
func (b *bot) GetUpdates(ctx context.Context, opts ...UpdatesOption) ([]*Update, error) {
uo := new(updatesOptions)
for _, opt := range opts {
opt(uo)
}
var v []*Update
if err := b.do(ctx, "getUpdates", uo, &v); err != nil {
return nil, err
}
return v, nil
}
// SetWebhook
// DeleteWebhook
// GetWebhookInfo
// WebhookInfo
// https://core.telegram.org/bots/api#getme
func (b *bot) GetMe(ctx context.Context) (*User, error) {
var u *User
if err := b.do(ctx, "getMe", nil, &u); err != nil {
return nil, err
}
return u, nil
}
// https://core.telegram.org/bots/api#sendchataction
// func (b *bot) SendChatAction(ctx context.Context, action *ChatAction) error {
// var ok bool
// if err := b.do(ctx, "answerCallbackQuery", a, &ok); err != nil {
// return err
// }
// if !ok {
// return ErrNotAnswered
// }
// return nil
// }
// GetUserProfilePhotos
// GetFile
// KickChatMember
// UnbanChatMember
// RestrictChatMember
// PromoteChatMember
// ExportChatInviteLink
// SetChatPhoto
// SetChatDescription
// PinChatMessage
// UnpinChatMessage
// LeaveChat
// GetChat
// GetChatAdministrators
// GetChatMembersCount
// GetChatMembers
// TODO: What does True mean for edit* methods?
// > On success, if edited message is sent by the bot, the edited Message is
// > returned, otherwise True is returned.
// https://core.telegram.org/bots/api#editmessagetext