Skip to content

Commit 785b6b2

Browse files
committed
Merge branch 'develop' of https://github.com/akalongman/php-telegram-bot into fixes
2 parents 15bf35b + 7d38e1e commit 785b6b2

File tree

9 files changed

+21
-64
lines changed

9 files changed

+21
-64
lines changed

.travis.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ sudo: required
33
language: php
44

55
addons:
6-
apt:
7-
packages:
8-
- mysql-server-5.6
9-
- mysql-client-core-5.6
10-
- mysql-client-5.6
6+
mariadb: '10.1'
117

128
cache:
139
directories:

src/Commands/AdminCommands/SendtochannelCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function execute()
9797
$this->conversation->update();
9898

9999
$data['text'] = 'Insert the channel name: (@yourchannel)';
100-
$data['reply_markup'] = Keyboard::hide(['selective' => true]);
100+
$data['reply_markup'] = Keyboard::remove(['selective' => true]);
101101
$result = Request::sendMessage($data);
102102

103103
break;
@@ -142,7 +142,7 @@ public function execute()
142142
$notes['state'] = 1;
143143
$this->conversation->update();
144144

145-
$data['reply_markup'] = Keyboard::hide(['selective' => true]);
145+
$data['reply_markup'] = Keyboard::remove(['selective' => true]);
146146
$data['text'] = 'Insert the content you want to share: text, photo, audio...';
147147
$result = Request::sendMessage($data);
148148
break;
@@ -184,7 +184,7 @@ public function execute()
184184
$this->conversation->update();
185185

186186
$data['text'] = 'Insert caption:';
187-
$data['reply_markup'] = Keyboard::hide(['selective' => true]);
187+
$data['reply_markup'] = Keyboard::remove(['selective' => true]);
188188
$result = Request::sendMessage($data);
189189
break;
190190
}
@@ -227,7 +227,7 @@ public function execute()
227227
$notes['last_message_id'] = $message->getMessageId();
228228
// no break
229229
case 5:
230-
$data['reply_markup'] = Keyboard::hide(['selective' => true]);
230+
$data['reply_markup'] = Keyboard::remove(['selective' => true]);
231231

232232
if ($notes['post_message']) {
233233
$data['text'] = $this->publish(

src/Commands/UserCommands/CancelCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,22 @@ public function execute()
7070
$text = 'Conversation "' . $conversation_command . '" cancelled!';
7171
}
7272

73-
return $this->hideKeyboard($text);
73+
return $this->removeKeyboard($text);
7474
}
7575

7676
/**
77-
* Hide the keyboard and output a text
77+
* Remove the keyboard and output a text
7878
*
7979
* @param string $text
8080
*
8181
* @return \Longman\TelegramBot\Entities\ServerResponse
8282
* @throws \Longman\TelegramBot\Exception\TelegramException
8383
*/
84-
private function hideKeyboard($text)
84+
private function removeKeyboard($text)
8585
{
8686
return Request::sendMessage(
8787
[
88-
'reply_markup' => Keyboard::hide(['selective' => true]),
88+
'reply_markup' => Keyboard::remove(['selective' => true]),
8989
'chat_id' => $this->getMessage()->getChat()->getId(),
9090
'text' => $text,
9191
]
@@ -100,6 +100,6 @@ private function hideKeyboard($text)
100100
*/
101101
public function executeNoDb()
102102
{
103-
return $this->hideKeyboard('Nothing to cancel.');
103+
return $this->removeKeyboard('Nothing to cancel.');
104104
}
105105
}

src/Commands/UserCommands/SurveyCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function execute()
105105
$this->conversation->update();
106106

107107
$data['text'] = 'Type your name:';
108-
$data['reply_markup'] = Keyboard::hide(['selective' => true]);
108+
$data['reply_markup'] = Keyboard::remove(['selective' => true]);
109109

110110
$result = Request::sendMessage($data);
111111
break;
@@ -238,7 +238,7 @@ public function execute()
238238
}
239239

240240
$data['photo'] = $notes['photo_id'];
241-
$data['reply_markup'] = Keyboard::hide(['selective' => true]);
241+
$data['reply_markup'] = Keyboard::remove(['selective' => true]);
242242
$data['caption'] = $out_text;
243243
$this->conversation->stop();
244244

src/Entities/Keyboard.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
* @link https://core.telegram.org/bots/api#replykeyboardmarkup
2121
*
2222
* @method bool getResizeKeyboard() Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard.
23-
* @method bool getOneTimeKeyboard() Optional. Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. Defaults to false.
23+
* @method bool getOneTimeKeyboard() Optional. Requests clients to remove the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. Defaults to false.
2424
* @method bool getSelective() Optional. Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
2525
*
2626
* @method $this setResizeKeyboard(bool $resize_keyboard) Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard.
27-
* @method $this setOneTimeKeyboard(bool $one_time_keyboard) Optional. Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. Defaults to false.
27+
* @method $this setOneTimeKeyboard(bool $one_time_keyboard) Optional. Requests clients to remove the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. Defaults to false.
2828
* @method $this setSelective(bool $selective) Optional. Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
2929
*/
3030
class Keyboard extends Entity
@@ -195,18 +195,18 @@ protected function validate()
195195
}
196196

197197
/**
198-
* Hide the current custom keyboard and display the default letter-keyboard.
198+
* Remove the current custom keyboard and display the default letter-keyboard.
199199
*
200-
* @link https://core.telegram.org/bots/api#replykeyboardhide
200+
* @link https://core.telegram.org/bots/api/#replykeyboardremove
201201
*
202202
* @param array $data
203203
*
204204
* @return \Longman\TelegramBot\Entities\Keyboard
205205
* @throws \Longman\TelegramBot\Exception\TelegramException
206206
*/
207-
public static function hide(array $data = [])
207+
public static function remove(array $data = [])
208208
{
209-
return new static(array_merge(['keyboard' => [], 'hide_keyboard' => true, 'selective' => false], $data));
209+
return new static(array_merge(['keyboard' => [], 'remove_keyboard' => true, 'selective' => false], $data));
210210
}
211211

212212
/**

src/Telegram.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Telegram
3030
*
3131
* @var string
3232
*/
33-
protected $version = '0.35.0';
33+
protected $version = '0.36.0';
3434

3535
/**
3636
* Telegram API key

tests/unit/Entities/FileTest.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,6 @@ public function testGetFilePath()
103103
$this->assertEquals($this->data['file_path'], $path);
104104
}
105105

106-
/**
107-
*
108-
* Testing without file id
109-
*
110-
* @expectedException Longman\TelegramBot\Exception\TelegramException
111-
*
112-
*/
113-
public function testCreateInstanceWithoutFileId()
114-
{
115-
unset($this->data['file_id']);
116-
new File($this->data);
117-
}
118-
119106
/**
120107
*
121108
* Testing getFileSize without data

tests/unit/Entities/KeyboardTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ public function testKeyboardWithDataArray()
136136

137137
public function testPredefinedKeyboards()
138138
{
139-
$keyboard_hide = Keyboard::hide();
140-
self::assertTrue($keyboard_hide->getProperty('hide_keyboard'));
139+
$keyboard_remove = Keyboard::remove();
140+
self::assertTrue($keyboard_remove->getProperty('remove_keyboard'));
141141

142142
$keyboard_force_reply = Keyboard::forceReply();
143143
self::assertTrue($keyboard_force_reply->getProperty('force_reply'));

tests/unit/Entities/LocationTest.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -89,30 +89,4 @@ public function testGetLatitude()
8989
$this->assertInternalType('float', $lat);
9090
$this->assertEquals($this->coordinates['latitude'], $lat);
9191
}
92-
93-
/**
94-
*
95-
* Testing without longitude
96-
*
97-
* @expectedException Longman\TelegramBot\Exception\TelegramException
98-
*
99-
*/
100-
public function testCreateInstanceWithoutLongitude()
101-
{
102-
unset($this->coordinates['longitude']);
103-
new Location($this->coordinates);
104-
}
105-
106-
/**
107-
*
108-
* Testing without latitude
109-
*
110-
* @expectedException Longman\TelegramBot\Exception\TelegramException
111-
*
112-
*/
113-
public function testCreateInstanceWithoutLatitude()
114-
{
115-
unset($this->coordinates['latitude']);
116-
new Location($this->coordinates);
117-
}
11892
}

0 commit comments

Comments
 (0)