This repository has been archived by the owner on Aug 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
client.go
40 lines (37 loc) · 1.95 KB
/
client.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
package telegram
import "context"
type Client interface {
GetMe(ctx context.Context) (*User, error)
ForwardMessage(ctx context.Context, chatID ChatID, ref MessageRef, options *SendOptions) (ID, error)
CopyMessage(ctx context.Context, chatID ChatID, ref MessageRef, options *CopyOptions) (ID, error)
DeleteMessage(ctx context.Context, ref MessageRef) error
EditMessageReplyMarkup(ctx context.Context, ref MessageRef, markup ReplyMarkup) (*Message, error)
ExportChatInviteLink(ctx context.Context, chatID ChatID) (string, error)
GetChat(ctx context.Context, chatID ChatID) (*Chat, error)
GetChatAdministrators(ctx context.Context, chatID ChatID) ([]ChatMember, error)
GetChatMemberCount(ctx context.Context, chatID ChatID) (int64, error)
GetChatMember(ctx context.Context, chatID ChatID, userID ID) (*ChatMember, error)
AnswerCallbackQuery(ctx context.Context, id string, options *AnswerOptions) error
Send(ctx context.Context, chatID ChatID, item Sendable, options *SendOptions) (*Message, error)
SendChatAction(ctx context.Context, chatID ChatID, action string) error
SendMediaGroup(ctx context.Context, chatID ChatID, media []Media, options *SendOptions) ([]Message, error)
SetMyCommands(ctx context.Context, scope *BotCommandScope, commands []BotCommand) error
GetMyCommands(ctx context.Context, scope *BotCommandScope) ([]BotCommand, error)
DeleteMyCommands(ctx context.Context, scope *BotCommandScope) error
Ask(ctx context.Context, chatID ChatID, sendable Sendable, options *SendOptions) (*Message, error)
Answer(ctx context.Context, message *Message) error
Username() Username
}
func InlineKeyboard(rows ...[]Button) ReplyMarkup {
keyboard := make([][]InlineKeyboardButton, len(rows))
for i, row := range rows {
keyboard[i] = make([]InlineKeyboardButton, len(row))
for j, button := range row {
keyboard[i][j] = InlineKeyboardButton{
Text: button[0],
CallbackData: button[1] + " " + button[2],
}
}
}
return &InlineKeyboardMarkup{keyboard}
}