Sha256: a46c0b1b95480a2b66e7fa2b2052cc4e2d8a41ca5e5636caf0be292e87c3c369

Contents?: true

Size: 734 Bytes

Versions: 3

Compression:

Stored size: 734 Bytes

Contents

require "discorb"
require "discorb-voice"

client.once :standby do
  puts "Logged in as #{client.user}"
end

client.slash "connect", "connect to a voice channel" do |interaction|
  channel = interaction.target.voice_state.channel
  interaction.post "Connecting to #{channel.name}"
  channel.connect.wait
  interaction.post "Connected to #{channel.name}"
end

client.slash "play", "Plays audio" do |interaction|
  interaction.guild.voice_client.play(Discorb::Voice::FFmpegAudio.new("./very-nice-song.mp3"))
  interaction.post "Playing Your very nice song!"
end

client.slash "stop", "Stops the current audio" do |interaction|
  interaction.guild.voice_client.stop
  interaction.post "Stopped"
end

client.run(ENV["DISCORD_BOT_TOKEN"])

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
discorb-voice-0.1.2 examples/simple_player.rb
discorb-voice-0.1.1 examples/simple_player.rb
discorb-voice-0.1.0 examples/simple_player.rb