dpyoh6553 2016-09-13 09:08
浏览 66

从电报机器人中获取注册数据

I'm trying to create a Telegram API bot for clients registration , so I chose the ' setWebHook ' method and wrote some codes :

<?php

include("config.php");

$content = file_get_contents("php://input");
$update = json_decode($content, true);
$user_id = $update["message"]["chat"]["id"];

if( $update["message"]["text"] == "/start" OR $update["message"]["text"] == "/menu" ){
$keyboard = array(

'keyboard' => array(
array("

  • 写回答

1条回答 默认 最新

  • douchui1657 2016-09-13 09:26
    关注

    As I understand from your question these are some tips maybe helpful for you:

    Each message that delivers from telegram (users) have an id that tell which user sends the message(==chat_id a unique number).

    Your bot should log messages and save the important parts of messages in a db. In this manner you have a track of user's conversation with your bot and you can recognize that for which question of your bot ,user answers. If you look for each Json object delivers from telegram you can see which data telegram reveals from user.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错