vrobot4/source/modules/mod_util.rb

100 lines
2.8 KiB
Ruby

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