Account for server types with stricter text limits
parent
0de5a39c5a
commit
2cf1c9316e
|
@ -1 +1 @@
|
||||||
--protected source/*.rb - README
|
--protected source/*.rb servers/*.rb - README
|
||||||
|
|
|
@ -31,6 +31,7 @@ class Mod_Fun < Vrobot4::Module::Module
|
||||||
def c_box m, argv
|
def c_box m, argv
|
||||||
str = argv.join(" ")
|
str = argv.join(" ")
|
||||||
text = str + "\n"
|
text = str + "\n"
|
||||||
|
raise ArgumentError, "String too long" if str.length > 30
|
||||||
if str.length > 2
|
if str.length > 2
|
||||||
for i in (1..str.length - 2)
|
for i in (1..str.length - 2)
|
||||||
text << str[i] + " " * (str.length - 2) + str.reverse[i] + "\n"
|
text << str[i] + " " * (str.length - 2) + str.reverse[i] + "\n"
|
||||||
|
@ -47,9 +48,11 @@ class Mod_Fun < Vrobot4::Module::Module
|
||||||
def c_marble m, argv
|
def c_marble m, argv
|
||||||
check_args argv, "", "N"
|
check_args argv, "", "N"
|
||||||
|
|
||||||
if argv.length == 0; n = 20
|
if argv.length == 0 then n = 20
|
||||||
else; n = argv[0].to_i; end
|
else n = argv[0].to_i end
|
||||||
n = 1000 if n > 1000
|
|
||||||
|
if m.serv.flags.include? "L" and n > 200 then n = 200
|
||||||
|
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)
|
||||||
|
@ -63,24 +66,34 @@ class Mod_Fun < Vrobot4::Module::Module
|
||||||
def c_quote m, argv
|
def c_quote m, argv
|
||||||
argv = argv.join(" ")
|
argv = argv.join(" ")
|
||||||
if argv.length == 0
|
if argv.length == 0
|
||||||
|
q, num = nil, nil
|
||||||
max = JSON.parse(open(QDB + "/interface.cgi").read)["numQuotes"]
|
max = JSON.parse(open(QDB + "/interface.cgi").read)["numQuotes"]
|
||||||
|
loop do
|
||||||
num = rand(max) + 1
|
num = rand(max) + 1
|
||||||
m.reply_b "Quote %i:\n" % [num] + open(QDB + "/q/" + num.to_s).read
|
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
|
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?
|
||||||
res = info["searchResults"].sample
|
res = info["searchResults"].sample
|
||||||
raise ArgumentError, "no results found" unless res
|
|
||||||
m.reply_b "Quote %i:\n" % [res] + open(QDB + "/q/" + res.to_s).read
|
m.reply_b "Quote %i:\n" % [res] + open(QDB + "/q/" + res.to_s).read
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def c_what m, argv
|
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."
|
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
|
end
|
||||||
|
end
|
||||||
|
|
||||||
## EOF
|
## EOF
|
||||||
|
|
|
@ -159,13 +159,13 @@ module Vrobot4::Server
|
||||||
end
|
end
|
||||||
|
|
||||||
# (see Vrobot4::Module::Module#on_message)
|
# (see Vrobot4::Module::Module#on_message)
|
||||||
# @note Passes information to all modules.
|
# Passes information to all modules.
|
||||||
def on_message m
|
def on_message m
|
||||||
@modules.each {|mod| break if mod.on_message m}
|
@modules.each {|mod| break if mod.on_message m}
|
||||||
end
|
end
|
||||||
|
|
||||||
# (see Vrobot4::Module::Module#on_command)
|
# (see Vrobot4::Module::Module#on_command)
|
||||||
# @note Passes information to all modules.
|
# Passes information to all modules.
|
||||||
def on_command m, cnam, argv
|
def on_command m, cnam, argv
|
||||||
@modules.each {|mod| break if mod.on_command m, cnam, argv}
|
@modules.each {|mod| break if mod.on_command m, cnam, argv}
|
||||||
end
|
end
|
||||||
|
@ -176,6 +176,9 @@ module Vrobot4::Server
|
||||||
end
|
end
|
||||||
|
|
||||||
# Flags for this server.
|
# Flags for this server.
|
||||||
|
# [A] Server has audio capabilities and inherits from AudioServer.
|
||||||
|
# [L] Server cannot support large text dumps
|
||||||
|
# (code should assume <=4 lines, 240 characters per as maximum)
|
||||||
# @return [String]
|
# @return [String]
|
||||||
def flags
|
def flags
|
||||||
""
|
""
|
||||||
|
|
|
@ -77,7 +77,7 @@ class Sv_Discord < Vrobot4::Server::AudioServer
|
||||||
|
|
||||||
# (see Vrobot4::Server::Server#flags)
|
# (see Vrobot4::Server::Server#flags)
|
||||||
def flags
|
def flags
|
||||||
"AD"
|
"A"
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
Loading…
Reference in New Issue