-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.rb
More file actions
77 lines (64 loc) · 1.75 KB
/
bot.rb
File metadata and controls
77 lines (64 loc) · 1.75 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/ruby
require 'discordrb'
require 'newrelic_rpm'
# Avoid having the token in plaintext
if (File.file?("token"))
t = File.open("token", "rb")
token = t.read.gsub("\n","")
t.close
i = File.open("client_id", "rb")
id = i.read.gsub("\n","")
i.close
$bot = Discordrb::Commands::CommandBot.new token: token, client_id: id
else
$bot = Discordrb::Commands::CommandBot.new token: ENV['TOKEN'], client_id: ENV['ID']
end
$bot.ready() do |event|
$bot.game = "!k2help"
end
def playAudioInChannel(channel, filename)
$bot.voice_connect(channel)
sleep(1) # Wait for the join channel sound
voice_bot = $bot.voice(channel)
voice_bot.volume = 0.25
voice_bot.play_file("audio/#{filename}")
voice_bot.destroy
end
$bot.message(with_text: "!k2help") do |event|
event.respond "I'm not helping you."
end
$bot.message(with_text: "who is champ?") do |event|
channel = event.user.voice_channel
if channel
playAudioInChannel(channel, "whoischamp.mp3")
else
event.respond "That question will be answered this Sunday night!"
end
end
$bot.message(with_text: "yeah boy") do |event|
channel = event.user.voice_channel
if channel
playAudioInChannel(channel, "yeahboy.mp3")
end
end
$bot.message(with_text: "peacock") do |event|
channel = event.user.voice_channel
if channel
playAudioInChannel(channel, "peacock.mp3")
else
event.respond("Nickhil never gets to win anything ever again.")
end
end
$bot.message(with_text: "why don't we just relax?") do |event|
channel = event.user.voice_channel
if channel
playAudioInChannel(channel, "why-dont-we-just-relax.mp3")
end
end
$bot.message(with_text: "why do you have to be mad?") do |event|
channel = event.user.voice_channel
if channel
playAudioInChannel(channel, "why-you-heff-to-be-mehd.mp3")
end
end
$bot.run