rocketmates / discord-php

Discord PHP Library powering the RocketMates Discord Bot
https://www.rocketmates.de/
MIT License
10 stars 1 forks source link

Audio don't play / Updatepresence don't work #2

Open julesnln opened 4 years ago

julesnln commented 4 years ago

Hi ! Thanks for keep discordphp up !

I made a script for when using !vocal [id of channel] the bot came and play sound but i got no sound when bot connect and no error in console here is my script

if(strstr($message->content, '!vocal')){ if($message->author->id == "210584395680055296"){ $vowels = array("!vocal "); $join = str_replace($vowels, "", $message->content); $guild = $discord->guilds->get('name', 'Entre potes'); $channel = $guild->channels->get('id', $join); $discord->joinVoiceChannel($channel)->then(function (VoiceClient $vc) use ($channel) { echo 'Joined '.$channel->name.' voice channel'.PHP_EOL; // Runs fine $vc->setFrameSize(40)->then(function () use ($vc) { $vc->playFile('meme-original-scream.mp3')->then(function () { echo 'Playing test on '.$channel->name.' voice channel.\r\n'; // Not being executed }); }); });

}else{ $message->channel->sendMessage("ta pa la perm fdp ! (seul lil french a la perm)"); } }

Same problem with Updatepresence, i use the script in the wiki but nothing happend.

(sorry for bad english im french lol) Thanks :)

julesnln commented 4 years ago

same for sendFile

Thorrdu commented 4 years ago

Hello,

UpdatePresence has been reported ans it will be fixed soon

Unless isn't already fixed when you read this message, you can fix it this way: On rocketmates/discord-php/src/Discord/WebSockets/Events/PresenceUpdate.php Line: 52 Remplace this line with: 'nick' => (isset($presenceAttributes['nick']))?$presenceAttributes['nick']:'',

A better fix may occur soon by the dev.

Have a good day

oliverschloebe commented 4 years ago

Hi Jules, using the VoiceClient requires some additional modules to be installed: https://discordphp.readme.io/docs/requirements Do you have them installed?

Also, you seem to be trying to play the MP3 file without providing a specific path: $vc->playFile('meme-original-scream.mp3') If you're not running the script from the same folder the MP3 file is located it won't find the file.

julesnln commented 4 years ago

Thanks Thorrdu i will try Olivier i install all depencies and the file is in the same folder

julesnln commented 4 years ago

Oh and the sendfile don't work too :(