简体   繁体   English

如何通过php上的bot在电报中创建方便的帖子消息

[英]How to create handy post message in telegram via bot on php

I want to create handy message like in this channel 我想在此频道中创建方便的消息

All I've done is just here code sample 我所做的只是这里的代码示例

    $bot = new \TelegramBot\Api\Client('xxx:yyy');
    $bot->sendMessage("@dtsautocom", "<a href='https://dts-auto.com/{$passanger_car->main_photo}'>{$passanger_car->name}</a> \n{$passanger_car->year} год, {$passanger_car->price} $, пробег - {$passanger_car->mileage} км \nТелефон продавца: {$passanger_car->phone}", 'HTML');
$bot->run();

I wrapped image link to a tag and I get image, but this is not good solution and I've got this . 我裹着图像链接到一个标签,我得到的图像,但这不是很好的解决方案,我已经得到了这个 I want to create like in the first link above. 我想在上面的第一个链接中创建。 How did they do this? 他们是如何做到的? Can anyone give me please code sample of how to do it in right way? 任何人都可以给我代码示例,以正确的方式进行操作吗? Thanks. 谢谢。

They used sendPhoto method with parse_mode set to HTML and formatted photo caption. 他们使用sendPhoto方法并将parse_mode设置为HTML并设置了格式化的图片标题。

For your API library it should be: 对于您的API库,它应该是:

  $bot->sendPhoto("@dtsautocom", "https://dts-auto.com/{$passanger_car->main_photo}", "{$passanger_car->name}\n{$passanger_car->year} год, {$passanger_car->price} $, пробег - {$passanger_car->mileage} км \nТелефон продавца: {$passanger_car->phone}", null, null, false, 'HTML');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM