[*] комбинированный класс для работы с телеграм
This commit is contained in:
1 parent
1d6124a975
commit
f74c23b527
3 files changed
+22
-5
No files matched your search
@@ -172,8 +172,8 @@
|
|||||||
/**
|
/**
|
||||||
* Изменяет уже отправленное сообщение на указанное
|
* Изменяет уже отправленное сообщение на указанное
|
||||||
*
|
*
|
||||||
* @param $chatId
|
* @param int $chatId
|
||||||
* @param $messageId
|
* @param int $messageId
|
||||||
* @param string $text
|
* @param string $text
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
|
|||||||
@@ -136,6 +136,24 @@
|
|||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Изменяет уже отправленное сообщение на указанное
|
||||||
|
*
|
||||||
|
* @param int $messageId
|
||||||
|
* @param string $text
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function updateMessage(int $messageId, string $text): array
|
||||||
|
{
|
||||||
|
$response = [
|
||||||
|
'chat_id' => $this->chatId,
|
||||||
|
'message_id' => $messageId,
|
||||||
|
'text' => $text,
|
||||||
|
];
|
||||||
|
return $this->setMethod('editMessageText')->sendRequest($response);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Отправка изображения
|
* Отправка изображения
|
||||||
*
|
*
|
||||||
|
|||||||
+2
-3
@@ -15,8 +15,7 @@
|
|||||||
$tg = new Telegram2(TELEGRAM_BOT_TOKEN);
|
$tg = new Telegram2(TELEGRAM_BOT_TOKEN);
|
||||||
$tg->setRemoteRequest($data);
|
$tg->setRemoteRequest($data);
|
||||||
|
|
||||||
$tg->setChat(TELEGRAM_ADMIN_CHAT_ID)->sendMessage(print_r($tg->getChat('bitrix'), true));
|
$res = $tg->setChat(TELEGRAM_ADMIN_CHAT_ID)->updateMessage(121, '');
|
||||||
//$tg->setChat(TELEGRAM_ADMIN_CHAT_ID)->sendLocation( '54.007143', '38.046204');
|
|
||||||
|
|
||||||
|
|
||||||
// sendTelegram(print_r($data, true));
|
sendTelegram(print_r($res, true));
|
||||||
Reference in new issue
Block a user