-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaudio_test.go
43 lines (35 loc) · 964 Bytes
/
audio_test.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
package telebot
import (
"github.com/stretchr/testify/require"
"testing"
"time"
)
func Test_Online_SendAudio(t *testing.T) {
AudioFromURL := FromURL("https://raw.githubusercontent.com/reloadlife/telebot/master/.github/audio.m4a")
AudioFromFile := FromDisk("./.github/audio.m4a")
AudioFromFile.fileName = "audio.m4a"
require.True(t, AudioFromFile.OnDisk())
markup := NewMarkup()
markup.Inline()
markup.AddRow(NewInlineKeyboardButton("Audio TEST", "hey"))
msg, err = tg.SendAudio(whereTo, AudioFromURL,
"**Caption\\.**",
ParseModeMarkdownV2,
markup,
Silent,
Protected,
106*time.Second,
Performer("TeleBot"),
Title("Test Audio"),
&thumb,
replyParam,
)
require.NoError(t, err)
require.NotNil(t, msg)
require.Equal(t, msg.Chat.ID, intChatID)
require.Equal(t, *msg.Caption, "Caption.")
replyParam.MessageID = msg.ID
require.Panics(t, func() {
_, _ = tg.SendAudio(whereTo, AudioFromURL, "Some Caption!", false, true)
})
}