내 PHP 스크립트-Github 라이브러리 (마지막 링크)가 텔레 그램 봇과 통신 중이지만이 봇은 채널과 채널 채팅 모두에 메시지를 보냅니다.
$canalID= "@xxx";
$botKey = "xx:xxxx-yyy";
$requestFactory = new Http\Factory\Guzzle\RequestFactory();
$streamFactory = new Http\Factory\Guzzle\StreamFactory();
$client = new Http\Adapter\Guzzle6\Client();
$apiClient = new \TgBotApi\BotApiBase\ApiClient($requestFactory, $streamFactory, $client);
$bot = new \TgBotApi\BotApiBase\BotApi($botKey, $apiClient, new \TgBotApi\BotApiBase\BotApiNormalizer());
$text = "Olá";
$arr = ["parseMode" => "HTML"];
$bot->send(\TgBotApi\BotApiBase\Method\SendMessageMethod::create($canalID, $text, $arr));
로봇이 채널에 메시지를 보내고 해당 채널의 채팅에서 복제를 중지하기를 바랍니다.
그는 채팅에 속하지 않고 채널에만 속합니다.
왜 그가 메시지에 답장했는지 모르겠습니다 ..
다음 기능을 사용할 수 있습니다 ( 라이브러리 필요 없음 ).
<?php
tg("Olá");
function tg($text) {
$data = ['chat_id' => '@xxx', 'disable_web_page_preview' => true, 'parse_mode' => 'HTML', 'text' => $text];
file_get_contents('https://api.telegram.org/xx:xxxx-yyy/sendMessage?'.http_build_query($data));
}
바꾸다:
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다