@@ -127,7 +127,7 @@ func TestCopyMessage(t *testing.T) {
127127func TestSendWithNewPhoto (t * testing.T ) {
128128 bot , _ := getBot (t )
129129
130- msg := NewPhoto (ChatID , "tests/image.jpg" )
130+ msg := NewPhoto (ChatID , FilePath ( "tests/image.jpg" ) )
131131 msg .Caption = "Test"
132132 _ , err := bot .Send (msg )
133133
@@ -169,7 +169,7 @@ func TestSendWithNewPhotoWithFileReader(t *testing.T) {
169169func TestSendWithNewPhotoReply (t * testing.T ) {
170170 bot , _ := getBot (t )
171171
172- msg := NewPhoto (ChatID , "tests/image.jpg" )
172+ msg := NewPhoto (ChatID , FilePath ( "tests/image.jpg" ) )
173173 msg .ReplyToMessageID = ReplyToMessageID
174174
175175 _ , err := bot .Send (msg )
@@ -182,7 +182,7 @@ func TestSendWithNewPhotoReply(t *testing.T) {
182182func TestSendNewPhotoToChannel (t * testing.T ) {
183183 bot , _ := getBot (t )
184184
185- msg := NewPhotoToChannel (Channel , "tests/image.jpg" )
185+ msg := NewPhotoToChannel (Channel , FilePath ( "tests/image.jpg" ) )
186186 msg .Caption = "Test"
187187 _ , err := bot .Send (msg )
188188
@@ -239,7 +239,7 @@ func TestSendWithExistingPhoto(t *testing.T) {
239239func TestSendWithNewDocument (t * testing.T ) {
240240 bot , _ := getBot (t )
241241
242- msg := NewDocument (ChatID , "tests/image.jpg" )
242+ msg := NewDocument (ChatID , FilePath ( "tests/image.jpg" ) )
243243 _ , err := bot .Send (msg )
244244
245245 if err != nil {
@@ -250,8 +250,8 @@ func TestSendWithNewDocument(t *testing.T) {
250250func TestSendWithNewDocumentAndThumb (t * testing.T ) {
251251 bot , _ := getBot (t )
252252
253- msg := NewDocument (ChatID , "tests/voice.ogg" )
254- msg .Thumb = "tests/image.jpg"
253+ msg := NewDocument (ChatID , FilePath ( "tests/voice.ogg" ) )
254+ msg .Thumb = FilePath ( "tests/image.jpg" )
255255 _ , err := bot .Send (msg )
256256
257257 if err != nil {
@@ -273,7 +273,7 @@ func TestSendWithExistingDocument(t *testing.T) {
273273func TestSendWithNewAudio (t * testing.T ) {
274274 bot , _ := getBot (t )
275275
276- msg := NewAudio (ChatID , "tests/audio.mp3" )
276+ msg := NewAudio (ChatID , FilePath ( "tests/audio.mp3" ) )
277277 msg .Title = "TEST"
278278 msg .Duration = 10
279279 msg .Performer = "TEST"
@@ -302,7 +302,7 @@ func TestSendWithExistingAudio(t *testing.T) {
302302func TestSendWithNewVoice (t * testing.T ) {
303303 bot , _ := getBot (t )
304304
305- msg := NewVoice (ChatID , "tests/voice.ogg" )
305+ msg := NewVoice (ChatID , FilePath ( "tests/voice.ogg" ) )
306306 msg .Duration = 10
307307 _ , err := bot .Send (msg )
308308
@@ -356,7 +356,7 @@ func TestSendWithVenue(t *testing.T) {
356356func TestSendWithNewVideo (t * testing.T ) {
357357 bot , _ := getBot (t )
358358
359- msg := NewVideo (ChatID , "tests/video.mp4" )
359+ msg := NewVideo (ChatID , FilePath ( "tests/video.mp4" ) )
360360 msg .Duration = 10
361361 msg .Caption = "TEST"
362362
@@ -384,7 +384,7 @@ func TestSendWithExistingVideo(t *testing.T) {
384384func TestSendWithNewVideoNote (t * testing.T ) {
385385 bot , _ := getBot (t )
386386
387- msg := NewVideoNote (ChatID , 240 , "tests/videonote.mp4" )
387+ msg := NewVideoNote (ChatID , 240 , FilePath ( "tests/videonote.mp4" ) )
388388 msg .Duration = 10
389389
390390 _ , err := bot .Send (msg )
@@ -410,7 +410,7 @@ func TestSendWithExistingVideoNote(t *testing.T) {
410410func TestSendWithNewSticker (t * testing.T ) {
411411 bot , _ := getBot (t )
412412
413- msg := NewSticker (ChatID , "tests/image.jpg" )
413+ msg := NewSticker (ChatID , FilePath ( "tests/image.jpg" ) )
414414
415415 _ , err := bot .Send (msg )
416416
@@ -434,7 +434,7 @@ func TestSendWithExistingSticker(t *testing.T) {
434434func TestSendWithNewStickerAndKeyboardHide (t * testing.T ) {
435435 bot , _ := getBot (t )
436436
437- msg := NewSticker (ChatID , "tests/image.jpg" )
437+ msg := NewSticker (ChatID , FilePath ( "tests/image.jpg" ) )
438438 msg .ReplyMarkup = ReplyKeyboardRemove {
439439 RemoveKeyboard : true ,
440440 Selective : false ,
@@ -550,7 +550,7 @@ func TestSetWebhookWithCert(t *testing.T) {
550550
551551 bot .Request (DeleteWebhookConfig {})
552552
553- wh , err := NewWebhookWithCert ("https://example.com/tgbotapi-test/" + bot .Token , "tests/cert.pem" )
553+ wh , err := NewWebhookWithCert ("https://example.com/tgbotapi-test/" + bot .Token , FilePath ( "tests/cert.pem" ) )
554554
555555 if err != nil {
556556 t .Error (err )
@@ -609,8 +609,8 @@ func TestSendWithMediaGroupPhotoVideo(t *testing.T) {
609609
610610 cfg := NewMediaGroup (ChatID , []interface {}{
611611 NewInputMediaPhoto (FileURL ("https://github.com/go-telegram-bot-api/telegram-bot-api/raw/0a3a1c8716c4cd8d26a262af9f12dcbab7f3f28c/tests/image.jpg" )),
612- NewInputMediaPhoto ("tests/image.jpg" ),
613- NewInputMediaVideo ("tests/video.mp4" ),
612+ NewInputMediaPhoto (FilePath ( "tests/image.jpg" ) ),
613+ NewInputMediaVideo (FilePath ( "tests/video.mp4" ) ),
614614 })
615615
616616 messages , err := bot .SendMediaGroup (cfg )
@@ -632,7 +632,7 @@ func TestSendWithMediaGroupDocument(t *testing.T) {
632632
633633 cfg := NewMediaGroup (ChatID , []interface {}{
634634 NewInputMediaDocument (FileURL ("https://i.imgur.com/unQLJIb.jpg" )),
635- NewInputMediaDocument ("tests/image.jpg" ),
635+ NewInputMediaDocument (FilePath ( "tests/image.jpg" ) ),
636636 })
637637
638638 messages , err := bot .SendMediaGroup (cfg )
@@ -653,8 +653,8 @@ func TestSendWithMediaGroupAudio(t *testing.T) {
653653 bot , _ := getBot (t )
654654
655655 cfg := NewMediaGroup (ChatID , []interface {}{
656- NewInputMediaAudio ("tests/audio.mp3" ),
657- NewInputMediaAudio ("tests/audio.mp3" ),
656+ NewInputMediaAudio (FilePath ( "tests/audio.mp3" ) ),
657+ NewInputMediaAudio (FilePath ( "tests/audio.mp3" ) ),
658658 })
659659
660660 messages , err := bot .SendMediaGroup (cfg )
@@ -715,7 +715,7 @@ func ExampleNewWebhook() {
715715
716716 log .Printf ("Authorized on account %s" , bot .Self .UserName )
717717
718- wh , err := NewWebhookWithCert ("https://www.google.com:8443/" + bot .Token , "cert.pem" )
718+ wh , err := NewWebhookWithCert ("https://www.google.com:8443/" + bot .Token , FilePath ( "cert.pem" ) )
719719
720720 if err != nil {
721721 panic (err )
@@ -755,7 +755,7 @@ func ExampleWebhookHandler() {
755755
756756 log .Printf ("Authorized on account %s" , bot .Self .UserName )
757757
758- wh , err := NewWebhookWithCert ("https://www.google.com:8443/" + bot .Token , "cert.pem" )
758+ wh , err := NewWebhookWithCert ("https://www.google.com:8443/" + bot .Token , FilePath ( "cert.pem" ) )
759759
760760 if err != nil {
761761 panic (err )
@@ -1019,7 +1019,7 @@ func TestCommands(t *testing.T) {
10191019// ChatID: ChatID,
10201020// MessageID: m.MessageID,
10211021// },
1022- // Media: NewInputMediaVideo("tests/video.mp4"),
1022+ // Media: NewInputMediaVideo(FilePath( "tests/video.mp4") ),
10231023// }
10241024
10251025// _, err = bot.Request(edit)
@@ -1030,17 +1030,17 @@ func TestCommands(t *testing.T) {
10301030
10311031func TestPrepareInputMediaForParams (t * testing.T ) {
10321032 media := []interface {}{
1033- NewInputMediaPhoto ("tests/image.jpg" ),
1033+ NewInputMediaPhoto (FilePath ( "tests/image.jpg" ) ),
10341034 NewInputMediaVideo (FileID ("test" )),
10351035 }
10361036
10371037 prepared := prepareInputMediaForParams (media )
10381038
1039- if media [0 ].(InputMediaPhoto ).Media != "tests/image.jpg" {
1039+ if media [0 ].(InputMediaPhoto ).Media != FilePath ( "tests/image.jpg" ) {
10401040 t .Error ("Original media was changed" )
10411041 }
10421042
1043- if prepared [0 ].(InputMediaPhoto ).Media != "attach://file-0" {
1043+ if prepared [0 ].(InputMediaPhoto ).Media != fileAttach ( "attach://file-0" ) {
10441044 t .Error ("New media was not replaced" )
10451045 }
10461046
0 commit comments