forked from mymmrac/telego
-
Notifications
You must be signed in to change notification settings - Fork 0
/
methods.go
232 lines (204 loc) · 6.49 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
package utils
import (
"fmt"
"github.com/dsurl/tgo"
)
// Message creates tgo.SendMessageParams with required parameters
func Message(id tgo.ChatID, text string) *tgo.SendMessageParams {
return &tgo.SendMessageParams{
ChatID: id,
Text: text,
}
}
// Messagef creates tgo.SendMessageParams with required parameters and provided format
func Messagef(id tgo.ChatID, format string, args ...interface{}) *tgo.SendMessageParams {
return &tgo.SendMessageParams{
ChatID: id,
Text: fmt.Sprintf(format, args...),
}
}
// MessageWithEntities creates tgo.SendMessageParams with required parameters and parsed entities
func MessageWithEntities(id tgo.ChatID, entityCollections ...MessageEntityCollection) *tgo.SendMessageParams {
text, entities := MessageEntities(entityCollections...)
return &tgo.SendMessageParams{
ChatID: id,
Text: text,
Entities: entities,
}
}
// Photo creates tgo.SendPhotoParams with required parameters
func Photo(id tgo.ChatID, photo tgo.InputFile) *tgo.SendPhotoParams {
return &tgo.SendPhotoParams{
ChatID: id,
Photo: photo,
}
}
// Audio creates tgo.SendAudioParams with required parameters
func Audio(id tgo.ChatID, audio tgo.InputFile) *tgo.SendAudioParams {
return &tgo.SendAudioParams{
ChatID: id,
Audio: audio,
}
}
// Document creates tgo.SendDocumentParams with required parameters
func Document(id tgo.ChatID, document tgo.InputFile) *tgo.SendDocumentParams {
return &tgo.SendDocumentParams{
ChatID: id,
Document: document,
}
}
// Video creates tgo.SendVideoParams with required parameters
func Video(id tgo.ChatID, video tgo.InputFile) *tgo.SendVideoParams {
return &tgo.SendVideoParams{
ChatID: id,
Video: video,
}
}
// Animation creates tgo.SendAnimationParams with required parameters
func Animation(id tgo.ChatID, animation tgo.InputFile) *tgo.SendAnimationParams {
return &tgo.SendAnimationParams{
ChatID: id,
Animation: animation,
}
}
// Voice creates tgo.SendVoiceParams with required parameters
func Voice(id tgo.ChatID, voice tgo.InputFile) *tgo.SendVoiceParams {
return &tgo.SendVoiceParams{
ChatID: id,
Voice: voice,
}
}
// VideoNote creates tgo.SendVideoNoteParams with required parameters
func VideoNote(id tgo.ChatID, videoNote tgo.InputFile) *tgo.SendVideoNoteParams {
return &tgo.SendVideoNoteParams{
ChatID: id,
VideoNote: videoNote,
}
}
// MediaGroup creates tgo.SendMediaGroupParams with required parameters
func MediaGroup(id tgo.ChatID, mediaGroups ...tgo.InputMedia) *tgo.SendMediaGroupParams {
return &tgo.SendMediaGroupParams{
ChatID: id,
Media: mediaGroups,
}
}
// Location creates tgo.SendLocationParams with required parameters
func Location(id tgo.ChatID, latitude, longitude float64) *tgo.SendLocationParams {
return &tgo.SendLocationParams{
ChatID: id,
Latitude: latitude,
Longitude: longitude,
}
}
// Venue creates tgo.SendVenueParams with required parameters
func Venue(id tgo.ChatID, latitude, longitude float64, title, address string) *tgo.SendVenueParams {
return &tgo.SendVenueParams{
ChatID: id,
Latitude: latitude,
Longitude: longitude,
Title: title,
Address: address,
}
}
// Contact creates tgo.SendContactParams with required parameters
func Contact(id tgo.ChatID, phoneNumber, firstName string) *tgo.SendContactParams {
return &tgo.SendContactParams{
ChatID: id,
PhoneNumber: phoneNumber,
FirstName: firstName,
}
}
// Poll creates tgo.SendPollParams with required parameters
func Poll(id tgo.ChatID, question string, options ...string) *tgo.SendPollParams {
return &tgo.SendPollParams{
ChatID: id,
Question: question,
Options: options,
}
}
// Dice creates tgo.SendDiceParams with required parameters
// Note: Emoji isn't required, but most likely you would what to specify it, you can use tgo.EmojiDice or etc.
func Dice(id tgo.ChatID, emoji string) *tgo.SendDiceParams {
return &tgo.SendDiceParams{
ChatID: id,
Emoji: emoji,
}
}
// ChatAction creates tgo.SendChatActionParams with required parameters
func ChatAction(id tgo.ChatID, action string) *tgo.SendChatActionParams {
return &tgo.SendChatActionParams{
ChatID: id,
Action: action,
}
}
// Sticker creates tgo.SendStickerParams with required parameters
func Sticker(id tgo.ChatID, sticker tgo.InputFile) *tgo.SendStickerParams {
return &tgo.SendStickerParams{
ChatID: id,
Sticker: sticker,
}
}
// Invoice creates tgo.SendInvoiceParams with required parameters
func Invoice(id tgo.ChatID, title, description, payload, providerToken, currency string,
prices ...tgo.LabeledPrice,
) *tgo.SendInvoiceParams {
return &tgo.SendInvoiceParams{
ChatID: id,
Title: title,
Description: description,
Payload: payload,
ProviderToken: providerToken,
Currency: currency,
Prices: prices,
}
}
// Game creates tgo.SendGameParams with required parameters
func Game(id int64, gameShortName string) *tgo.SendGameParams {
return &tgo.SendGameParams{
ChatID: id,
GameShortName: gameShortName,
}
}
// CopyMessage creates tgo.CopyMessageParams with required parameters
func CopyMessage(id, fromID tgo.ChatID, messageID int) *tgo.CopyMessageParams {
return &tgo.CopyMessageParams{
ChatID: id,
FromChatID: fromID,
MessageID: messageID,
}
}
// CallbackQuery creates tgo.AnswerCallbackQueryParams with required parameters
func CallbackQuery(queryID string) *tgo.AnswerCallbackQueryParams {
return &tgo.AnswerCallbackQueryParams{
CallbackQueryID: queryID,
}
}
// InlineQuery creates tgo.AnswerInlineQueryParams with required parameters
func InlineQuery(queryID string, results ...tgo.InlineQueryResult) *tgo.AnswerInlineQueryParams {
return &tgo.AnswerInlineQueryParams{
InlineQueryID: queryID,
Results: results,
}
}
// ShippingQuery creates tgo.AnswerShippingQueryParams with required parameters
func ShippingQuery(queryID string, ok bool, options ...tgo.ShippingOption) *tgo.AnswerShippingQueryParams {
return &tgo.AnswerShippingQueryParams{
ShippingQueryID: queryID,
Ok: ok,
ShippingOptions: options,
}
}
// PreCheckoutQuery creates tgo.AnswerPreCheckoutQueryParams with required parameters
func PreCheckoutQuery(queryID string, ok bool) *tgo.AnswerPreCheckoutQueryParams {
return &tgo.AnswerPreCheckoutQueryParams{
PreCheckoutQueryID: queryID,
Ok: ok,
}
}
// WebAppQuery creates tgo.AnswerWebAppQueryParams with required parameters
func WebAppQuery(queryID string, result tgo.InlineQueryResult) *tgo.AnswerWebAppQueryParams {
return &tgo.AnswerWebAppQueryParams{
WebAppQueryID: queryID,
Result: result,
}
}