-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmethods.go
More file actions
3001 lines (2367 loc) · 141 KB
/
Copy pathmethods.go
File metadata and controls
3001 lines (2367 loc) · 141 KB
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
// Code generated by goram/internal/gen; DO NOT EDIT.
package goram
import (
"context"
)
// Use this method to receive incoming updates using long polling (wiki). Returns an Array of Update objects.
//
// https://core.telegram.org/bots/api#getupdates
func (b *Bot) GetUpdates(ctx context.Context, request *GetUpdatesRequest) (r []Update, err error) {
res, err := makeRequest[[]Update](ctx, b.Options.Client, b.baseURL, "getUpdates", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// 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 (a request with response HTTP status code different from 2XY), we will repeat the request and give up after a reasonable amount of attempts. Returns True on success.
//
// 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.
//
// https://core.telegram.org/bots/api#setwebhook
func (b *Bot) SetWebhook(ctx context.Context, request *SetWebhookRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "setWebhook", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SetWebhook, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SetWebhookVoid(ctx context.Context, request *SetWebhookRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "setWebhook", b.Options.FloodHandler, request)
}
// Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success.
//
// https://core.telegram.org/bots/api#deletewebhook
func (b *Bot) DeleteWebhook(ctx context.Context, request *DeleteWebhookRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "deleteWebhook", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.DeleteWebhook, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) DeleteWebhookVoid(ctx context.Context, request *DeleteWebhookRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "deleteWebhook", b.Options.FloodHandler, request)
}
// 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.
//
// https://core.telegram.org/bots/api#getwebhookinfo
func (b *Bot) GetWebhookInfo(ctx context.Context) (r *WebhookInfo, err error) {
res, err := makeRequest[*WebhookInfo](ctx, b.Options.Client, b.baseURL, "getWebhookInfo", b.Options.FloodHandler, nil)
if err != nil {
return r, err
}
return res.Result, nil
}
// 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.
//
// https://core.telegram.org/bots/api#getme
func (b *Bot) GetMe(ctx context.Context) (r *User, err error) {
res, err := makeRequest[*User](ctx, b.Options.Client, b.baseURL, "getMe", b.Options.FloodHandler, nil)
if err != nil {
return r, err
}
return res.Result, nil
}
// 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. Returns True on success. Requires no parameters.
//
// https://core.telegram.org/bots/api#logout
func (b *Bot) LogOut(ctx context.Context) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "logOut", b.Options.FloodHandler, nil)
if err != nil {
return r, err
}
return res.Result, nil
}
// 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. Returns True on success. Requires no parameters.
//
// https://core.telegram.org/bots/api#close
func (b *Bot) Close(ctx context.Context) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "close", b.Options.FloodHandler, nil)
if err != nil {
return r, err
}
return res.Result, nil
}
// Use this method to send text messages. On success, the sent Message is returned.
//
// https://core.telegram.org/bots/api#sendmessage
func (b *Bot) SendMessage(ctx context.Context, request *SendMessageRequest) (r *Message, err error) {
res, err := makeRequest[*Message](ctx, b.Options.Client, b.baseURL, "sendMessage", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SendMessage, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SendMessageVoid(ctx context.Context, request *SendMessageRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "sendMessage", b.Options.FloodHandler, request)
}
// 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.
//
// https://core.telegram.org/bots/api#forwardmessage
func (b *Bot) ForwardMessage(ctx context.Context, request *ForwardMessageRequest) (r *Message, err error) {
res, err := makeRequest[*Message](ctx, b.Options.Client, b.baseURL, "forwardMessage", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.ForwardMessage, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) ForwardMessageVoid(ctx context.Context, request *ForwardMessageRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "forwardMessage", b.Options.FloodHandler, request)
}
// 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.
//
// https://core.telegram.org/bots/api#forwardmessages
func (b *Bot) ForwardMessages(ctx context.Context, request *ForwardMessagesRequest) (r []MessageId, err error) {
res, err := makeRequest[[]MessageId](ctx, b.Options.Client, b.baseURL, "forwardMessages", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.ForwardMessages, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) ForwardMessagesVoid(ctx context.Context, request *ForwardMessagesRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "forwardMessages", b.Options.FloodHandler, request)
}
// Use this method to copy messages of any kind. Service messages, paid media 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.
//
// https://core.telegram.org/bots/api#copymessage
func (b *Bot) CopyMessage(ctx context.Context, request *CopyMessageRequest) (r *MessageId, err error) {
res, err := makeRequest[*MessageId](ctx, b.Options.Client, b.baseURL, "copyMessage", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.CopyMessage, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) CopyMessageVoid(ctx context.Context, request *CopyMessageRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "copyMessage", b.Options.FloodHandler, request)
}
// 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, paid media 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.
//
// https://core.telegram.org/bots/api#copymessages
func (b *Bot) CopyMessages(ctx context.Context, request *CopyMessagesRequest) (r []MessageId, err error) {
res, err := makeRequest[[]MessageId](ctx, b.Options.Client, b.baseURL, "copyMessages", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.CopyMessages, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) CopyMessagesVoid(ctx context.Context, request *CopyMessagesRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "copyMessages", b.Options.FloodHandler, request)
}
// Use this method to send photos. On success, the sent Message is returned.
//
// https://core.telegram.org/bots/api#sendphoto
func (b *Bot) SendPhoto(ctx context.Context, request *SendPhotoRequest) (r *Message, err error) {
res, err := makeRequest[*Message](ctx, b.Options.Client, b.baseURL, "sendPhoto", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SendPhoto, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SendPhotoVoid(ctx context.Context, request *SendPhotoRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "sendPhoto", b.Options.FloodHandler, request)
}
// 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.
//
// https://core.telegram.org/bots/api#sendaudio
func (b *Bot) SendAudio(ctx context.Context, request *SendAudioRequest) (r *Message, err error) {
res, err := makeRequest[*Message](ctx, b.Options.Client, b.baseURL, "sendAudio", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SendAudio, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SendAudioVoid(ctx context.Context, request *SendAudioRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "sendAudio", b.Options.FloodHandler, request)
}
// 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.
//
// https://core.telegram.org/bots/api#senddocument
func (b *Bot) SendDocument(ctx context.Context, request *SendDocumentRequest) (r *Message, err error) {
res, err := makeRequest[*Message](ctx, b.Options.Client, b.baseURL, "sendDocument", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SendDocument, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SendDocumentVoid(ctx context.Context, request *SendDocumentRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "sendDocument", b.Options.FloodHandler, request)
}
// 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.
//
// https://core.telegram.org/bots/api#sendvideo
func (b *Bot) SendVideo(ctx context.Context, request *SendVideoRequest) (r *Message, err error) {
res, err := makeRequest[*Message](ctx, b.Options.Client, b.baseURL, "sendVideo", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SendVideo, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SendVideoVoid(ctx context.Context, request *SendVideoRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "sendVideo", b.Options.FloodHandler, request)
}
// Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
//
// https://core.telegram.org/bots/api#sendanimation
func (b *Bot) SendAnimation(ctx context.Context, request *SendAnimationRequest) (r *Message, err error) {
res, err := makeRequest[*Message](ctx, b.Options.Client, b.baseURL, "sendAnimation", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SendAnimation, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SendAnimationVoid(ctx context.Context, request *SendAnimationRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "sendAnimation", b.Options.FloodHandler, request)
}
// Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS, or in .MP3 format, or in .M4A format (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
//
// https://core.telegram.org/bots/api#sendvoice
func (b *Bot) SendVoice(ctx context.Context, request *SendVoiceRequest) (r *Message, err error) {
res, err := makeRequest[*Message](ctx, b.Options.Client, b.baseURL, "sendVoice", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SendVoice, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SendVoiceVoid(ctx context.Context, request *SendVoiceRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "sendVoice", b.Options.FloodHandler, request)
}
// As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned.
//
// https://core.telegram.org/bots/api#sendvideonote
func (b *Bot) SendVideoNote(ctx context.Context, request *SendVideoNoteRequest) (r *Message, err error) {
res, err := makeRequest[*Message](ctx, b.Options.Client, b.baseURL, "sendVideoNote", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SendVideoNote, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SendVideoNoteVoid(ctx context.Context, request *SendVideoNoteRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "sendVideoNote", b.Options.FloodHandler, request)
}
// Use this method to send paid media. On success, the sent Message is returned.
//
// https://core.telegram.org/bots/api#sendpaidmedia
func (b *Bot) SendPaidMedia(ctx context.Context, request *SendPaidMediaRequest) (r *Message, err error) {
res, err := makeRequest[*Message](ctx, b.Options.Client, b.baseURL, "sendPaidMedia", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SendPaidMedia, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SendPaidMediaVoid(ctx context.Context, request *SendPaidMediaRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "sendPaidMedia", b.Options.FloodHandler, request)
}
// Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of Message objects that were sent is returned.
//
// https://core.telegram.org/bots/api#sendmediagroup
func (b *Bot) SendMediaGroup(ctx context.Context, request *SendMediaGroupRequest) (r []Message, err error) {
res, err := makeRequest[[]Message](ctx, b.Options.Client, b.baseURL, "sendMediaGroup", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SendMediaGroup, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SendMediaGroupVoid(ctx context.Context, request *SendMediaGroupRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "sendMediaGroup", b.Options.FloodHandler, request)
}
// Use this method to send point on the map. On success, the sent Message is returned.
//
// https://core.telegram.org/bots/api#sendlocation
func (b *Bot) SendLocation(ctx context.Context, request *SendLocationRequest) (r *Message, err error) {
res, err := makeRequest[*Message](ctx, b.Options.Client, b.baseURL, "sendLocation", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SendLocation, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SendLocationVoid(ctx context.Context, request *SendLocationRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "sendLocation", b.Options.FloodHandler, request)
}
// Use this method to send information about a venue. On success, the sent Message is returned.
//
// https://core.telegram.org/bots/api#sendvenue
func (b *Bot) SendVenue(ctx context.Context, request *SendVenueRequest) (r *Message, err error) {
res, err := makeRequest[*Message](ctx, b.Options.Client, b.baseURL, "sendVenue", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SendVenue, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SendVenueVoid(ctx context.Context, request *SendVenueRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "sendVenue", b.Options.FloodHandler, request)
}
// Use this method to send phone contacts. On success, the sent Message is returned.
//
// https://core.telegram.org/bots/api#sendcontact
func (b *Bot) SendContact(ctx context.Context, request *SendContactRequest) (r *Message, err error) {
res, err := makeRequest[*Message](ctx, b.Options.Client, b.baseURL, "sendContact", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SendContact, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SendContactVoid(ctx context.Context, request *SendContactRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "sendContact", b.Options.FloodHandler, request)
}
// Use this method to send a native poll. On success, the sent Message is returned.
//
// https://core.telegram.org/bots/api#sendpoll
func (b *Bot) SendPoll(ctx context.Context, request *SendPollRequest) (r *Message, err error) {
res, err := makeRequest[*Message](ctx, b.Options.Client, b.baseURL, "sendPoll", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SendPoll, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SendPollVoid(ctx context.Context, request *SendPollRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "sendPoll", b.Options.FloodHandler, request)
}
// Use this method to send a checklist on behalf of a connected business account. On success, the sent Message is returned.
//
// https://core.telegram.org/bots/api#sendchecklist
func (b *Bot) SendChecklist(ctx context.Context, request *SendChecklistRequest) (r *Message, err error) {
res, err := makeRequest[*Message](ctx, b.Options.Client, b.baseURL, "sendChecklist", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SendChecklist, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SendChecklistVoid(ctx context.Context, request *SendChecklistRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "sendChecklist", b.Options.FloodHandler, request)
}
// Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned.
//
// https://core.telegram.org/bots/api#senddice
func (b *Bot) SendDice(ctx context.Context, request *SendDiceRequest) (r *Message, err error) {
res, err := makeRequest[*Message](ctx, b.Options.Client, b.baseURL, "sendDice", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SendDice, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SendDiceVoid(ctx context.Context, request *SendDiceRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "sendDice", b.Options.FloodHandler, request)
}
// Use this method to stream a partial message to a user while the message is being generated. Returns True on success.
//
// https://core.telegram.org/bots/api#sendmessagedraft
func (b *Bot) SendMessageDraft(ctx context.Context, request *SendMessageDraftRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "sendMessageDraft", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SendMessageDraft, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SendMessageDraftVoid(ctx context.Context, request *SendMessageDraftRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "sendMessageDraft", b.Options.FloodHandler, request)
}
// Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.
//
// We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.
//
// https://core.telegram.org/bots/api#sendchataction
func (b *Bot) SendChatAction(ctx context.Context, request *SendChatActionRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "sendChatAction", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SendChatAction, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SendChatActionVoid(ctx context.Context, request *SendChatActionRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "sendChatAction", b.Options.FloodHandler, request)
}
// Use this method to change the chosen reactions on a message. Service messages of some types can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns True on success.
//
// https://core.telegram.org/bots/api#setmessagereaction
func (b *Bot) SetMessageReaction(ctx context.Context, request *SetMessageReactionRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "setMessageReaction", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SetMessageReaction, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SetMessageReactionVoid(ctx context.Context, request *SetMessageReactionRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "setMessageReaction", b.Options.FloodHandler, request)
}
// Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
//
// https://core.telegram.org/bots/api#getuserprofilephotos
func (b *Bot) GetUserProfilePhotos(ctx context.Context, request *GetUserProfilePhotosRequest) (r *UserProfilePhotos, err error) {
res, err := makeRequest[*UserProfilePhotos](ctx, b.Options.Client, b.baseURL, "getUserProfilePhotos", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Use this method to get a list of profile audios for a user. Returns a UserProfileAudios object.
//
// https://core.telegram.org/bots/api#getuserprofileaudios
func (b *Bot) GetUserProfileAudios(ctx context.Context, request *GetUserProfileAudiosRequest) (r *UserProfileAudios, err error) {
res, err := makeRequest[*UserProfileAudios](ctx, b.Options.Client, b.baseURL, "getUserProfileAudios", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success.
//
// https://core.telegram.org/bots/api#setuseremojistatus
func (b *Bot) SetUserEmojiStatus(ctx context.Context, request *SetUserEmojiStatusRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "setUserEmojiStatus", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SetUserEmojiStatus, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SetUserEmojiStatusVoid(ctx context.Context, request *SetUserEmojiStatusRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "setUserEmojiStatus", b.Options.FloodHandler, request)
}
// Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, where <file_path> is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.
//
// Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received.
//
// https://core.telegram.org/bots/api#getfile
func (b *Bot) GetFile(ctx context.Context, request *GetFileRequest) (r *File, err error) {
res, err := makeRequest[*File](ctx, b.Options.Client, b.baseURL, "getFile", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
//
// https://core.telegram.org/bots/api#banchatmember
func (b *Bot) BanChatMember(ctx context.Context, request *BanChatMemberRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "banChatMember", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.BanChatMember, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) BanChatMemberVoid(ctx context.Context, request *BanChatMemberRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "banChatMember", b.Options.FloodHandler, request)
}
// Use this method to unban a previously banned user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat. If you don't want this, use the parameter only_if_banned. Returns True on success.
//
// https://core.telegram.org/bots/api#unbanchatmember
func (b *Bot) UnbanChatMember(ctx context.Context, request *UnbanChatMemberRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "unbanChatMember", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.UnbanChatMember, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) UnbanChatMemberVoid(ctx context.Context, request *UnbanChatMemberRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "unbanChatMember", b.Options.FloodHandler, request)
}
// Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass True for all permissions to lift restrictions from a user. Returns True on success.
//
// https://core.telegram.org/bots/api#restrictchatmember
func (b *Bot) RestrictChatMember(ctx context.Context, request *RestrictChatMemberRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "restrictChatMember", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.RestrictChatMember, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) RestrictChatMemberVoid(ctx context.Context, request *RestrictChatMemberRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "restrictChatMember", b.Options.FloodHandler, request)
}
// Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass False for all boolean parameters to demote a user. Returns True on success.
//
// https://core.telegram.org/bots/api#promotechatmember
func (b *Bot) PromoteChatMember(ctx context.Context, request *PromoteChatMemberRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "promoteChatMember", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.PromoteChatMember, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) PromoteChatMemberVoid(ctx context.Context, request *PromoteChatMemberRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "promoteChatMember", b.Options.FloodHandler, request)
}
// Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success.
//
// https://core.telegram.org/bots/api#setchatadministratorcustomtitle
func (b *Bot) SetChatAdministratorCustomTitle(ctx context.Context, request *SetChatAdministratorCustomTitleRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "setChatAdministratorCustomTitle", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SetChatAdministratorCustomTitle, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SetChatAdministratorCustomTitleVoid(ctx context.Context, request *SetChatAdministratorCustomTitleRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "setChatAdministratorCustomTitle", b.Options.FloodHandler, request)
}
// Use this method to set a tag for a regular member in a group or a supergroup. The bot must be an administrator in the chat for this to work and must have the can_manage_tags administrator right. Returns True on success.
//
// https://core.telegram.org/bots/api#setchatmembertag
func (b *Bot) SetChatMemberTag(ctx context.Context, request *SetChatMemberTagRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "setChatMemberTag", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SetChatMemberTag, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SetChatMemberTagVoid(ctx context.Context, request *SetChatMemberTagRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "setChatMemberTag", b.Options.FloodHandler, request)
}
// Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success.
//
// https://core.telegram.org/bots/api#banchatsenderchat
func (b *Bot) BanChatSenderChat(ctx context.Context, request *BanChatSenderChatRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "banChatSenderChat", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.BanChatSenderChat, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) BanChatSenderChatVoid(ctx context.Context, request *BanChatSenderChatRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "banChatSenderChat", b.Options.FloodHandler, request)
}
// Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success.
//
// https://core.telegram.org/bots/api#unbanchatsenderchat
func (b *Bot) UnbanChatSenderChat(ctx context.Context, request *UnbanChatSenderChatRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "unbanChatSenderChat", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.UnbanChatSenderChat, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) UnbanChatSenderChatVoid(ctx context.Context, request *UnbanChatSenderChatRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "unbanChatSenderChat", b.Options.FloodHandler, request)
}
// Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success.
//
// https://core.telegram.org/bots/api#setchatpermissions
func (b *Bot) SetChatPermissions(ctx context.Context, request *SetChatPermissionsRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "setChatPermissions", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SetChatPermissions, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SetChatPermissionsVoid(ctx context.Context, request *SetChatPermissionsRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "setChatPermissions", b.Options.FloodHandler, request)
}
// Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as String on success.
//
// https://core.telegram.org/bots/api#exportchatinvitelink
func (b *Bot) ExportChatInviteLink(ctx context.Context, request *ExportChatInviteLinkRequest) (r string, err error) {
res, err := makeRequest[string](ctx, b.Options.Client, b.baseURL, "exportChatInviteLink", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.ExportChatInviteLink, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) ExportChatInviteLinkVoid(ctx context.Context, request *ExportChatInviteLinkRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "exportChatInviteLink", b.Options.FloodHandler, request)
}
// Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method revokeChatInviteLink. Returns the new invite link as ChatInviteLink object.
//
// https://core.telegram.org/bots/api#createchatinvitelink
func (b *Bot) CreateChatInviteLink(ctx context.Context, request *CreateChatInviteLinkRequest) (r *ChatInviteLink, err error) {
res, err := makeRequest[*ChatInviteLink](ctx, b.Options.Client, b.baseURL, "createChatInviteLink", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.CreateChatInviteLink, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) CreateChatInviteLinkVoid(ctx context.Context, request *CreateChatInviteLinkRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "createChatInviteLink", b.Options.FloodHandler, request)
}
// Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the edited invite link as a ChatInviteLink object.
//
// https://core.telegram.org/bots/api#editchatinvitelink
func (b *Bot) EditChatInviteLink(ctx context.Context, request *EditChatInviteLinkRequest) (r *ChatInviteLink, err error) {
res, err := makeRequest[*ChatInviteLink](ctx, b.Options.Client, b.baseURL, "editChatInviteLink", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.EditChatInviteLink, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) EditChatInviteLinkVoid(ctx context.Context, request *EditChatInviteLinkRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "editChatInviteLink", b.Options.FloodHandler, request)
}
// Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object.
//
// https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
func (b *Bot) CreateChatSubscriptionInviteLink(ctx context.Context, request *CreateChatSubscriptionInviteLinkRequest) (r *ChatInviteLink, err error) {
res, err := makeRequest[*ChatInviteLink](ctx, b.Options.Client, b.baseURL, "createChatSubscriptionInviteLink", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.CreateChatSubscriptionInviteLink, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) CreateChatSubscriptionInviteLinkVoid(ctx context.Context, request *CreateChatSubscriptionInviteLinkRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "createChatSubscriptionInviteLink", b.Options.FloodHandler, request)
}
// Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights. Returns the edited invite link as a ChatInviteLink object.
//
// https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
func (b *Bot) EditChatSubscriptionInviteLink(ctx context.Context, request *EditChatSubscriptionInviteLinkRequest) (r *ChatInviteLink, err error) {
res, err := makeRequest[*ChatInviteLink](ctx, b.Options.Client, b.baseURL, "editChatSubscriptionInviteLink", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.EditChatSubscriptionInviteLink, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) EditChatSubscriptionInviteLinkVoid(ctx context.Context, request *EditChatSubscriptionInviteLinkRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "editChatSubscriptionInviteLink", b.Options.FloodHandler, request)
}
// Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as ChatInviteLink object.
//
// https://core.telegram.org/bots/api#revokechatinvitelink
func (b *Bot) RevokeChatInviteLink(ctx context.Context, request *RevokeChatInviteLinkRequest) (r *ChatInviteLink, err error) {
res, err := makeRequest[*ChatInviteLink](ctx, b.Options.Client, b.baseURL, "revokeChatInviteLink", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.RevokeChatInviteLink, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) RevokeChatInviteLinkVoid(ctx context.Context, request *RevokeChatInviteLinkRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "revokeChatInviteLink", b.Options.FloodHandler, request)
}
// Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.
//
// https://core.telegram.org/bots/api#approvechatjoinrequest
func (b *Bot) ApproveChatJoinRequest(ctx context.Context, request *ApproveChatJoinRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "approveChatJoinRequest", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.ApproveChatJoinRequest, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) ApproveChatJoinRequestVoid(ctx context.Context, request *ApproveChatJoinRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "approveChatJoinRequest", b.Options.FloodHandler, request)
}
// Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.
//
// https://core.telegram.org/bots/api#declinechatjoinrequest
func (b *Bot) DeclineChatJoinRequest(ctx context.Context, request *DeclineChatJoinRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "declineChatJoinRequest", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.DeclineChatJoinRequest, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) DeclineChatJoinRequestVoid(ctx context.Context, request *DeclineChatJoinRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "declineChatJoinRequest", b.Options.FloodHandler, request)
}
// Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
//
// https://core.telegram.org/bots/api#setchatphoto
func (b *Bot) SetChatPhoto(ctx context.Context, request *SetChatPhotoRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "setChatPhoto", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SetChatPhoto, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SetChatPhotoVoid(ctx context.Context, request *SetChatPhotoRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "setChatPhoto", b.Options.FloodHandler, request)
}
// Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
//
// https://core.telegram.org/bots/api#deletechatphoto
func (b *Bot) DeleteChatPhoto(ctx context.Context, request *DeleteChatPhotoRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "deleteChatPhoto", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.DeleteChatPhoto, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) DeleteChatPhotoVoid(ctx context.Context, request *DeleteChatPhotoRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "deleteChatPhoto", b.Options.FloodHandler, request)
}
// Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
//
// https://core.telegram.org/bots/api#setchattitle
func (b *Bot) SetChatTitle(ctx context.Context, request *SetChatTitleRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "setChatTitle", b.Options.FloodHandler, request)
if err != nil {
return r, err
}
return res.Result, nil
}
// Does the same as Bot.SetChatTitle, but parses response body only in case of an error.
// Therefore works faster if you dont need the response value.
func (b *Bot) SetChatTitleVoid(ctx context.Context, request *SetChatTitleRequest) error {
return makeVoidRequest(ctx, b.Options.Client, b.baseURL, "setChatTitle", b.Options.FloodHandler, request)
}
// Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
//
// https://core.telegram.org/bots/api#setchatdescription
func (b *Bot) SetChatDescription(ctx context.Context, request *SetChatDescriptionRequest) (r bool, err error) {
res, err := makeRequest[bool](ctx, b.Options.Client, b.baseURL, "setChatDescription", b.Options.FloodHandler, request)