doumowu7371 2018-01-20 15:43
浏览 72

类声明必须与telegram bot包中的接口错误兼容

I'm using irazasyed/telegram-bot-sdk to make a telegram bot.

but when I installed the dev-develop first I got this error :

    Cannot use Telegram\Bot\Objects\Message as Message because the name is already in use {"exception":"[object]  
 (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 64): Cannot use Telegram\\Bot\\Objects\\Message as Message because the name is already in use at D:\\wamp\\www\\botshop\\vendor\\irazasyed\\telegram-bot-sdk\\src\\Methods\\Payments.php:5)

But after that when I commented use Telegram\Bot\Objects\Message; in line 5 of Payments.php , error not shown again.

But another problem was created that said :

Declaration of App\Commands\StartCommand::handle($arguments) must be compatible with Telegram\Bot\Commands\Command::handle()

this is a simple StartCommand that is also used by itself package in all example of creating new command :

class StartCommand extends Command
{
    protected $name = "start";

    protected $description = "Start Command to get you started";

    public function handle($arguments)
    {
        $this->replyWithMessage(['text' => 'Hello! Welcome to our bot, Here are our available commands:']);

    }
}

I'm using php7.0.10 and laravel 5.5.

  • 写回答

1条回答 默认 最新

  • douduonang3169 2018-01-20 15:49
    关注

    The handle function doesn't take any argument by default on the Telegram\Bot\Commands\Command class.

    Since you don't use the $arguments variable, you can delete it from the handle function parameters and your code should work again.

    评论

报告相同问题?

悬赏问题

  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序