Commit 79499859 authored by MBoretto's avatar MBoretto

move hideKeyboard to removeKeyboard hide keyboard is deprecated since Bot api 2.3

parent ef9e3944
...@@ -97,7 +97,7 @@ class SendtochannelCommand extends AdminCommand ...@@ -97,7 +97,7 @@ class SendtochannelCommand extends AdminCommand
$this->conversation->update(); $this->conversation->update();
$data['text'] = 'Insert the channel name: (@yourchannel)'; $data['text'] = 'Insert the channel name: (@yourchannel)';
$data['reply_markup'] = Keyboard::hide(['selective' => true]); $data['reply_markup'] = Keyboard::remove(['selective' => true]);
$result = Request::sendMessage($data); $result = Request::sendMessage($data);
break; break;
...@@ -142,7 +142,7 @@ class SendtochannelCommand extends AdminCommand ...@@ -142,7 +142,7 @@ class SendtochannelCommand extends AdminCommand
$notes['state'] = 1; $notes['state'] = 1;
$this->conversation->update(); $this->conversation->update();
$data['reply_markup'] = Keyboard::hide(['selective' => true]); $data['reply_markup'] = Keyboard::remove(['selective' => true]);
$data['text'] = 'Insert the content you want to share: text, photo, audio...'; $data['text'] = 'Insert the content you want to share: text, photo, audio...';
$result = Request::sendMessage($data); $result = Request::sendMessage($data);
break; break;
...@@ -184,7 +184,7 @@ class SendtochannelCommand extends AdminCommand ...@@ -184,7 +184,7 @@ class SendtochannelCommand extends AdminCommand
$this->conversation->update(); $this->conversation->update();
$data['text'] = 'Insert caption:'; $data['text'] = 'Insert caption:';
$data['reply_markup'] = Keyboard::hide(['selective' => true]); $data['reply_markup'] = Keyboard::remove(['selective' => true]);
$result = Request::sendMessage($data); $result = Request::sendMessage($data);
break; break;
} }
...@@ -227,7 +227,7 @@ class SendtochannelCommand extends AdminCommand ...@@ -227,7 +227,7 @@ class SendtochannelCommand extends AdminCommand
$notes['last_message_id'] = $message->getMessageId(); $notes['last_message_id'] = $message->getMessageId();
// no break // no break
case 5: case 5:
$data['reply_markup'] = Keyboard::hide(['selective' => true]); $data['reply_markup'] = Keyboard::remove(['selective' => true]);
if ($notes['post_message']) { if ($notes['post_message']) {
$data['text'] = $this->publish( $data['text'] = $this->publish(
......
...@@ -70,22 +70,22 @@ class CancelCommand extends UserCommand ...@@ -70,22 +70,22 @@ class CancelCommand extends UserCommand
$text = 'Conversation "' . $conversation_command . '" cancelled!'; $text = 'Conversation "' . $conversation_command . '" cancelled!';
} }
return $this->hideKeyboard($text); return $this->removeKeyboard($text);
} }
/** /**
* Hide the keyboard and output a text * Remove the keyboard and output a text
* *
* @param string $text * @param string $text
* *
* @return \Longman\TelegramBot\Entities\ServerResponse * @return \Longman\TelegramBot\Entities\ServerResponse
* @throws \Longman\TelegramBot\Exception\TelegramException * @throws \Longman\TelegramBot\Exception\TelegramException
*/ */
private function hideKeyboard($text) private function removeKeyboard($text)
{ {
return Request::sendMessage( return Request::sendMessage(
[ [
'reply_markup' => Keyboard::hide(['selective' => true]), 'reply_markup' => Keyboard::remove(['selective' => true]),
'chat_id' => $this->getMessage()->getChat()->getId(), 'chat_id' => $this->getMessage()->getChat()->getId(),
'text' => $text, 'text' => $text,
] ]
...@@ -100,6 +100,6 @@ class CancelCommand extends UserCommand ...@@ -100,6 +100,6 @@ class CancelCommand extends UserCommand
*/ */
public function executeNoDb() public function executeNoDb()
{ {
return $this->hideKeyboard('Nothing to cancel.'); return $this->removeKeyboard('Nothing to cancel.');
} }
} }
...@@ -105,7 +105,7 @@ class SurveyCommand extends UserCommand ...@@ -105,7 +105,7 @@ class SurveyCommand extends UserCommand
$this->conversation->update(); $this->conversation->update();
$data['text'] = 'Type your name:'; $data['text'] = 'Type your name:';
$data['reply_markup'] = Keyboard::hide(['selective' => true]); $data['reply_markup'] = Keyboard::remove(['selective' => true]);
$result = Request::sendMessage($data); $result = Request::sendMessage($data);
break; break;
...@@ -238,7 +238,7 @@ class SurveyCommand extends UserCommand ...@@ -238,7 +238,7 @@ class SurveyCommand extends UserCommand
} }
$data['photo'] = $notes['photo_id']; $data['photo'] = $notes['photo_id'];
$data['reply_markup'] = Keyboard::hide(['selective' => true]); $data['reply_markup'] = Keyboard::remove(['selective' => true]);
$data['caption'] = $out_text; $data['caption'] = $out_text;
$this->conversation->stop(); $this->conversation->stop();
......
...@@ -20,11 +20,11 @@ use Longman\TelegramBot\Exception\TelegramException; ...@@ -20,11 +20,11 @@ use Longman\TelegramBot\Exception\TelegramException;
* @link https://core.telegram.org/bots/api#replykeyboardmarkup * @link https://core.telegram.org/bots/api#replykeyboardmarkup
* *
* @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. * @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.
* @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. * @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.
* @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. * @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.
* *
* @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. * @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.
* @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. * @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.
* @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. * @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.
*/ */
class Keyboard extends Entity class Keyboard extends Entity
...@@ -195,18 +195,18 @@ class Keyboard extends Entity ...@@ -195,18 +195,18 @@ class Keyboard extends Entity
} }
/** /**
* Hide the current custom keyboard and display the default letter-keyboard. * Remove the current custom keyboard and display the default letter-keyboard.
* *
* @link https://core.telegram.org/bots/api#replykeyboardhide * @link https://core.telegram.org/bots/api/#replykeyboardremove
* *
* @param array $data * @param array $data
* *
* @return \Longman\TelegramBot\Entities\Keyboard * @return \Longman\TelegramBot\Entities\Keyboard
* @throws \Longman\TelegramBot\Exception\TelegramException * @throws \Longman\TelegramBot\Exception\TelegramException
*/ */
public static function hide(array $data = []) public static function remove(array $data = [])
{ {
return new static(array_merge(['keyboard' => [], 'hide_keyboard' => true, 'selective' => false], $data)); return new static(array_merge(['keyboard' => [], 'remove_keyboard' => true, 'selective' => false], $data));
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment