rocketmates/discord-php

Compatibility Symfony 5

hugoguitton-x opened this issue · 5 comments

Hi, we can't use it with Symfony 5.

image

Is it possible to make this possible?

Hi @hugoguitton-x, just added Symfony 5 support. Please check, thank you!

Hi @oliverschloebe thanks for the modification. I can install it thanks to composer, however I can't use it with Symfony apparently.

I have the following message: "DiscordPHP will not run on a webserver. Please use PHP CLI to run a DiscordPHP bot."

I have the following message: "DiscordPHP will not run on a webserver. Please use PHP CLI to run a DiscordPHP bot."

That is because you can't run DiscordPHP in the browser. You have to run it using CLI.

Okay. I'm dumb my bad. This code works fine !

$discord = new Discord([
    'token' => 'bot-token',
]);

$discord->on('ready', function ($discord) {
    echo "Bot is ready!", PHP_EOL;

    // Listen for messages.
    $discord->on('message', function ($message, $discord) {
        echo "{$message->author->username}: {$message->content}",PHP_EOL;
    });
});
$discord->run();

No worries! Glad you got it working. 👍🏻