From c6cdbe1c6416f0a7696449996ecf3751dd3d1d36 Mon Sep 17 00:00:00 2001 From: Marrub Date: Tue, 8 Aug 2017 07:33:30 -0400 Subject: [PATCH] Add .quote to Mod_Fun --- source/mod_base.rb | 4 +++- source/mod_fun.rb | 19 ++++++++++++++++++- source/server.rb | 8 ++++---- source/sv_discord.rb | 4 ++-- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/source/mod_base.rb b/source/mod_base.rb index 31548ce..826cc66 100644 --- a/source/mod_base.rb +++ b/source/mod_base.rb @@ -34,7 +34,9 @@ module Vrobot4::Server "ded", "proceeding to die", "bye", - "dedededed"].sample + "dedededed", + "Thanks, bye!", + "GOTTAGOBYE"].sample exit end diff --git a/source/mod_fun.rb b/source/mod_fun.rb index ccf0d59..343473a 100644 --- a/source/mod_fun.rb +++ b/source/mod_fun.rb @@ -1,6 +1,11 @@ +require 'open-uri' +require 'json' + class Mod_Fun < Vrobot4::Module::Module Vrobot4::Module.add_module_type self, "Fun" + Qdb = "http://greyserv.net/qdb" + def initialize super register :c_carmack, "carmack", "mmmmmmmmmm" @@ -10,6 +15,7 @@ class Mod_Fun < Vrobot4::Module::Module 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 @@ -27,7 +33,7 @@ class Mod_Fun < Vrobot4::Module::Module end end text << str.reverse - m.reply_spaced text + m.reply_b text end def c_zdoom m, argv @@ -50,6 +56,17 @@ class Mod_Fun < Vrobot4::Module::Module m.reply text end + def c_quote m, argv + check_args argv, "", "N" + if argv.length == 0 + res = open(Qdb + "/interface.cgi").read + max = JSON.parse(res)["numQuotes"] - 1 + m.reply_b open(Qdb + "/q/" + (rand(max) + 1).to_s).read + else + m.reply_b open(Qdb + "/q/" + argv[0].to_i.to_s).read + end + end + def c_what m, argv 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 diff --git a/source/server.rb b/source/server.rb index 824ca29..52e5550 100644 --- a/source/server.rb +++ b/source/server.rb @@ -18,21 +18,21 @@ module Vrobot4::Server chan: nil, serv: nil, reply: nil, - reply_spaced: nil) + reply_b: nil) @msg = msg @user = user @chan = chan @serv = serv @reply = reply - @reply_spaced = reply_spaced + @reply_b = reply_b end def reply *args @reply.call args.join(" ") end - def reply_spaced *args - @reply_spaced.call args.join(" ") + def reply_b *args + @reply_b.call args.join(" ") end end diff --git a/source/sv_discord.rb b/source/sv_discord.rb index d7fa00c..8d0b531 100644 --- a/source/sv_discord.rb +++ b/source/sv_discord.rb @@ -44,8 +44,8 @@ class Sv_Discord < Vrobot4::Server::Server user: User.new(evt.user, @admins), chan: Channel.new(evt.channel), serv: self, - reply: -> (text) {evt.respond text}, - reply_spaced: -> (text) {evt.respond "```\n" + text + "```"} + reply: -> (text) {evt.respond text}, + reply_b: -> (text) {evt.respond "```\n" + text + "```"} if m.msg.start_with? '.' argv = m.msg.split