Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/240.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 类的声明必须与电报bot包中的接口错误兼容_Php_Telegram_Telegram Bot - Fatal编程技术网

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

Php 类的声明必须与电报bot包中的接口错误兼容,php,telegram,telegram-bot,Php,Telegram,Telegram Bot,我在用机器人打电报 但是,当我首先安装dev develope时,我遇到了以下错误: 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\\

我在用机器人打电报

但是,当我首先安装
dev develope
时,我遇到了以下错误:

    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)
但在那之后,当我评论
使用电报\Bot\Objects\Message时位于的第5行,错误不再显示

但另一个问题是:

Declaration of App\Commands\StartCommand::handle($arguments) must be compatible with Telegram\Bot\Commands\Command::handle()
这是一个简单的
StartCommand
,在创建新命令的所有示例中,它本身也使用该包:

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:']);

    }
}

我使用的是php7.0.10和laravel5.5

默认情况下,
handle
函数在
电报\Bot\Commands\Command
类上不接受任何参数


由于您不使用
$arguments
变量,因此可以从
句柄
函数参数中删除该变量,您的代码应该可以再次工作。

在我使用的版本3中,它在许多情况下都使用了
$arguments
。在这种情况下,我必须删除这些参数,但如何发送自定义参数?请注意,我从未使用过此库,但从我在项目中查找的情况来看,此分支似乎有点不稳定和快速移动,这对于生产来说可能不是一个好主意。从他们使用的最新电报库来看,他们的文件似乎已经过时了。