我正在使用Telegram Bot Php-Sdk。由于问题是自我解释,我试图在相同的域上运行多个机器人但不同的路由。我在mybot.domain.com/someroute上有一个带有webhook设置的live bot和mybot2.domain.com/someroute上的一个staging bot。两者都在不同的服务器上。今天我创建了一个新的bot,创建了一个新的Controller并在Controller的构造函数中传递了bot令牌,例如
class BotController extends Controller{
function __construct() {
config(['telegram.bot_token'=>'my_bot_token');
}
}
我为这个新机器人添加了一个新的webhook,如mybot2.domain.com/DifferentRoute。但是自从这个新机器人的部署和webhook设置时,我的所有3个机器人都没有响应。我没有得到任何关于getWebhookUpdate函数的聊天数据。 需要指导谢谢
答案 0 :(得分:2)
您可以使用查询字符串来区分机器人。
例如,机器人A使用Got a simple and tested layout solution right here. Refer to code below :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:background="#efe304"
android:orientation="vertical"
tools:context="com.example.myname.appname.NameActivity" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#ff0900"
android:paddingTop="20px" >
<Space
android:id="@+id/space1"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_weight="0.5" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="20px" >
<Space
android:id="@+id/space1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#efe304"
android:layout_weight="0.5" />
<ListView
android:id="@+id/listView2"
android:layout_width="124dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#009900"
android:divider="#009900"
android:dividerHeight="10dp"
android:gravity="center"
android:scrollbars="none" />
<Space
android:id="@+id/space1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#efe304"
android:layout_weight="0.5" />
<ListView
android:id="@+id/listView2"
android:layout_width="124dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#009900"
android:divider="#009900"
android:dividerHeight="10dp"
android:gravity="center"
android:scrollbars="none" />
<Space
android:id="@+id/space1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#efe304"
android:layout_weight="0.5" />
</LinearLayout>
</LinearLayout>
,您可以在代码中识别它们。