|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Created by PhpStorm. |
|
4
|
|
|
* User: iGusev |
|
5
|
|
|
* Date: 14/04/16 |
|
6
|
|
|
* Time: 16:53 |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace TelegramBot\Api\Types\Inline\QueryResult; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Class Audio |
|
13
|
|
|
* @see https://core.telegram.org/bots/api#inlinequeryresultaudio |
|
14
|
|
|
* Represents a link to an mp3 audio file. By default, this audio file will be sent by the user. |
|
15
|
|
|
* Alternatively, you can use input_message_content to send a message with the specified content instead of the audio. |
|
16
|
|
|
* |
|
17
|
|
|
* Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them. |
|
18
|
|
|
* |
|
19
|
|
|
* @package TelegramBot\Api\Types\Inline\QueryResult |
|
20
|
|
|
*/ |
|
21
|
|
|
class Audio extends AbstractInlineQueryResult |
|
22
|
|
|
{ |
|
23
|
|
|
/** |
|
24
|
|
|
* {@inheritdoc} |
|
25
|
|
|
* |
|
26
|
|
|
* @var array |
|
27
|
|
|
*/ |
|
28
|
|
|
static protected $requiredParams = ['type', 'id', 'audio_url', 'title']; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* {@inheritdoc} |
|
32
|
|
|
* |
|
33
|
|
|
* @var array |
|
34
|
|
|
*/ |
|
35
|
|
|
static protected $map = [ |
|
36
|
|
|
'type' => true, |
|
37
|
|
|
'id' => true, |
|
38
|
|
|
'audio_url' => true, |
|
39
|
|
|
'title' => true, |
|
40
|
|
|
'performer' => true, |
|
41
|
|
|
'audio_duration' => true, |
|
42
|
|
|
'reply_markup' => InlineKeyboardMarkup::class, |
|
43
|
|
|
'input_message_content' => InputMessageContent::class, |
|
44
|
|
|
]; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* {@inheritdoc} |
|
48
|
|
|
* |
|
49
|
|
|
* @var string |
|
50
|
|
|
*/ |
|
51
|
|
|
protected $type = 'audio'; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* A valid URL for the audio file |
|
55
|
|
|
* |
|
56
|
|
|
* @var string |
|
57
|
|
|
*/ |
|
58
|
|
|
protected $audioUrl; |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* Optional. Performer |
|
62
|
|
|
* |
|
63
|
|
|
* @var string |
|
64
|
|
|
*/ |
|
65
|
|
|
protected $performer; |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* Optional. Audio duration in seconds |
|
69
|
|
|
* |
|
70
|
|
|
* @var int |
|
71
|
|
|
*/ |
|
72
|
|
|
protected $audioDuration; |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* Optional. Inline keyboard attached to the message |
|
76
|
|
|
* |
|
77
|
|
|
* @var InlineKeyboardMarkup |
|
78
|
|
|
*/ |
|
79
|
|
|
protected $replyMarkup; |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* Optional. Content of the message to be sent instead of the audio |
|
83
|
|
|
* |
|
84
|
|
|
* @var InputMessageContent |
|
85
|
|
|
*/ |
|
86
|
|
|
protected $inputMessageContent; |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Audio constructor. |
|
90
|
|
|
* |
|
91
|
|
|
* @param string $id |
|
92
|
|
|
* @param string $audioUrl |
|
93
|
|
|
* @param string $title |
|
94
|
|
|
* @param string $performer |
|
95
|
|
|
* @param int $audioDuration |
|
96
|
|
|
* @param InlineKeyboardMarkup $replyMarkup |
|
97
|
|
|
* @param InputMessageContent $inputMessageContent |
|
98
|
|
|
*/ |
|
99
|
|
|
public function __construct( |
|
100
|
|
|
$id, |
|
101
|
|
|
$audioUrl, |
|
102
|
|
|
$title, |
|
103
|
|
|
$performer = null, |
|
104
|
|
|
$audioDuration = null, |
|
105
|
|
|
InlineKeyboardMarkup $replyMarkup = null, |
|
106
|
|
|
InputMessageContent $inputMessageContent = null |
|
107
|
|
|
) { |
|
108
|
|
|
$this->id = $id; |
|
109
|
|
|
$this->audioUrl = $audioUrl; |
|
110
|
|
|
$this->title = $title; |
|
111
|
|
|
$this->performer = $performer; |
|
112
|
|
|
$this->audioDuration = $audioDuration; |
|
113
|
|
|
$this->replyMarkup = $replyMarkup; |
|
114
|
|
|
$this->inputMessageContent = $inputMessageContent; |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
|
|
118
|
|
|
} |
|
119
|
|
|
|