crap
parent
53bab8bfd5
commit
dcb826dd7f
|
@ -17,7 +17,7 @@ module Vrobot4
|
||||||
def self.log lv, *text
|
def self.log lv, *text
|
||||||
if (lv != :DEBUG || @@debug >= 1) &&
|
if (lv != :DEBUG || @@debug >= 1) &&
|
||||||
(lv != :DEBUGV || @@debug >= 2)
|
(lv != :DEBUGV || @@debug >= 2)
|
||||||
puts "[" + lv.to_s.ljust(6) + "] " + text.join(" ")
|
puts "[" + lv.to_s.ljust(6) + "] " + text.join(?\s)
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
false
|
false
|
||||||
|
|
|
@ -45,7 +45,7 @@ module Vrobot4
|
||||||
log :DEBUGV, "bots:", bots.to_s
|
log :DEBUGV, "bots:", bots.to_s
|
||||||
rescue
|
rescue
|
||||||
log :ERROR, "error loading bot config:",
|
log :ERROR, "error loading bot config:",
|
||||||
$!.to_s + "\n" + $!.backtrace.first(3).join("\n")
|
$!.to_s + ?\n + $!.backtrace.first(3).join(?\n)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ module Vrobot4::Module
|
||||||
# @param help [String] help string to use for this command
|
# @param help [String] help string to use for this command
|
||||||
# @param roles [String] roles to allow this command to use
|
# @param roles [String] roles to allow this command to use
|
||||||
# @return [Vrobot4::Module::Command] command added
|
# @return [Vrobot4::Module::Command] command added
|
||||||
def register fn, names, help = nil, roles: "v"
|
def register fn, names, help = nil, roles: ?v
|
||||||
help = "No help available for this command." if help == nil
|
help = "No help available for this command." if help == nil
|
||||||
cmd = Command.new(self.method(fn), help, roles).freeze
|
cmd = Command.new(self.method(fn), help, roles).freeze
|
||||||
if names.is_a? String
|
if names.is_a? String
|
||||||
|
@ -139,11 +139,11 @@ module Vrobot4::Module
|
||||||
private
|
private
|
||||||
def check_arg arg, i, req
|
def check_arg arg, i, req
|
||||||
case req
|
case req
|
||||||
when 'N'
|
when ?N
|
||||||
unless Vrobot4.is_num? arg.strip
|
unless Vrobot4.is_num? arg.strip
|
||||||
raise ArgumentError, "Expected a number for arg " + i.to_s
|
raise ArgumentError, "Expected a number for arg " + i.to_s
|
||||||
end
|
end
|
||||||
when 'S' # Don't need to check anything here.
|
when ?S # Don't need to check anything here.
|
||||||
else
|
else
|
||||||
raise ArgumentError, "Invalid argument specifier " + req.to_s
|
raise ArgumentError, "Invalid argument specifier " + req.to_s
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,8 +10,8 @@ class Mod_Discord < Vrobot4::Module::Module
|
||||||
|
|
||||||
def c_roles m, argv
|
def c_roles m, argv
|
||||||
roles = []
|
roles = []
|
||||||
m.user.real.roles.each {|role| roles << role.name + ":" + role.id.to_s}
|
m.user.real.roles.each do |role| roles << role.name + ?: + role.id.to_s end
|
||||||
m.reply roles.join("\n")
|
m.reply roles.join(?\n)
|
||||||
end
|
end
|
||||||
|
|
||||||
def c_purge m, argv
|
def c_purge m, argv
|
|
@ -0,0 +1,81 @@
|
||||||
|
class Mod_DTL < Vrobot4::Module::Module
|
||||||
|
def self.type() "DTL" end
|
||||||
|
Vrobot4::Module.add_module_type self, server: "Discord"
|
||||||
|
|
||||||
|
def initialize info
|
||||||
|
super
|
||||||
|
|
||||||
|
register :c_setnotify, "setnotify", "Adds you to a notification group."
|
||||||
|
register :c_unsetnotify, "unsetnotify", "Removes you from a notification group."
|
||||||
|
register :c_listnotify, "listnotify", "Lists available notification groups."
|
||||||
|
register :c_notify, "notify", "Notifies a notification group."
|
||||||
|
|
||||||
|
@info.map! do |id| id.resolve_id end
|
||||||
|
|
||||||
|
@notify_id = 462143279618850826.resolve_id
|
||||||
|
@member_id = 388350737308188684.resolve_id
|
||||||
|
@server_id = 273581213510402058.resolve_id
|
||||||
|
end
|
||||||
|
|
||||||
|
def ensure_role m
|
||||||
|
if m.chan.real.server && m.chan.real.server.id == @server_id
|
||||||
|
m.user.real.add_role @member_id unless m.user.real.role? @member_id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_role m, argv
|
||||||
|
roles = m.chan.real.server.roles
|
||||||
|
role = roles.find do |r| r.name.casecmp(argv) == 0 end
|
||||||
|
unless role and @info.any? do |id| role.id == id end
|
||||||
|
raise ArgumentError, "Invalid notification group, use `.listnotify` for a list of available groups."
|
||||||
|
end
|
||||||
|
role
|
||||||
|
end
|
||||||
|
|
||||||
|
def on_message m
|
||||||
|
ensure_role m
|
||||||
|
super m
|
||||||
|
end
|
||||||
|
|
||||||
|
def on_command m, cnam, argv
|
||||||
|
ensure_role m
|
||||||
|
super m, cnam, argv
|
||||||
|
end
|
||||||
|
|
||||||
|
def c_setnotify m, argv
|
||||||
|
ensure_role m
|
||||||
|
m.user.real.add_role get_role(m, argv)
|
||||||
|
m.reply "Successfully added you to the notification group."
|
||||||
|
end
|
||||||
|
|
||||||
|
def c_unsetnotify m, argv
|
||||||
|
m.user.real.remove_role get_role(m, argv)
|
||||||
|
m.reply "Successfully removed you from the notification group."
|
||||||
|
end
|
||||||
|
|
||||||
|
def c_listnotify m, argv
|
||||||
|
text = ""
|
||||||
|
for role in @info do
|
||||||
|
text << m.chan.real.server.role(role).name + ?\n
|
||||||
|
end
|
||||||
|
m.reply text
|
||||||
|
end
|
||||||
|
|
||||||
|
def c_notify m, argv
|
||||||
|
if m.user.real.role? @notify_id
|
||||||
|
argv = argv.split ?,, 2
|
||||||
|
role = get_role m, argv[0]
|
||||||
|
role.mentionable = true
|
||||||
|
if argv[1]
|
||||||
|
m.reply "#{role.mention} - #{argv[1].strip}"
|
||||||
|
else
|
||||||
|
m.reply role.mention
|
||||||
|
end
|
||||||
|
role.mentionable = false
|
||||||
|
else
|
||||||
|
m.reply "You don't have permission for that."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
## EOF
|
|
@ -20,23 +20,23 @@ class Mod_Fun < Vrobot4::Module::Module
|
||||||
register :c_what, "what", "What the fuck did you just fucking say about"
|
register :c_what, "what", "What the fuck did you just fucking say about"
|
||||||
end
|
end
|
||||||
|
|
||||||
def c_carmack (m, argv) m.reply "m" * (rand(24) + 5) end
|
def c_carmack (m, argv) m.reply ?m * (rand(24) + 5) end
|
||||||
def c_revenant(m, argv) m.reply "A" * (rand(24) + 3) end
|
def c_revenant(m, argv) m.reply ?A * (rand(24) + 3) end
|
||||||
def c_wan (m, argv) m.reply "wan! " * (rand(10) + 1) end
|
def c_wan (m, argv) m.reply "wan! " * (rand(10) + 1) end
|
||||||
def c_nyan (m, argv) m.reply "nyan " * (rand(10) + 1) + "~" end
|
def c_nyan (m, argv) m.reply "nyan " * (rand(10) + 1) + ?~ end
|
||||||
|
|
||||||
def c_box m, argv
|
def c_box m, argv
|
||||||
text = argv + "\n"
|
text = argv + ?\n
|
||||||
raise ArgumentError, "String too long" if argv.length > 30
|
raise ArgumentError, "String too long" if argv.length > 30
|
||||||
if argv.length > 2 then for i in (1..argv.length - 2)
|
if argv.length > 2 then for i in (1..argv.length - 2)
|
||||||
text << argv[i] + " " * (argv.length - 2) + argv.reverse[i] + "\n"
|
text << argv[i] + ?\s * (argv.length - 2) + argv.reverse[i] + ?\n
|
||||||
end end
|
end end
|
||||||
text << argv.reverse
|
text << argv.reverse
|
||||||
m.reply_b text
|
m.reply_b text
|
||||||
end
|
end
|
||||||
|
|
||||||
def c_zdoom m, argv
|
def c_zdoom m, argv
|
||||||
m.reply "ZDoom" + "™" * (rand(15) + 1)
|
m.reply "ZDoom" + ?™ * (rand(15) + 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def c_marble m, argv
|
def c_marble m, argv
|
||||||
|
@ -45,14 +45,14 @@ class Mod_Fun < Vrobot4::Module::Module
|
||||||
if argv.empty? then n = 20
|
if argv.empty? then n = 20
|
||||||
else n = argv.to_i end
|
else n = argv.to_i end
|
||||||
|
|
||||||
if m.serv.flags.include? "L" and n > 200 then n = 200
|
if m.serv.flags.include? ?L and n > 200 then n = 200
|
||||||
elsif n > 1000 then n = 1000 end
|
elsif n > 1000 then n = 1000 end
|
||||||
|
|
||||||
text = "m"
|
text = ?m
|
||||||
for i in (0..rand(n) + 1)
|
for i in (0..rand(n) + 1)
|
||||||
text << ["a", "r", "u"].sample
|
text << [?a, ?r, ?u].sample
|
||||||
end
|
end
|
||||||
text << "b"
|
text << ?b
|
||||||
|
|
||||||
m.reply text
|
m.reply text
|
||||||
end
|
end
|
||||||
|
@ -71,7 +71,7 @@ class Mod_Fun < Vrobot4::Module::Module
|
||||||
elsif Vrobot4.is_num? argv
|
elsif Vrobot4.is_num? argv
|
||||||
m.reply_b open(QDB + "/q/" + argv.to_i.to_s).read
|
m.reply_b open(QDB + "/q/" + argv.to_i.to_s).read
|
||||||
else
|
else
|
||||||
raise ArgumentError, "Invalid query" if argv.include? "&"
|
raise ArgumentError, "Invalid query" if argv.include? ?&
|
||||||
q = URI.escape argv
|
q = URI.escape argv
|
||||||
info = JSON.parse(open(QDB + "/interface.cgi?query=" + q).read)
|
info = JSON.parse(open(QDB + "/interface.cgi?query=" + q).read)
|
||||||
raise ArgumentError, "No results" unless info["searchResults"].any?
|
raise ArgumentError, "No results" unless info["searchResults"].any?
|
||||||
|
@ -81,7 +81,7 @@ class Mod_Fun < Vrobot4::Module::Module
|
||||||
end
|
end
|
||||||
|
|
||||||
def c_what m, argv
|
def c_what m, argv
|
||||||
if m.serv.flags.include? "L"
|
if m.serv.flags.include? ?L
|
||||||
m.reply "What the fuck did you just fucking say about me, you little bitch?"
|
m.reply "What the fuck did you just fucking say about me, you little bitch?"
|
||||||
else
|
else
|
||||||
m.reply "What the fuck did you just fucking say about me, you little bitch? I'll have you know I graduated top of my class in the Navy Seals, and I've been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and I'm the top sniper in the entire US armed forces. You are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. You think you can get away with saying that shit to me over the Internet? Think again, fucker. As we speak I am contacting my secret network of spies across the USA and your IP is being traced right now so you better prepare for the storm, maggot. The storm that wipes out the pathetic little thing you call your life. You're fucking dead, kid. I can be anywhere, anytime, and I can kill you in over seven hundred ways, and that's just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the United States Marine Corps and I will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit. If only you could have known what unholy retribution your little \"clever\" comment was about to bring down upon you, maybe you would have held your fucking tongue. But you couldn't, you didn't, and now you're paying the price, you goddamn idiot. I will shit fury all over you and you will drown in it. You're fucking dead, kiddo."
|
m.reply "What the fuck did you just fucking say about me, you little bitch? I'll have you know I graduated top of my class in the Navy Seals, and I've been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and I'm the top sniper in the entire US armed forces. You are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. You think you can get away with saying that shit to me over the Internet? Think again, fucker. As we speak I am contacting my secret network of spies across the USA and your IP is being traced right now so you better prepare for the storm, maggot. The storm that wipes out the pathetic little thing you call your life. You're fucking dead, kid. I can be anywhere, anytime, and I can kill you in over seven hundred ways, and that's just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the United States Marine Corps and I will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit. If only you could have known what unholy retribution your little \"clever\" comment was about to bring down upon you, maybe you would have held your fucking tongue. But you couldn't, you didn't, and now you're paying the price, you goddamn idiot. I will shit fury all over you and you will drown in it. You're fucking dead, kiddo."
|
|
@ -1,70 +0,0 @@
|
||||||
class Mod_DecatessaradimensionalLoungeAlertationAndRolinationManagerator < Vrobot4::Module::Module
|
|
||||||
def self.type() "DTL" end
|
|
||||||
Vrobot4::Module.add_module_type self, server: "Discord"
|
|
||||||
|
|
||||||
def initialize info
|
|
||||||
super
|
|
||||||
register :c_setnotify, "setnotify", "Adds you to a notification group."
|
|
||||||
register :c_unsetnotify, "unsetnotify", "Removes you from a notification group."
|
|
||||||
register :c_listnotify, "listnotify", "Lists available notification groups."
|
|
||||||
register :c_notify, "notify", "Notifies a notification group."
|
|
||||||
@info.map! {|id| id.resolve_id}
|
|
||||||
end
|
|
||||||
|
|
||||||
def ensure_role m
|
|
||||||
if m.user.real.roles.empty?
|
|
||||||
m.user.real.add_role 388350737308188684.resolve_id
|
|
||||||
true
|
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_role m, argv
|
|
||||||
roles = m.chan.real.server.roles
|
|
||||||
role = roles.find {|r| r.name.casecmp(argv) == 0}
|
|
||||||
unless role and @info.any? {|id| role.id == id}
|
|
||||||
raise ArgumentError, "Invalid notification group, use `.listnotify` for a list of available groups."
|
|
||||||
end
|
|
||||||
role
|
|
||||||
end
|
|
||||||
|
|
||||||
def on_message m
|
|
||||||
ensure_role m
|
|
||||||
false
|
|
||||||
end
|
|
||||||
|
|
||||||
def c_setnotify m, argv
|
|
||||||
ensure_role m
|
|
||||||
m.user.real.add_role get_role(m, argv)
|
|
||||||
m.reply "Successfully added you to the notification group."
|
|
||||||
end
|
|
||||||
|
|
||||||
def c_unsetnotify m, argv
|
|
||||||
m.user.real.remove_role get_role(m, argv)
|
|
||||||
m.reply "Successfully removed you from the notification group."
|
|
||||||
end
|
|
||||||
|
|
||||||
def c_notify m, arg
|
|
||||||
return unless m.user.real.role? 388350774788358147.resolve_id
|
|
||||||
argv = arg.split(',', 2)
|
|
||||||
role = get_role(m, argv[0])
|
|
||||||
role.mentionable = true
|
|
||||||
if argv[1]
|
|
||||||
m.reply role.mention + " - " + argv[1].strip
|
|
||||||
else
|
|
||||||
m.reply role.mention
|
|
||||||
end
|
|
||||||
role.mentionable = false
|
|
||||||
end
|
|
||||||
|
|
||||||
def c_listnotify m, argv
|
|
||||||
text = ""
|
|
||||||
for role in @info do
|
|
||||||
text << m.chan.real.server.role(role).name + "\n"
|
|
||||||
end
|
|
||||||
m.reply text
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
## EOF
|
|
|
@ -1,96 +0,0 @@
|
||||||
class Mod_Util < Vrobot4::Module::Module
|
|
||||||
def self.type() "Utilities" end
|
|
||||||
Vrobot4::Module.add_module_type self
|
|
||||||
|
|
||||||
def initialize info
|
|
||||||
super
|
|
||||||
register :c_rand, "rand", "Returns a random number. Example: .rand 500"
|
|
||||||
register :c_decide, "decide", "Decides between one or more choices."
|
|
||||||
register :c_eightball, "eightball", "Peer into the magic 8-ball."
|
|
||||||
register :c_mystery, "mystery", "it is a mystery"
|
|
||||||
end
|
|
||||||
|
|
||||||
def c_rand m, argv
|
|
||||||
argv = check_args argv.split, "N", "N"
|
|
||||||
min, max = 0, argv[0].to_f
|
|
||||||
min, max = max, argv[1].to_f if argv.length >= 2
|
|
||||||
max, min = min, max if max < min
|
|
||||||
n = rand(max - min) + min
|
|
||||||
m.reply n.round
|
|
||||||
end
|
|
||||||
|
|
||||||
def c_decide m, argv
|
|
||||||
argv = check_args argv.split(/\s*,\s*/), "S", "*"
|
|
||||||
m.reply argv.sample
|
|
||||||
end
|
|
||||||
|
|
||||||
def c_eightball m, argv
|
|
||||||
m.reply \
|
|
||||||
["Yes.",
|
|
||||||
"No.",
|
|
||||||
"Try again later.",
|
|
||||||
"Reply hazy.",
|
|
||||||
"Perhaps...",
|
|
||||||
"Maybe not...",
|
|
||||||
"Definitely.",
|
|
||||||
"Never.",
|
|
||||||
"system error [0xfded] try again later",
|
|
||||||
"Can you repeat the question?",
|
|
||||||
"Most certainly.",
|
|
||||||
"Nope.",
|
|
||||||
"Without a doubt.",
|
|
||||||
"Not at all.",
|
|
||||||
"Better not tell you now.",
|
|
||||||
"Concentrate and ask again.",
|
|
||||||
"It is decidedly so.",
|
|
||||||
"My reply is \"no\".",
|
|
||||||
"You may rely on it.",
|
|
||||||
"Don't count on it.",
|
|
||||||
"The answer is uncertain.",
|
|
||||||
"Sorry, I wasn't paying attention. What'd you say?",
|
|
||||||
"As I see it, yes.",
|
|
||||||
"My sources say \"no\".",
|
|
||||||
"Most likely.",
|
|
||||||
"Very doubtful.",
|
|
||||||
"I don't know. Ask your mom.",
|
|
||||||
"The demon runes are quaking again. One moment.",
|
|
||||||
"Outlook good.",
|
|
||||||
"Outlook is not so good.",
|
|
||||||
"Indeed.",
|
|
||||||
"Absolutely not.",
|
|
||||||
"Yeah, we'll go with that.",
|
|
||||||
"That works.",
|
|
||||||
"Of course. What are you, stupid?",
|
|
||||||
"No. Hell no.",
|
|
||||||
"Signs say yes.",
|
|
||||||
"Aren't you a little too old to be believing that?",
|
|
||||||
"Looks good to me.",
|
|
||||||
"Sure, why not?",
|
|
||||||
"It is certain.",
|
|
||||||
"Please no. Please no. Please no.",
|
|
||||||
"Yes, please.",
|
|
||||||
"Nah.",
|
|
||||||
"Go for it!",
|
|
||||||
"Negative.",
|
|
||||||
"Obviously, dumbass.",
|
|
||||||
"I doubt it.",
|
|
||||||
"Eeeh...it's likely?",
|
|
||||||
"Forget about it.",
|
|
||||||
"Chances aren't good.",
|
|
||||||
"Ahahahahahahaha no.",
|
|
||||||
"Maybe? I think.",
|
|
||||||
"No. Die.",
|
|
||||||
"Huh? Oh, sure.",
|
|
||||||
"Yeah, right...",
|
|
||||||
"How about no.",
|
|
||||||
"Doesn't look good to me.",
|
|
||||||
"Probably.",
|
|
||||||
"Obviously not, dumbass.",
|
|
||||||
"#<Enumerator:0x000000028a49c0>"].sample
|
|
||||||
end
|
|
||||||
|
|
||||||
def c_mystery m, argv
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
## EOF
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
class Mod_Relay < Vrobot4::Module::Module
|
||||||
|
def self.type() "Relay" end
|
||||||
|
Vrobot4::Module.add_module_type self, server: "Discord"
|
||||||
|
|
||||||
|
def initialize info
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def send_relay m
|
||||||
|
if @info.include? m.chan.id
|
||||||
|
@info.each do |ch|
|
||||||
|
if ch != m.chan.id
|
||||||
|
m.serv.bot.send_message ch, "<#{m.user.name}/#{m.chan.name}> #{m.msg}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def on_message m
|
||||||
|
send_relay m if not super m
|
||||||
|
end
|
||||||
|
|
||||||
|
def on_command m, cnam, argv
|
||||||
|
send_relay m if not super m, cnam, argv
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,98 @@
|
||||||
|
class Mod_Util < Vrobot4::Module::Module
|
||||||
|
def self.type() "Utilities" end
|
||||||
|
Vrobot4::Module.add_module_type self
|
||||||
|
|
||||||
|
EIGHTBALL = \
|
||||||
|
["Yes.",
|
||||||
|
"No.",
|
||||||
|
"Try again later.",
|
||||||
|
"Reply hazy.",
|
||||||
|
"Perhaps...",
|
||||||
|
"Maybe not...",
|
||||||
|
"Definitely.",
|
||||||
|
"Never.",
|
||||||
|
"system error [0xfded] try again later",
|
||||||
|
"Can you repeat the question?",
|
||||||
|
"Most certainly.",
|
||||||
|
"Nope.",
|
||||||
|
"Without a doubt.",
|
||||||
|
"Not at all.",
|
||||||
|
"Better not tell you now.",
|
||||||
|
"Concentrate and ask again.",
|
||||||
|
"It is decidedly so.",
|
||||||
|
"My reply is \"no\".",
|
||||||
|
"You may rely on it.",
|
||||||
|
"Don't count on it.",
|
||||||
|
"The answer is uncertain.",
|
||||||
|
"Sorry, I wasn't paying attention. What'd you say?",
|
||||||
|
"As I see it, yes.",
|
||||||
|
"My sources say \"no\".",
|
||||||
|
"Most likely.",
|
||||||
|
"Very doubtful.",
|
||||||
|
"I don't know. Ask your mom.",
|
||||||
|
"The demon runes are quaking again. One moment.",
|
||||||
|
"Outlook good.",
|
||||||
|
"Outlook is not so good.",
|
||||||
|
"Indeed.",
|
||||||
|
"Absolutely not.",
|
||||||
|
"Yeah, we'll go with that.",
|
||||||
|
"That works.",
|
||||||
|
"Of course. What are you, stupid?",
|
||||||
|
"No. Hell no.",
|
||||||
|
"Signs say yes.",
|
||||||
|
"Aren't you a little too old to be believing that?",
|
||||||
|
"Looks good to me.",
|
||||||
|
"Sure, why not?",
|
||||||
|
"It is certain.",
|
||||||
|
"Please no. Please no. Please no.",
|
||||||
|
"Yes, please.",
|
||||||
|
"Nah.",
|
||||||
|
"Go for it!",
|
||||||
|
"Negative.",
|
||||||
|
"Obviously, dumbass.",
|
||||||
|
"I doubt it.",
|
||||||
|
"Eeeh...it's likely?",
|
||||||
|
"Forget about it.",
|
||||||
|
"Chances aren't good.",
|
||||||
|
"Ahahahahahahaha no.",
|
||||||
|
"Maybe? I think.",
|
||||||
|
"No. Die.",
|
||||||
|
"Huh? Oh, sure.",
|
||||||
|
"Yeah, right...",
|
||||||
|
"How about no.",
|
||||||
|
"Doesn't look good to me.",
|
||||||
|
"Probably.",
|
||||||
|
"Obviously not, dumbass.",
|
||||||
|
"#<Enumerator:0x000000028a49c0>"]
|
||||||
|
|
||||||
|
def initialize info
|
||||||
|
super
|
||||||
|
register :c_rand, "rand", "Returns a random number. Example: .rand 500"
|
||||||
|
register :c_decide, "decide", "Decides between one or more choices."
|
||||||
|
register :c_eightball, "eightball", "Peer into the magic 8-ball."
|
||||||
|
register :c_mystery, "mystery", "it is a mystery"
|
||||||
|
end
|
||||||
|
|
||||||
|
def c_rand m, argv
|
||||||
|
argv = check_args argv.split, "N", "N"
|
||||||
|
min, max = 0, argv[0].to_f
|
||||||
|
min, max = max, argv[1].to_f if argv.length >= 2
|
||||||
|
max, min = min, max if max < min
|
||||||
|
n = rand(max - min) + min
|
||||||
|
m.reply n.round
|
||||||
|
end
|
||||||
|
|
||||||
|
def c_decide m, argv
|
||||||
|
argv = check_args argv.split(/\s*,\s*/), "S", "*"
|
||||||
|
m.reply argv.sample
|
||||||
|
end
|
||||||
|
|
||||||
|
def c_eightball m, argv
|
||||||
|
m.reply EIGHTBALL.sample
|
||||||
|
end
|
||||||
|
|
||||||
|
def c_mystery m, argv
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
## EOF
|
|
@ -38,18 +38,19 @@ module Vrobot4::Server
|
||||||
|
|
||||||
# Sends a message to the originating channel.
|
# Sends a message to the originating channel.
|
||||||
def reply *args
|
def reply *args
|
||||||
@reply.call args.join(" ")
|
@reply.call args.join(?\s)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Sends a large message to the originating channel.
|
# Sends a large message to the originating channel.
|
||||||
def reply_b *args
|
def reply_b *args
|
||||||
@reply_b.call args.join(" ")
|
@reply_b.call args.join(?\s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Generic server interface.
|
# Generic server interface.
|
||||||
class Server
|
class Server
|
||||||
attr_reader :mprm # @return [Hash] module permissions for this server
|
attr_reader :mprm # @return [Hash] module permissions for this server
|
||||||
|
attr_reader :id # @return [Integer] unique identifier for the server
|
||||||
|
|
||||||
# @param info [Hash] arbitrary extra information for this server
|
# @param info [Hash] arbitrary extra information for this server
|
||||||
def initialize info
|
def initialize info
|
||||||
|
@ -122,8 +123,8 @@ module Vrobot4::Server
|
||||||
#
|
#
|
||||||
# @param m [Vrobot4::Server::Message] the message to parse and emit
|
# @param m [Vrobot4::Server::Message] the message to parse and emit
|
||||||
def handle_text_cmd m
|
def handle_text_cmd m
|
||||||
if m.msg.start_with? '.'
|
if m.msg.start_with? ?.
|
||||||
arg = m.msg.split(' ', 2)
|
arg = m.msg.split(?\s, 2)
|
||||||
on_command m, arg[0][1 .. -1], arg[1] || ""
|
on_command m, arg[0][1 .. -1], arg[1] || ""
|
||||||
else
|
else
|
||||||
on_message m
|
on_message m
|
||||||
|
@ -144,7 +145,7 @@ module Vrobot4::Server
|
||||||
|
|
||||||
# (see Vrobot4::Server::Server#flags)
|
# (see Vrobot4::Server::Server#flags)
|
||||||
def flags
|
def flags
|
||||||
"A"
|
?A
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -152,11 +153,11 @@ module Vrobot4::Server
|
||||||
def initialize info
|
def initialize info
|
||||||
super
|
super
|
||||||
register :c_help, "help", "Prints documentation for commands."
|
register :c_help, "help", "Prints documentation for commands."
|
||||||
register :c_die, "die", "Kills all bot instances.", roles: "o"
|
register :c_die, "die", "Kills all bot instances.", roles: ?o
|
||||||
register :c_modr, "modr", "Reloads a module.", roles: "o"
|
register :c_modr, "modr", "Reloads a module.", roles: ?o
|
||||||
register :c_modl, "modl", "Loads a module.", roles: "o"
|
register :c_modl, "modl", "Loads a module.", roles: ?o
|
||||||
register :c_modu, "modu", "Unloads a module.", roles: "o"
|
register :c_modu, "modu", "Unloads a module.", roles: ?o
|
||||||
register :c_dbg, "dbg", "Sets the debug level.", roles: "o"
|
register :c_dbg, "dbg", "Sets the debug level.", roles: ?o
|
||||||
end
|
end
|
||||||
|
|
||||||
# @!visibility private
|
# @!visibility private
|
||||||
|
@ -178,7 +179,7 @@ module Vrobot4::Server
|
||||||
|
|
||||||
# @!visibility private
|
# @!visibility private
|
||||||
def c_die m, argv
|
def c_die m, argv
|
||||||
m.serv.voice_quit m if m.serv.flags.include? "A"
|
m.serv.voice_quit m if m.serv.flags.include? ?A
|
||||||
m.reply \
|
m.reply \
|
||||||
["STATUS: DYING",
|
["STATUS: DYING",
|
||||||
"ded",
|
"ded",
|
||||||
|
|
|
@ -12,6 +12,8 @@ class Sv_Discord < Vrobot4::Server::AudioServer
|
||||||
def initialize info
|
def initialize info
|
||||||
super
|
super
|
||||||
|
|
||||||
|
@id = info["client"]
|
||||||
|
|
||||||
@ops = info["admins"] || []
|
@ops = info["admins"] || []
|
||||||
@hop = info["halfop"] || []
|
@hop = info["halfop"] || []
|
||||||
|
|
||||||
|
@ -66,7 +68,7 @@ class Sv_Discord < Vrobot4::Server::AudioServer
|
||||||
|
|
||||||
# (see Vrobot4::Server::Server#flags)
|
# (see Vrobot4::Server::Server#flags)
|
||||||
def flags
|
def flags
|
||||||
"A"
|
?A
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
@ -128,7 +130,7 @@ class Sv_Discord < Vrobot4::Server::AudioServer
|
||||||
# @param chan [Discordrb::Channel] the discord channel
|
# @param chan [Discordrb::Channel] the discord channel
|
||||||
def initialize chan
|
def initialize chan
|
||||||
@real = chan
|
@real = chan
|
||||||
@name = "#" + chan.name
|
@name = ?# + chan.name
|
||||||
@id = chan.id
|
@id = chan.id
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -50,7 +50,7 @@ class Sv_IRC < Vrobot4::Server::Server
|
||||||
|
|
||||||
# (see Vrobot4::Server::Server#flags)
|
# (see Vrobot4::Server::Server#flags)
|
||||||
def flags
|
def flags
|
||||||
"L"
|
?L
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
Loading…
Reference in New Issue