简体   繁体   English

未捕获的错误:未找到 Class 'Discord\Client' PHP

[英]Uncaught Error: Class 'Discord\Client' not found PHP

I am working with Php and "Discord",Right now i am getting following message "Fatal error: Uncaught Error: Class 'Discord\Client' not found",But in my "src folder" Client Libraray exist,I have "Vendor" and "src" folder exist, And "client.php" is there,Here is my code,Where i am wrong?我正在使用 Php 和“Discord”,现在我收到以下消息“致命错误:未捕获的错误:Class 'Discord\Client' not found”,但在我的“src 文件夹”客户端库中存在,我有“供应商”并且“src”文件夹存在,并且“client.php”在那里,这是我的代码,我错在哪里?

<?php
include __DIR__.'/vendor/autoload.php';
include 'vendor/autoload.php';
use Discord\Discord;
use Discord\Parts\Interactions\Command\Command; // Please note to use this correct namespace!
use Discord\Client;
use Discord\Parts\Interaction;
use Discord\Parts\Choices;
$client = new Client([
    'public_key' => 'b81678ce3e98ff78f9387c3cxxxxxxxxxxxxxxxx',
    'uri' => '0.0.0.0:80', // if you want the client to listen on a different URI
    'logger' => $logger, // different logger, default will write to stdout
    'loop' => $loop, // reactphp event loop, default creates a new loop
    'socket_options' => [], // options to pass to the react/socket instance, default empty array
]);

You need to use你需要使用

$client = new Discord([
    'token' => 'b81678ce3e98ff78f9387c3cxxxxxxxxxxxxxxxx'
]);

Instead of client because library team-reflex/discord-php using Discord class instead of Client in direct interaction.而不是客户端,因为库team-reflex/discord-php在直接交互中使用 Discord class 而不是客户端。

Here you can find the use cases.在这里您可以找到用例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM