I am developing a discord bot with php. I want to create invite link via DiscordPHP package.
Here what I write
include __DIR__.'/vendor/autoload.php';
use Discord\Discord;
$discord = new Discord([
'token' => 'MY_TOKKEN',
]);
$discord->on('ready', function ($discord) {
echo "Bot is ready!", PHP_EOL;
$discord->on('message', function ($message, $discord) {
$channel = $message->channel;
$channel->createInvite([
'max_age' => 60,
'max_uses' => 5,
])->done(function (Invite $invite) {
echo $invite->code;
});
});
});
$discord->run();
From echo $invite->code; I didn't getting any response string which I acn use to share.