【问题标题】:Telegram bot : SendPhoto method doesn't work电报机器人:SendPhoto 方法不起作用
【发布时间】:2018-02-05 21:31:48
【问题描述】:

我有一个机器人,这个机器人通过 cronjob 向我的频道发送一些消息。这些消息是一种照片、简单的文本、视频、gif(文档)和语音。 有一段时间我尝试使用以下代码发送照片:

            $this->api->apiRequest(
                'sendPhoto',
                array(
                    'chat_id' => $this->chatid,
                    'photo' => $this->msg_data['file_id'],
                    'caption' => $this->msg_text,
                    'reply_to_message_id' => $this->message_id,
                    'reply_markup' => $reply_markup,
                )
            );

有什么问题?为什么不发一些照片?

我从电报 API 收到此错误

{"ok":false,"error_code":400,"description":"Bad Request: wrong file identifier/HTTP URL specified"}

【问题讨论】:

  • 很遗憾,您的问题不完整。它不提供错误消息或至少提示可能出错的地方和位置。我们没有魔法球来猜测错误。
  • 什么是错误信息?
  • @Andrew 我添加了错误
  • @Sean 附加的错误
  • 你检查过$this->msg_data['file_id']的值吗?

标签: php telegram-bot


【解决方案1】:

我的问题解决了!我发送给api的file_id是错误的,当有文件大小时我应该设置一个文件id!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-12-12
    • 2022-07-02
    • 1970-01-01
    • 2017-08-01
    • 2017-08-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多