Initial import

master
Astoria Floyd 3 years ago
commit 15b1a2e06a

@ -0,0 +1,3 @@
source 'https://rubygems.org'
gem 'discordrb'
gem 'toml'

@ -0,0 +1,49 @@
GEM
remote: https://rubygems.org/
specs:
discordrb (3.4.0)
discordrb-webhooks (~> 3.3.0)
ffi (>= 1.9.24)
opus-ruby
rest-client (>= 2.0.0)
websocket-client-simple (>= 0.3.0)
discordrb-webhooks (3.3.0)
rest-client (>= 2.1.0.rc1)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
event_emitter (0.2.6)
ffi (1.15.4)
http-accept (1.7.0)
http-cookie (1.0.4)
domain_name (~> 0.5)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2021.0901)
netrc (0.11.0)
opus-ruby (1.0.1)
ffi
parslet (2.0.0)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
toml (0.3.0)
parslet (>= 1.8.0, < 3.0.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.8)
websocket (1.2.9)
websocket-client-simple (0.3.0)
event_emitter
websocket
PLATFORMS
x86_64-linux
DEPENDENCIES
discordrb
toml
BUNDLED WITH
2.2.30

@ -0,0 +1,3 @@
pingcommand
pongcommand
playMusic

@ -0,0 +1,5 @@
def pingcommand(bot, bang)
bot.message(with_text: "#{bang}Ping") do |event|
event.respond 'Pong!'
end
end

@ -0,0 +1,26 @@
def playMusic(bot, bang)
bot.message(start_with: "#{bang}Play ") do |event|
message = event.content
author = event.author
voice_channel = author.voice_channel.id
server = event.server
bot.voice_connect(voice_channel)
arguments = message.sub("#{bang}Play ", '').split.first
#event.voice.play_file('./example.mp3')
if arguments.include? "youtu"
event.respond "Playing song! This may take some time."
tempFile = Dir::Tmpname.create(['youtubedlruby-', '.mp3']) {}
cmd = "yt-dlp --extract-audio --audio-format mp3 --output " + tempFile + " " + arguments
system(cmd)
event.voice.play_file(tempFile)
File.delete(tempFile) if File.exist?(tempFile)
bot.voice_destroy(server)
event.respond "Done playing!"
else
event.respond "Invalid youtube link!"
end
end
bot.message(with_text: "#{bang}Play") do |event|
event.respond "Please provide youtube link!"
end
end

@ -0,0 +1,5 @@
def pongcommand(bot, bang)
bot.message(with_text: "#{bang}Pong") do |event|
event.respond 'Ping!'
end
end

@ -0,0 +1,7 @@
def quit(bot, bang)
bot.message(with_text: "#{bang}Quit") do |event|
break unless event.user.id == 185533351866662913
bot.send_message(event.channel.id, 'Bot is shutting down')
bot.stop
end
end

@ -0,0 +1,3 @@
def testcommand(string)
puts string
end

@ -0,0 +1,26 @@
#!/usr/bin/env ruby
require 'discordrb'
require 'tmpdir'
#require 'toml'
#$config = TOML.load_file("./config.toml")
bot = Discordrb::Bot.new token: 'ODc0MDMzNjc4Mjc4MzQ0NzY0.YRBFSw.N_rTx8xQL7cn5E9tSj2IlieTNlk'
bang = '!'
def loadCommands(bot, bang)
File.foreach("modules/modules.txt", chop: true) { |line|
mod = "./modules/" + line + "/main.rb"
require mod.delete("\n")
send("#{line.delete("\n")}", bot, bang)
}
end
loadCommands(bot, bang)
#require './pingcommand.rb'
#main(bot)
#tomlTest()
bot.run

@ -0,0 +1,16 @@
#!/usr/bin/env ruby
def main(bot)
bot.message(with_text: "#{$bang}Pong") do |event|
event.respond 'Ping!'
end
bot.message(with_text: "#{$bang}Ping") do |event|
event.respond 'Pong!'
end
end
def tomlTest()
puts "#{$config}"
end
Loading…
Cancel
Save