forked from CotTyan/rubicyan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.rb
52 lines (44 loc) · 1.12 KB
/
main.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
require 'discordrb'
bot = Discordrb::Bot.new(
token: ENV["RUBITYAN_T"],
client_id: ENV["CLIENT_ID"],
prefix: ':rubi'
)
bot.message :help do |event|
event.respond 'LaminneがRubyで書いてるぼっとです。以上'
end
bot.command :connect do |event|
channel = event.user.voice_channel
next "Voice Channelに入ってからコマンドを打ってね" unless channel
bot.voice_connect(channel)
"{channel.name}に入りました。"
end
bot.command :hoge do |event|
event.voice.play_file("/home/yosotsu/work/hoge.mp3")
end
bot.command :stop do |event|
event.voice.stop_playing
end
bot.command :pause do |event|
event.voice.pause
end
bot.command :continue do |event|
event.voice.continue
end
bot.command :playlist do |event|
musicList = []
Dir.chdir("music/") do
Dir.glob("*") do |m|
musicList.push(m)
end
end
musicList.join("/n")
end
bot.command :play do |event,m|
if File.exist?("music/#{m}.mp3")
event.voice.play_file("music/#{m}.mp3")
else
"ファイルがありません"
end
end
bot.run