Last active
October 23, 2018 21:29
-
-
Save waff1es/cd48cdc81fc34e630272598ca2d4de13 to your computer and use it in GitHub Desktop.
the bot connects to discord and connects to whatever voice channel im in but it doesnt play any music ;_; |music_test works though
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
::RBNACL_LIBSODIUM_GEM_LIB_PATH = "C:/ruby22/libsodium.dll" | |
require 'discordrb' | |
require 'youtube-dl' | |
bot = Discordrb::Commands::CommandBot.new token: '<token here>', client_id: <client id here>, prefix: '|' | |
no_channel_warning = "You're not in a voice channel!" | |
bot.command :play do |event, songlink| | |
channel = event.user.voice_channel | |
event.respond no_channel_warning unless channel | |
bot.voice_connect(channel) | |
YoutubeDL.download "#{songlink}", output: "C:/user/Documents/discordrb-master/somename.mp3" | |
voice_bot = event.voice | |
voice_bot.play_file "C:/user/Documents/discordrb-master/somename.mp3" | |
end | |
bot.command :music_test do |event| #this is to test the music playing bullshit. Still figuring out how to play from youtube and such | |
channel = event.user.voice_channel | |
bot.voice_connect(channel) | |
voice_bot = event.voice | |
voice_bot.play_file('<file_location_here>') | |
end | |
bot.command :shutdown do |event| | |
event.respond "good night :)" | |
exit | |
end | |
bot.run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment