{"size": 1719, "ext": "js", "max_stars_repo_path": "commands/radio.js", "max_stars_repo_name": "MirenaBOT/Mirena-v2", "max_stars_repo_stars_event_min_datetime": "2020-12-20T18:04:40.000Z", "max_stars_repo_stars_event_max_datetime": "2020-12-20T18:04:40.000Z", "max_issues_repo_path": "commands/radio.js", "max_issues_repo_name": "MirenaBOT/Mirena-v2", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "commands/radio.js", "max_forks_repo_name": "MirenaBOT/Mirena-v2", "max_forks_repo_forks_event_min_datetime": "2019-12-02T17:44:09.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-02T17:44:09.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 39.976744186, "max_line_length": 200, "alphanum_fraction": 0.6294357184}
module.exports.run = async (client, message) => {

    const radio = {
        "nrj": "http://185.52.127.132/fr/30001/mp3_128.mp3?origine=fluxradios",
        "rtl2": "http://streaming.radio.rtl2.fr/rtl2-1-48-192",
        "skyrock": "http://icecast.skyrock.net/s/natio_mp3_128k?tvr_name=tunein16&tvr_section1=128mp3",
        "rfm": "http://rfm-live-mp3-128.scdn.arkena.com/rfm.mp3",
        "fun": "http://streaming.radio.funradio.fr/fun-1-44-128",
        "virgin": "http://vr-live-mp3-128.scdn.arkena.com/virginradio.mp3"
    }

    if (!message.member.voiceChannel) return message.channel.send(`You must be connected in a living room!`)

    if(!message.member.voiceChannel.joinable) return message.channel.send(`I don't have permission to join in this living room!`);

    if(!message.member.voiceChannel.speakable) return message.channel.send(`I don't have permission to talk in this living room!`);

    let args = message.content.split(" ").slice(1).join(" ").toLowerCase();

    if (!args) return message.channel.send('Please specify a radio name, here is the list of available radios:\n • **nrj,**\n • **rtl2,**\n • **skyrock,**\n • **rfm,**\n • **radio,**\n • **virgin.**')

    if (!radio[args]) return message.channel.send('Invalid radio, here is the list of available radios:\n • **nrj,**\n • **rtl2,**\n • **skyrock,**\n • **rfm,**\n • **radio,**\n • **virgin.**')

    message.member.voiceChannel.join().then(connection => {

        require('http').get(radio[args], (res) => {

            connection.playStream(res);

            message.channel.send(`**${args}**  has just been launched good listening`);

        });

    });

}

module.exports.help = {
    name: "radio",
    category: "music"

}
