vrobot4/source/modules/mod_fun.rb

96 lines
4.3 KiB
Ruby

require 'open-uri'
require 'json'
class Mod_Fun < Vrobot4::Module::Module
def self.type
"Fun"
end
Vrobot4::Module.add_module_type self
QDB = "http://greyserv.net/qdb"
def initialize info
super
register :c_carmack, "carmack", "mmmmmmmmmm"
register :c_revenant, "revenant", "AAAAAAAAA"
register :c_wan, "wan", "wan!"
register :c_nyan, "nyan", "nyan~"
register :c_box, "box", "S H I T P O S T I N G"
register :c_zdoom, "zdoom", "ZDoom™"
register :c_marble, "marble", "mararuaruaruaruarb"
register :c_quote, "quote", "Queries the Doominati Quote Database."
register :c_what, "what", "What the fuck did you just fucking say about"
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_wan (m, argv) m.reply "wan! " * (rand(10) + 1) end
def c_nyan (m, argv) m.reply "nyan " * (rand(10) + 1) + "~" end
def c_box m, argv
text = argv + "\n"
raise ArgumentError, "String too long" if argv.length > 30
if argv.length > 2 then for i in (1..argv.length - 2)
text << argv[i] + " " * (argv.length - 2) + argv.reverse[i] + "\n"
end end
text << argv.reverse
m.reply_b text
end
def c_zdoom m, argv
m.reply "ZDoom" + "" * (rand(15) + 1)
end
def c_marble m, argv
check_args argv, "", "N"
if argv.empty? then n = 20
else n = argv.to_i end
if m.serv.flags.include? "L" and n > 200 then n = 200
elsif n > 1000 then n = 1000 end
text = "m"
for i in (0..rand(n) + 1)
text << ["a", "r", "u"].sample
end
text << "b"
m.reply text
end
def c_quote m, argv
if argv.empty?
q, num = nil, nil
max = JSON.parse(open(QDB + "/interface.cgi").read)["numQuotes"]
loop do
num = rand(max) + 1
q = open(QDB + "/q/" + num.to_s).read
break unless m.serv.flags.include? "L" and
(q.lines.count > 4 or q.length > 1000)
end
m.reply_b "Quote %i:\n" % [num] + q
elsif Vrobot4.is_num? argv
m.reply_b open(QDB + "/q/" + argv.to_i.to_s).read
else
raise ArgumentError, "Invalid query" if argv.include? "&"
q = URI.escape argv
info = JSON.parse(open(QDB + "/interface.cgi?query=" + q).read)
raise ArgumentError, "No results" unless info["searchResults"].any?
res = info["searchResults"].sample
m.reply_b "Quote %i:\n" % [res] + open(QDB + "/q/" + res.to_s).read
end
end
def c_what m, argv
if m.serv.flags.include? "L"
m.reply "What the fuck did you just fucking say about me, you little bitch?"
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."
end
end
end
## EOF