1.0.0 • Published 2 years ago

radio-garden-player v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Radio-Garden-Player

  • A Simple, Light Package to play Radio Stations from Radio.Garden

Functions

  • play
const { play } = require('radio-garden-player')

/**
 * @param {String} channelID
*/
play(channelID) // ChannelID Can be found in the url for example mrimG8MM
  • checkIfValid

Examples

  • Discord Bot
const voice = require("@discordjs/voice")
const Discord = require("discord.js")
const client = new Discord.Client({intents: [Discord.GatewayIntentBits.Guilds, Discord.GatewayIntentBits.GuildVoiceStates, Discord.GatewayIntentBits.GuildMessages]})
const { play } = require("radio-garden-player")

client.on("ready", () =>{ 
    console.log("Ready")
})

client.on("messageCreate", async(message) =>{

    if(message.content == "!!play"){

        const connection = voice.joinVoiceChannel({
        "adapterCreator": message.guild.voiceAdapterCreator,
        "guildId": message.guild.id,
        "channelId": message.member.voice.channel.id
        })

        const stream = await play("mrimG8MM")

        const player = voice.createAudioPlayer()

        const resource = voice.createAudioResource(stream)

        player.play(resource)

        connection.subscribe(player)

        message.channel.send({content: "Playing Radio"})

    }
    
})

client.login(token_here)