-
Notifications
You must be signed in to change notification settings - Fork 11
/
methods_gen.go
6711 lines (5799 loc) · 278 KB
/
methods_gen.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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package tg
// Code generated by go-tg-gen (github.com/mr-linch/go-tg-gen). DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.
// GetUpdatesCall reprenesents a call to the getUpdates method.
// Use this method to receive incoming updates using long polling (wiki)
// Returns an Array of Update objects.
type GetUpdatesCall struct {
Call[[]Update]
}
// NewGetUpdatesCall constructs a new GetUpdatesCall with required parameters.
func NewGetUpdatesCall() *GetUpdatesCall {
return &GetUpdatesCall{
Call[[]Update]{
request: NewRequest("getUpdates"),
},
}
}
// GetUpdatesCall constructs a new GetUpdatesCall with required parameters.
func (client *Client) GetUpdates() *GetUpdatesCall {
return BindClient(
NewGetUpdatesCall(),
client,
)
}
// Offset Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will be forgotten.
func (call *GetUpdatesCall) Offset(offset int) *GetUpdatesCall {
call.request.Int("offset", offset)
return call
}
// Limit Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.
func (call *GetUpdatesCall) Limit(limit int) *GetUpdatesCall {
call.request.Int("limit", limit)
return call
}
// Timeout Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.
func (call *GetUpdatesCall) Timeout(timeout int) *GetUpdatesCall {
call.request.Int("timeout", timeout)
return call
}
// AllowedUpdates A JSON-serialized list of the update types you want your bot to receive. For example, specify ["message", "edited_channel_post", "callback_query"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used.Please note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time.
func (call *GetUpdatesCall) AllowedUpdates(allowedUpdates []UpdateType) *GetUpdatesCall {
call.request.JSON("allowed_updates", allowedUpdates)
return call
}
// SetWebhookCall reprenesents a call to the setWebhook method.
// Use this method to specify a URL and receive incoming updates via an outgoing webhook
// Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update
// In case of an unsuccessful request, we will give up after a reasonable amount of attempts
// If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secret_token
// If specified, the request will contain a header “X-Telegram-Bot-Api-Secret-Token” with the secret token as content.
type SetWebhookCall struct {
CallNoResult
}
// NewSetWebhookCall constructs a new SetWebhookCall with required parameters.
// url - HTTPS URL to send updates to. Use an empty string to remove webhook integration
func NewSetWebhookCall(url string) *SetWebhookCall {
return &SetWebhookCall{
CallNoResult{
request: NewRequest("setWebhook").
String("url", url),
},
}
}
// SetWebhookCall constructs a new SetWebhookCall with required parameters.
func (client *Client) SetWebhook(url string) *SetWebhookCall {
return BindClient(
NewSetWebhookCall(url),
client,
)
}
// URL HTTPS URL to send updates to. Use an empty string to remove webhook integration
func (call *SetWebhookCall) URL(url string) *SetWebhookCall {
call.request.String("url", url)
return call
}
// Certificate Upload your public key certificate so that the root certificate in use can be checked. See our self-signed guide for details.
func (call *SetWebhookCall) Certificate(certificate InputFile) *SetWebhookCall {
call.request.JSON("certificate", certificate)
return call
}
// IPAddress The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS
func (call *SetWebhookCall) IPAddress(ipAddress string) *SetWebhookCall {
call.request.String("ip_address", ipAddress)
return call
}
// MaxConnections The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput.
func (call *SetWebhookCall) MaxConnections(maxConnections int) *SetWebhookCall {
call.request.Int("max_connections", maxConnections)
return call
}
// AllowedUpdates A JSON-serialized list of the update types you want your bot to receive. For example, specify ["message", "edited_channel_post", "callback_query"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used.Please note that this parameter doesn't affect updates created before the call to the setWebhook, so unwanted updates may be received for a short period of time.
func (call *SetWebhookCall) AllowedUpdates(allowedUpdates []UpdateType) *SetWebhookCall {
call.request.JSON("allowed_updates", allowedUpdates)
return call
}
// DropPendingUpdates Pass True to drop all pending updates
func (call *SetWebhookCall) DropPendingUpdates(dropPendingUpdates bool) *SetWebhookCall {
call.request.Bool("drop_pending_updates", dropPendingUpdates)
return call
}
// SecretToken A secret token to be sent in a header “X-Telegram-Bot-Api-Secret-Token” in every webhook request, 1-256 characters. Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you.
func (call *SetWebhookCall) SecretToken(secretToken string) *SetWebhookCall {
call.request.String("secret_token", secretToken)
return call
}
// DeleteWebhookCall reprenesents a call to the deleteWebhook method.
// Use this method to remove webhook integration if you decide to switch back to getUpdates
type DeleteWebhookCall struct {
CallNoResult
}
// NewDeleteWebhookCall constructs a new DeleteWebhookCall with required parameters.
func NewDeleteWebhookCall() *DeleteWebhookCall {
return &DeleteWebhookCall{
CallNoResult{
request: NewRequest("deleteWebhook"),
},
}
}
// DeleteWebhookCall constructs a new DeleteWebhookCall with required parameters.
func (client *Client) DeleteWebhook() *DeleteWebhookCall {
return BindClient(
NewDeleteWebhookCall(),
client,
)
}
// DropPendingUpdates Pass True to drop all pending updates
func (call *DeleteWebhookCall) DropPendingUpdates(dropPendingUpdates bool) *DeleteWebhookCall {
call.request.Bool("drop_pending_updates", dropPendingUpdates)
return call
}
// GetWebhookInfoCall reprenesents a call to the getWebhookInfo method.
// Use this method to get current webhook status
// Requires no parameters
// On success, returns a WebhookInfo object
// If the bot is using getUpdates, will return an object with the url field empty.
type GetWebhookInfoCall struct {
Call[WebhookInfo]
}
// NewGetWebhookInfoCall constructs a new GetWebhookInfoCall with required parameters.
func NewGetWebhookInfoCall() *GetWebhookInfoCall {
return &GetWebhookInfoCall{
Call[WebhookInfo]{
request: NewRequest("getWebhookInfo"),
},
}
}
// GetWebhookInfoCall constructs a new GetWebhookInfoCall with required parameters.
func (client *Client) GetWebhookInfo() *GetWebhookInfoCall {
return BindClient(
NewGetWebhookInfoCall(),
client,
)
}
// GetMeCall reprenesents a call to the getMe method.
// A simple method for testing your bot's authentication token
// Requires no parameters
// Returns basic information about the bot in form of a User object.
type GetMeCall struct {
Call[User]
}
// NewGetMeCall constructs a new GetMeCall with required parameters.
func NewGetMeCall() *GetMeCall {
return &GetMeCall{
Call[User]{
request: NewRequest("getMe"),
},
}
}
// GetMeCall constructs a new GetMeCall with required parameters.
func (client *Client) GetMe() *GetMeCall {
return BindClient(
NewGetMeCall(),
client,
)
}
// LogOutCall reprenesents a call to the logOut method.
// Use this method to log out from the cloud Bot API server before launching the bot locally
// You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates
// After a successful call, you can immediately log in on a local server, but will not be able to log in back to the cloud Bot API server for 10 minutes
// Requires no parameters.
type LogOutCall struct {
CallNoResult
}
// NewLogOutCall constructs a new LogOutCall with required parameters.
func NewLogOutCall() *LogOutCall {
return &LogOutCall{
CallNoResult{
request: NewRequest("logOut"),
},
}
}
// LogOutCall constructs a new LogOutCall with required parameters.
func (client *Client) LogOut() *LogOutCall {
return BindClient(
NewLogOutCall(),
client,
)
}
// CloseCall reprenesents a call to the close method.
// Use this method to close the bot instance before moving it from one local server to another
// You need to delete the webhook before calling this method to ensure that the bot isn't launched again after server restart
// The method will return error 429 in the first 10 minutes after the bot is launched
// Requires no parameters.
type CloseCall struct {
CallNoResult
}
// NewCloseCall constructs a new CloseCall with required parameters.
func NewCloseCall() *CloseCall {
return &CloseCall{
CallNoResult{
request: NewRequest("close"),
},
}
}
// CloseCall constructs a new CloseCall with required parameters.
func (client *Client) Close() *CloseCall {
return BindClient(
NewCloseCall(),
client,
)
}
// SendMessageCall reprenesents a call to the sendMessage method.
// Use this method to send text messages
// On success, the sent Message is returned.
type SendMessageCall struct {
Call[Message]
}
// NewSendMessageCall constructs a new SendMessageCall with required parameters.
// chatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
// text - Text of the message to be sent, 1-4096 characters after entities parsing
func NewSendMessageCall(chatID PeerID, text string) *SendMessageCall {
return &SendMessageCall{
Call[Message]{
request: NewRequest("sendMessage").
PeerID("chat_id", chatID).
String("text", text),
},
}
}
// SendMessageCall constructs a new SendMessageCall with required parameters.
func (client *Client) SendMessage(chatID PeerID, text string) *SendMessageCall {
return BindClient(
NewSendMessageCall(chatID, text),
client,
)
}
// BusinessConnectionID Unique identifier of the business connection on behalf of which the message will be sent
func (call *SendMessageCall) BusinessConnectionID(businessConnectionID string) *SendMessageCall {
call.request.String("business_connection_id", businessConnectionID)
return call
}
// ChatID Unique identifier for the target chat or username of the target channel (in the format @channelusername)
func (call *SendMessageCall) ChatID(chatID PeerID) *SendMessageCall {
call.request.PeerID("chat_id", chatID)
return call
}
// MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
func (call *SendMessageCall) MessageThreadID(messageThreadID int) *SendMessageCall {
call.request.Int("message_thread_id", messageThreadID)
return call
}
// Text Text of the message to be sent, 1-4096 characters after entities parsing
func (call *SendMessageCall) Text(text string) *SendMessageCall {
call.request.String("text", text)
return call
}
// ParseMode Mode for parsing entities in the message text. See formatting options for more details.
func (call *SendMessageCall) ParseMode(parseMode ParseMode) *SendMessageCall {
call.request.Stringer("parse_mode", parseMode)
return call
}
// Entities A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
func (call *SendMessageCall) Entities(entities []MessageEntity) *SendMessageCall {
call.request.JSON("entities", entities)
return call
}
// LinkPreviewOptions Link preview generation options for the message
func (call *SendMessageCall) LinkPreviewOptions(linkPreviewOptions LinkPreviewOptions) *SendMessageCall {
call.request.JSON("link_preview_options", linkPreviewOptions)
return call
}
// DisableNotification Sends the message silently. Users will receive a notification with no sound.
func (call *SendMessageCall) DisableNotification(disableNotification bool) *SendMessageCall {
call.request.Bool("disable_notification", disableNotification)
return call
}
// ProtectContent Protects the contents of the sent message from forwarding and saving
func (call *SendMessageCall) ProtectContent(protectContent bool) *SendMessageCall {
call.request.Bool("protect_content", protectContent)
return call
}
// ReplyParameters Description of the message to reply to
func (call *SendMessageCall) ReplyParameters(replyParameters ReplyParameters) *SendMessageCall {
call.request.JSON("reply_parameters", replyParameters)
return call
}
// ReplyMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account
func (call *SendMessageCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendMessageCall {
call.request.JSON("reply_markup", replyMarkup)
return call
}
// ForwardMessageCall reprenesents a call to the forwardMessage method.
// Use this method to forward messages of any kind
// Service messages and messages with protected content can't be forwarded
// On success, the sent Message is returned.
type ForwardMessageCall struct {
Call[Message]
}
// NewForwardMessageCall constructs a new ForwardMessageCall with required parameters.
// chatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
// fromChatID - Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
// messageID - Message identifier in the chat specified in from_chat_id
func NewForwardMessageCall(chatID PeerID, fromChatID PeerID, messageID int) *ForwardMessageCall {
return &ForwardMessageCall{
Call[Message]{
request: NewRequest("forwardMessage").
PeerID("chat_id", chatID).
PeerID("from_chat_id", fromChatID).
Int("message_id", messageID),
},
}
}
// ForwardMessageCall constructs a new ForwardMessageCall with required parameters.
func (client *Client) ForwardMessage(chatID PeerID, fromChatID PeerID, messageID int) *ForwardMessageCall {
return BindClient(
NewForwardMessageCall(chatID, fromChatID, messageID),
client,
)
}
// ChatID Unique identifier for the target chat or username of the target channel (in the format @channelusername)
func (call *ForwardMessageCall) ChatID(chatID PeerID) *ForwardMessageCall {
call.request.PeerID("chat_id", chatID)
return call
}
// MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
func (call *ForwardMessageCall) MessageThreadID(messageThreadID int) *ForwardMessageCall {
call.request.Int("message_thread_id", messageThreadID)
return call
}
// FromChatID Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
func (call *ForwardMessageCall) FromChatID(fromChatID PeerID) *ForwardMessageCall {
call.request.PeerID("from_chat_id", fromChatID)
return call
}
// DisableNotification Sends the message silently. Users will receive a notification with no sound.
func (call *ForwardMessageCall) DisableNotification(disableNotification bool) *ForwardMessageCall {
call.request.Bool("disable_notification", disableNotification)
return call
}
// ProtectContent Protects the contents of the forwarded message from forwarding and saving
func (call *ForwardMessageCall) ProtectContent(protectContent bool) *ForwardMessageCall {
call.request.Bool("protect_content", protectContent)
return call
}
// MessageID Message identifier in the chat specified in from_chat_id
func (call *ForwardMessageCall) MessageID(messageID int) *ForwardMessageCall {
call.request.Int("message_id", messageID)
return call
}
// ForwardMessagesCall reprenesents a call to the forwardMessages method.
// Use this method to forward multiple messages of any kind
// If some of the specified messages can't be found or forwarded, they are skipped
// Service messages and messages with protected content can't be forwarded
// Album grouping is kept for forwarded messages
// On success, an array of MessageId of the sent messages is returned.
type ForwardMessagesCall struct {
Call[MessageID]
}
// NewForwardMessagesCall constructs a new ForwardMessagesCall with required parameters.
// chatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
// fromChatID - Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)
// messageIds - A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to forward. The identifiers must be specified in a strictly increasing order.
func NewForwardMessagesCall(chatID PeerID, fromChatID PeerID, messageIds []int) *ForwardMessagesCall {
return &ForwardMessagesCall{
Call[MessageID]{
request: NewRequest("forwardMessages").
PeerID("chat_id", chatID).
PeerID("from_chat_id", fromChatID).
JSON("message_ids", messageIds),
},
}
}
// ForwardMessagesCall constructs a new ForwardMessagesCall with required parameters.
func (client *Client) ForwardMessages(chatID PeerID, fromChatID PeerID, messageIds []int) *ForwardMessagesCall {
return BindClient(
NewForwardMessagesCall(chatID, fromChatID, messageIds),
client,
)
}
// ChatID Unique identifier for the target chat or username of the target channel (in the format @channelusername)
func (call *ForwardMessagesCall) ChatID(chatID PeerID) *ForwardMessagesCall {
call.request.PeerID("chat_id", chatID)
return call
}
// MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
func (call *ForwardMessagesCall) MessageThreadID(messageThreadID int) *ForwardMessagesCall {
call.request.Int("message_thread_id", messageThreadID)
return call
}
// FromChatID Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)
func (call *ForwardMessagesCall) FromChatID(fromChatID PeerID) *ForwardMessagesCall {
call.request.PeerID("from_chat_id", fromChatID)
return call
}
// MessageIds A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to forward. The identifiers must be specified in a strictly increasing order.
func (call *ForwardMessagesCall) MessageIds(messageIds []int) *ForwardMessagesCall {
call.request.JSON("message_ids", messageIds)
return call
}
// DisableNotification Sends the messages silently. Users will receive a notification with no sound.
func (call *ForwardMessagesCall) DisableNotification(disableNotification bool) *ForwardMessagesCall {
call.request.Bool("disable_notification", disableNotification)
return call
}
// ProtectContent Protects the contents of the forwarded messages from forwarding and saving
func (call *ForwardMessagesCall) ProtectContent(protectContent bool) *ForwardMessagesCall {
call.request.Bool("protect_content", protectContent)
return call
}
// CopyMessageCall reprenesents a call to the copyMessage method.
// Use this method to copy messages of any kind
// Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied
// A quiz poll can be copied only if the value of the field correct_option_id is known to the bot
// The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message
// Returns the MessageId of the sent message on success.
type CopyMessageCall struct {
Call[MessageID]
}
// NewCopyMessageCall constructs a new CopyMessageCall with required parameters.
// chatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
// fromChatID - Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
// messageID - Message identifier in the chat specified in from_chat_id
func NewCopyMessageCall(chatID PeerID, fromChatID PeerID, messageID int) *CopyMessageCall {
return &CopyMessageCall{
Call[MessageID]{
request: NewRequest("copyMessage").
PeerID("chat_id", chatID).
PeerID("from_chat_id", fromChatID).
Int("message_id", messageID),
},
}
}
// CopyMessageCall constructs a new CopyMessageCall with required parameters.
func (client *Client) CopyMessage(chatID PeerID, fromChatID PeerID, messageID int) *CopyMessageCall {
return BindClient(
NewCopyMessageCall(chatID, fromChatID, messageID),
client,
)
}
// ChatID Unique identifier for the target chat or username of the target channel (in the format @channelusername)
func (call *CopyMessageCall) ChatID(chatID PeerID) *CopyMessageCall {
call.request.PeerID("chat_id", chatID)
return call
}
// MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
func (call *CopyMessageCall) MessageThreadID(messageThreadID int) *CopyMessageCall {
call.request.Int("message_thread_id", messageThreadID)
return call
}
// FromChatID Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
func (call *CopyMessageCall) FromChatID(fromChatID PeerID) *CopyMessageCall {
call.request.PeerID("from_chat_id", fromChatID)
return call
}
// MessageID Message identifier in the chat specified in from_chat_id
func (call *CopyMessageCall) MessageID(messageID int) *CopyMessageCall {
call.request.Int("message_id", messageID)
return call
}
// Caption New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept
func (call *CopyMessageCall) Caption(caption string) *CopyMessageCall {
call.request.String("caption", caption)
return call
}
// ParseMode Mode for parsing entities in the new caption. See formatting options for more details.
func (call *CopyMessageCall) ParseMode(parseMode ParseMode) *CopyMessageCall {
call.request.Stringer("parse_mode", parseMode)
return call
}
// CaptionEntities A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of parse_mode
func (call *CopyMessageCall) CaptionEntities(captionEntities []MessageEntity) *CopyMessageCall {
call.request.JSON("caption_entities", captionEntities)
return call
}
// DisableNotification Sends the message silently. Users will receive a notification with no sound.
func (call *CopyMessageCall) DisableNotification(disableNotification bool) *CopyMessageCall {
call.request.Bool("disable_notification", disableNotification)
return call
}
// ProtectContent Protects the contents of the sent message from forwarding and saving
func (call *CopyMessageCall) ProtectContent(protectContent bool) *CopyMessageCall {
call.request.Bool("protect_content", protectContent)
return call
}
// ReplyParameters Description of the message to reply to
func (call *CopyMessageCall) ReplyParameters(replyParameters ReplyParameters) *CopyMessageCall {
call.request.JSON("reply_parameters", replyParameters)
return call
}
// ReplyMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
func (call *CopyMessageCall) ReplyMarkup(replyMarkup ReplyMarkup) *CopyMessageCall {
call.request.JSON("reply_markup", replyMarkup)
return call
}
// CopyMessagesCall reprenesents a call to the copyMessages method.
// Use this method to copy messages of any kind
// If some of the specified messages can't be found or copied, they are skipped
// Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied
// A quiz poll can be copied only if the value of the field correct_option_id is known to the bot
// The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message
// Album grouping is kept for copied messages
// On success, an array of MessageId of the sent messages is returned.
type CopyMessagesCall struct {
Call[MessageID]
}
// NewCopyMessagesCall constructs a new CopyMessagesCall with required parameters.
// chatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
// fromChatID - Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)
// messageIds - A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to copy. The identifiers must be specified in a strictly increasing order.
func NewCopyMessagesCall(chatID PeerID, fromChatID PeerID, messageIds []int) *CopyMessagesCall {
return &CopyMessagesCall{
Call[MessageID]{
request: NewRequest("copyMessages").
PeerID("chat_id", chatID).
PeerID("from_chat_id", fromChatID).
JSON("message_ids", messageIds),
},
}
}
// CopyMessagesCall constructs a new CopyMessagesCall with required parameters.
func (client *Client) CopyMessages(chatID PeerID, fromChatID PeerID, messageIds []int) *CopyMessagesCall {
return BindClient(
NewCopyMessagesCall(chatID, fromChatID, messageIds),
client,
)
}
// ChatID Unique identifier for the target chat or username of the target channel (in the format @channelusername)
func (call *CopyMessagesCall) ChatID(chatID PeerID) *CopyMessagesCall {
call.request.PeerID("chat_id", chatID)
return call
}
// MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
func (call *CopyMessagesCall) MessageThreadID(messageThreadID int) *CopyMessagesCall {
call.request.Int("message_thread_id", messageThreadID)
return call
}
// FromChatID Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)
func (call *CopyMessagesCall) FromChatID(fromChatID PeerID) *CopyMessagesCall {
call.request.PeerID("from_chat_id", fromChatID)
return call
}
// MessageIds A JSON-serialized list of 1-100 identifiers of messages in the chat from_chat_id to copy. The identifiers must be specified in a strictly increasing order.
func (call *CopyMessagesCall) MessageIds(messageIds []int) *CopyMessagesCall {
call.request.JSON("message_ids", messageIds)
return call
}
// DisableNotification Sends the messages silently. Users will receive a notification with no sound.
func (call *CopyMessagesCall) DisableNotification(disableNotification bool) *CopyMessagesCall {
call.request.Bool("disable_notification", disableNotification)
return call
}
// ProtectContent Protects the contents of the sent messages from forwarding and saving
func (call *CopyMessagesCall) ProtectContent(protectContent bool) *CopyMessagesCall {
call.request.Bool("protect_content", protectContent)
return call
}
// RemoveCaption Pass True to copy the messages without their captions
func (call *CopyMessagesCall) RemoveCaption(removeCaption bool) *CopyMessagesCall {
call.request.Bool("remove_caption", removeCaption)
return call
}
// SendPhotoCall reprenesents a call to the sendPhoto method.
// Use this method to send photos
// On success, the sent Message is returned.
type SendPhotoCall struct {
Call[Message]
}
// NewSendPhotoCall constructs a new SendPhotoCall with required parameters.
// chatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
// photo - Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. More information on Sending Files »
func NewSendPhotoCall(chatID PeerID, photo FileArg) *SendPhotoCall {
return &SendPhotoCall{
Call[Message]{
request: NewRequest("sendPhoto").
PeerID("chat_id", chatID).
File("photo", photo),
},
}
}
// SendPhotoCall constructs a new SendPhotoCall with required parameters.
func (client *Client) SendPhoto(chatID PeerID, photo FileArg) *SendPhotoCall {
return BindClient(
NewSendPhotoCall(chatID, photo),
client,
)
}
// BusinessConnectionID Unique identifier of the business connection on behalf of which the message will be sent
func (call *SendPhotoCall) BusinessConnectionID(businessConnectionID string) *SendPhotoCall {
call.request.String("business_connection_id", businessConnectionID)
return call
}
// ChatID Unique identifier for the target chat or username of the target channel (in the format @channelusername)
func (call *SendPhotoCall) ChatID(chatID PeerID) *SendPhotoCall {
call.request.PeerID("chat_id", chatID)
return call
}
// MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
func (call *SendPhotoCall) MessageThreadID(messageThreadID int) *SendPhotoCall {
call.request.Int("message_thread_id", messageThreadID)
return call
}
// Photo Photo to send. Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. More information on Sending Files »
func (call *SendPhotoCall) Photo(photo FileArg) *SendPhotoCall {
call.request.File("photo", photo)
return call
}
// Caption Photo caption (may also be used when resending photos by file_id), 0-1024 characters after entities parsing
func (call *SendPhotoCall) Caption(caption string) *SendPhotoCall {
call.request.String("caption", caption)
return call
}
// ParseMode Mode for parsing entities in the photo caption. See formatting options for more details.
func (call *SendPhotoCall) ParseMode(parseMode ParseMode) *SendPhotoCall {
call.request.Stringer("parse_mode", parseMode)
return call
}
// CaptionEntities A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
func (call *SendPhotoCall) CaptionEntities(captionEntities []MessageEntity) *SendPhotoCall {
call.request.JSON("caption_entities", captionEntities)
return call
}
// HasSpoiler Pass True if the photo needs to be covered with a spoiler animation
func (call *SendPhotoCall) HasSpoiler(hasSpoiler bool) *SendPhotoCall {
call.request.Bool("has_spoiler", hasSpoiler)
return call
}
// DisableNotification Sends the message silently. Users will receive a notification with no sound.
func (call *SendPhotoCall) DisableNotification(disableNotification bool) *SendPhotoCall {
call.request.Bool("disable_notification", disableNotification)
return call
}
// ProtectContent Protects the contents of the sent message from forwarding and saving
func (call *SendPhotoCall) ProtectContent(protectContent bool) *SendPhotoCall {
call.request.Bool("protect_content", protectContent)
return call
}
// ReplyParameters Description of the message to reply to
func (call *SendPhotoCall) ReplyParameters(replyParameters ReplyParameters) *SendPhotoCall {
call.request.JSON("reply_parameters", replyParameters)
return call
}
// ReplyMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account
func (call *SendPhotoCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendPhotoCall {
call.request.JSON("reply_markup", replyMarkup)
return call
}
// SendAudioCall reprenesents a call to the sendAudio method.
// Use this method to send audio files, if you want Telegram clients to display them in the music player
// Your audio must be in the .MP3 or .M4A format
// On success, the sent Message is returned
// Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
// For sending voice messages, use the sendVoice method instead.
type SendAudioCall struct {
Call[Message]
}
// NewSendAudioCall constructs a new SendAudioCall with required parameters.
// chatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
// audio - Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files »
func NewSendAudioCall(chatID PeerID, audio FileArg) *SendAudioCall {
return &SendAudioCall{
Call[Message]{
request: NewRequest("sendAudio").
PeerID("chat_id", chatID).
File("audio", audio),
},
}
}
// SendAudioCall constructs a new SendAudioCall with required parameters.
func (client *Client) SendAudio(chatID PeerID, audio FileArg) *SendAudioCall {
return BindClient(
NewSendAudioCall(chatID, audio),
client,
)
}
// BusinessConnectionID Unique identifier of the business connection on behalf of which the message will be sent
func (call *SendAudioCall) BusinessConnectionID(businessConnectionID string) *SendAudioCall {
call.request.String("business_connection_id", businessConnectionID)
return call
}
// ChatID Unique identifier for the target chat or username of the target channel (in the format @channelusername)
func (call *SendAudioCall) ChatID(chatID PeerID) *SendAudioCall {
call.request.PeerID("chat_id", chatID)
return call
}
// MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
func (call *SendAudioCall) MessageThreadID(messageThreadID int) *SendAudioCall {
call.request.Int("message_thread_id", messageThreadID)
return call
}
// Audio Audio file to send. Pass a file_id as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files »
func (call *SendAudioCall) Audio(audio FileArg) *SendAudioCall {
call.request.File("audio", audio)
return call
}
// Caption Audio caption, 0-1024 characters after entities parsing
func (call *SendAudioCall) Caption(caption string) *SendAudioCall {
call.request.String("caption", caption)
return call
}
// ParseMode Mode for parsing entities in the audio caption. See formatting options for more details.
func (call *SendAudioCall) ParseMode(parseMode ParseMode) *SendAudioCall {
call.request.Stringer("parse_mode", parseMode)
return call
}
// CaptionEntities A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
func (call *SendAudioCall) CaptionEntities(captionEntities []MessageEntity) *SendAudioCall {
call.request.JSON("caption_entities", captionEntities)
return call
}
// Duration Duration of the audio in seconds
func (call *SendAudioCall) Duration(duration int) *SendAudioCall {
call.request.Int("duration", duration)
return call
}
// Performer Performer
func (call *SendAudioCall) Performer(performer string) *SendAudioCall {
call.request.String("performer", performer)
return call
}
// Title Track name
func (call *SendAudioCall) Title(title string) *SendAudioCall {
call.request.String("title", title)
return call
}
// Thumbnail Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files »
func (call *SendAudioCall) Thumbnail(thumbnail FileArg) *SendAudioCall {
call.request.File("thumbnail", thumbnail)
return call
}
// DisableNotification Sends the message silently. Users will receive a notification with no sound.
func (call *SendAudioCall) DisableNotification(disableNotification bool) *SendAudioCall {
call.request.Bool("disable_notification", disableNotification)
return call
}
// ProtectContent Protects the contents of the sent message from forwarding and saving
func (call *SendAudioCall) ProtectContent(protectContent bool) *SendAudioCall {
call.request.Bool("protect_content", protectContent)
return call
}
// ReplyParameters Description of the message to reply to
func (call *SendAudioCall) ReplyParameters(replyParameters ReplyParameters) *SendAudioCall {
call.request.JSON("reply_parameters", replyParameters)
return call
}
// ReplyMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account
func (call *SendAudioCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendAudioCall {
call.request.JSON("reply_markup", replyMarkup)
return call
}
// SendDocumentCall reprenesents a call to the sendDocument method.
// Use this method to send general files
// On success, the sent Message is returned
// Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
type SendDocumentCall struct {
Call[Message]
}
// NewSendDocumentCall constructs a new SendDocumentCall with required parameters.
// chatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)
// document - File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files »
func NewSendDocumentCall(chatID PeerID, document FileArg) *SendDocumentCall {
return &SendDocumentCall{
Call[Message]{
request: NewRequest("sendDocument").
PeerID("chat_id", chatID).
File("document", document),
},
}
}
// SendDocumentCall constructs a new SendDocumentCall with required parameters.
func (client *Client) SendDocument(chatID PeerID, document FileArg) *SendDocumentCall {
return BindClient(
NewSendDocumentCall(chatID, document),
client,
)
}
// BusinessConnectionID Unique identifier of the business connection on behalf of which the message will be sent
func (call *SendDocumentCall) BusinessConnectionID(businessConnectionID string) *SendDocumentCall {
call.request.String("business_connection_id", businessConnectionID)
return call
}
// ChatID Unique identifier for the target chat or username of the target channel (in the format @channelusername)
func (call *SendDocumentCall) ChatID(chatID PeerID) *SendDocumentCall {
call.request.PeerID("chat_id", chatID)
return call
}
// MessageThreadID Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
func (call *SendDocumentCall) MessageThreadID(messageThreadID int) *SendDocumentCall {
call.request.Int("message_thread_id", messageThreadID)
return call
}
// Document File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files »
func (call *SendDocumentCall) Document(document FileArg) *SendDocumentCall {
call.request.File("document", document)
return call
}
// Thumbnail Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files »
func (call *SendDocumentCall) Thumbnail(thumbnail FileArg) *SendDocumentCall {
call.request.File("thumbnail", thumbnail)
return call
}
// Caption Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing
func (call *SendDocumentCall) Caption(caption string) *SendDocumentCall {
call.request.String("caption", caption)
return call
}
// ParseMode Mode for parsing entities in the document caption. See formatting options for more details.
func (call *SendDocumentCall) ParseMode(parseMode ParseMode) *SendDocumentCall {
call.request.Stringer("parse_mode", parseMode)
return call
}
// CaptionEntities A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
func (call *SendDocumentCall) CaptionEntities(captionEntities []MessageEntity) *SendDocumentCall {
call.request.JSON("caption_entities", captionEntities)
return call
}
// DisableContentTypeDetection Disables automatic server-side content type detection for files uploaded using multipart/form-data
func (call *SendDocumentCall) DisableContentTypeDetection(disableContentTypeDetection bool) *SendDocumentCall {
call.request.Bool("disable_content_type_detection", disableContentTypeDetection)
return call
}
// DisableNotification Sends the message silently. Users will receive a notification with no sound.
func (call *SendDocumentCall) DisableNotification(disableNotification bool) *SendDocumentCall {
call.request.Bool("disable_notification", disableNotification)
return call
}
// ProtectContent Protects the contents of the sent message from forwarding and saving
func (call *SendDocumentCall) ProtectContent(protectContent bool) *SendDocumentCall {
call.request.Bool("protect_content", protectContent)
return call
}
// ReplyParameters Description of the message to reply to
func (call *SendDocumentCall) ReplyParameters(replyParameters ReplyParameters) *SendDocumentCall {
call.request.JSON("reply_parameters", replyParameters)
return call
}
// ReplyMarkup Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account
func (call *SendDocumentCall) ReplyMarkup(replyMarkup ReplyMarkup) *SendDocumentCall {
call.request.JSON("reply_markup", replyMarkup)
return call
}
// SendVideoCall reprenesents a call to the sendVideo method.
// Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document)
// On success, the sent Message is returned
// Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
type SendVideoCall struct {
Call[Message]
}
// NewSendVideoCall constructs a new SendVideoCall with required parameters.
// chatID - Unique identifier for the target chat or username of the target channel (in the format @channelusername)