added autorejoin, updated socialeyes with timeouts, started work on dns client...
This commit is contained in:
parent
42415c43a8
commit
599a78ca93
|
@ -1 +1,2 @@
|
|||
config.json
|
||||
Gemfile.lock
|
||||
|
|
1
Gemfile
1
Gemfile
|
@ -19,3 +19,4 @@ gem 'mongo' #lol this one is actually really fucking important js
|
|||
gem 'extralite' #sqlitle never wants to instawall
|
||||
gem 'emoji' #emoji bro
|
||||
gem 'time_difference' #time deltas in human readable form
|
||||
gem 'chronic'
|
||||
|
|
|
@ -11,6 +11,7 @@ GEM
|
|||
rainbow (~> 3.0, >= 3.0.0)
|
||||
rmagick (~> 2.16, >= 2.16.0)
|
||||
bson (4.12.1)
|
||||
chronic (0.10.2)
|
||||
cinch (2.3.4)
|
||||
concurrent-ruby (1.1.9)
|
||||
emoji (1.0.7)
|
||||
|
@ -54,6 +55,7 @@ PLATFORMS
|
|||
DEPENDENCIES
|
||||
ansirc
|
||||
ascii-image
|
||||
chronic
|
||||
cinch
|
||||
emoji
|
||||
extralite
|
||||
|
|
|
@ -13,8 +13,9 @@ module Mooks
|
|||
# # # # # ~# # #
|
||||
class Opticon
|
||||
#include Cinch::Plugin
|
||||
attr_accessor :match, :callback
|
||||
attr_accessor :match, :callback, :offset, :mute
|
||||
def valid?
|
||||
self.offset ||= 10
|
||||
self.match.is_a? Regexp and self.callback.respond_to? :call
|
||||
end
|
||||
def callback!(&callback)
|
||||
|
@ -27,8 +28,19 @@ module Mooks
|
|||
puts "testing #{str} against #{self.match.inspect}"
|
||||
return str.match(self.match)
|
||||
end
|
||||
def stdout
|
||||
return self.callback.call
|
||||
def mute?
|
||||
return self.mute
|
||||
end
|
||||
def speak!(m)
|
||||
ret = false
|
||||
unless(self.mute?) #shhh be vewwy vewwy qwiet...
|
||||
res = self.callback.call
|
||||
puts res
|
||||
m.reply res
|
||||
self.hush!
|
||||
ret = true
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def match!(match)
|
||||
|
@ -45,8 +57,20 @@ module Mooks
|
|||
end
|
||||
self.match = match
|
||||
end
|
||||
def offset!(o)
|
||||
self.offset = o || 10
|
||||
end
|
||||
|
||||
def hush!
|
||||
self.mute = true
|
||||
end
|
||||
|
||||
def talk!
|
||||
self.mute = false
|
||||
end
|
||||
|
||||
def initialize
|
||||
self.mute = false
|
||||
[].zip(
|
||||
["valid?", "callback!", "match!"], [
|
||||
[ # forks up forks down man forks sideways
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
require 'cinch'
|
||||
require_relative '../classes/Util.rb'
|
||||
class AutoRejoin
|
||||
include Cinch::Plugin
|
||||
include Util::PluginHelper
|
||||
|
||||
listen_to :kick, method: :rejoin
|
||||
|
||||
def rejoin(m)
|
||||
params = m.params
|
||||
assholes = params.shift
|
||||
target = params.shift
|
||||
asshole = m.user
|
||||
puts "WE GOT KICKED OH FUCKING NO!!!!\n"*20
|
||||
puts "\tWE GOT KICKED FROM #{assholes} BY #{asshole} brehh\n"*20
|
||||
if(target == m.bot.nick) #someone kicked us how dare they!
|
||||
m.bot.join(assholes)
|
||||
Timer(3, {:shots => 1}) do
|
||||
Channel(assholes).send(">:^[ rude af, #{asshole} ")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,55 @@
|
|||
require 'cinch'
|
||||
require 'resolv'
|
||||
require 'socket'
|
||||
require_relative '../classes/Util.rb'
|
||||
class DigDeep
|
||||
include Cinch::Plugin
|
||||
include Hooks::ACLHook
|
||||
include Util::PluginHelper
|
||||
@clist = %w{dig}
|
||||
@@commands["dig"] = ":dig <record type> <host> [@<nameserver>] - perform a dns lookup for the given record type and host (use @host optionally to specify ns)"
|
||||
set :prefix, /^:/
|
||||
match /dig (\w+?) (.+?)(?:@(.+))?$/, method: :dig
|
||||
|
||||
def dig(m, rec, host, ns=nil)
|
||||
recs = [
|
||||
"A", "AAAA", "AFSDB",
|
||||
"APL", "AXFR", "CAA",
|
||||
"CDNSKEY", "CDS", "CERT",
|
||||
"CNAME", "CSYNC", "DHCID",
|
||||
"DLV", "DNAME", "DNSKEY",
|
||||
"DS", "EUI48", "EUI64",
|
||||
"HINFO", "HIP", "HTTPS",
|
||||
"IPSECKEY", "IXFR", "KEY",
|
||||
"KX", "LOC", "MX",
|
||||
"NAPTR", "NS", "NSEC3",
|
||||
"NSEC3PARAM", "NSEC", "NXT",
|
||||
"OPENPGPKEY", "OPT", "PTR",
|
||||
"RP", "RRSIG", "SIG",
|
||||
"SMIMEA", "SOA", "SSHFP",
|
||||
"SVCB", "SRV", "TA",
|
||||
"TKEY", "TLSA", "TSIG",
|
||||
"TXT", "URI", "ZONEMD"
|
||||
]
|
||||
resp = ""
|
||||
puts "recs = #{recs.inspect}"
|
||||
puts "recs.include? rec.upcase: #{(recs.include? rec.upcase).inspect}"
|
||||
ns ||= Resolv::DNS::Config.default_config_hash[:nameserver]
|
||||
puts "rec upcase: #{rec.upcase}"
|
||||
puts "dig #{rec} #{host} via namserver #{ns}"
|
||||
begin
|
||||
if(!recs.include? rec.upcase)
|
||||
raise Exception.new "lol wtf kinda record is #{rec}?"
|
||||
end
|
||||
|
||||
rescue Exception => e
|
||||
resp = e.message
|
||||
ensure
|
||||
puts "resp: #{resp}"
|
||||
#m.reply resp
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
=begin
|
||||
=end
|
|
@ -43,8 +43,9 @@ class Regices
|
|||
#puts "detected modes: #{userModes.join(', ')}"
|
||||
#puts "detected prefix: #{prefix}"
|
||||
end
|
||||
tm = Time.at(row[:time]).strftime "%F %T"
|
||||
out << "What #{row[:user]} %s to say was:\n" % [ Format(:italic, :bold, "meant") ]
|
||||
out << "<#{prefix}#{row[:user]}>" << " "
|
||||
out << "#{tm} | <#{prefix}#{row[:user]}>" << " "
|
||||
method = :sub
|
||||
args = [/#{search}/, replace]
|
||||
if(global)
|
||||
|
@ -81,6 +82,7 @@ class Regices
|
|||
row = res.to_a.detect { |x| !x[:text].match /^[msj]\//i }
|
||||
user = row[:user]
|
||||
users = m.channel.users.to_a
|
||||
tm = Time.at(row[:time]).strftime "%F %T"
|
||||
modeList = users.detect { |usr| usr[0].nick == user }
|
||||
prefix = ""
|
||||
if(!modeList.nil?)
|
||||
|
@ -92,8 +94,8 @@ class Regices
|
|||
#puts "detected modes: #{userModes.join(', ')}"
|
||||
#puts "detected prefix: #{prefix}"
|
||||
#out << "What #{row[:user]} %s to say was:\n" % [ Format(:italic, :bold, "meant") ]
|
||||
out << "<#{prefix}#{row[:user]}>" << " "
|
||||
out << row['text']
|
||||
out << "#{tm} | m<#{prefix}#{row[:user]}>" << " "
|
||||
out << row[:text]
|
||||
else
|
||||
out << "can't find no matchin message for m/${search}/ bruh"
|
||||
end
|
||||
|
|
|
@ -9,28 +9,28 @@ class SocialEyes
|
|||
super
|
||||
puts "WATCH ME INITIALIZE " * 500
|
||||
@responses = [
|
||||
#{ :match => /^h$/i, :response => "h" },
|
||||
#{ :match => /^yes hell?o/, :response => "hello yes" },
|
||||
#{ :match => /^helo/, :response => "EHLO 255.255.255.255" },
|
||||
#{ :match => /^hie/i, :response => "hie2u2" },
|
||||
#{ :match => /^same/i, :response => "[✔] Same" },
|
||||
#{ :match => /^h(i|ello|elo)/i, :response => "yes helo" },
|
||||
#{ :match => /ban/i, :response => "ban 0" },
|
||||
#{ :match => /^\by(a|e[as]h?)\b(?! hell?o)/i, :method => :affirm },
|
||||
#{ :match => /r(eally|ly)/i, :response => "big if tru" },
|
||||
#{ :match => /^\bn(o(pe)?|ah)\b/i, :method => :deny },
|
||||
{ :match => /^the$/i, :response => "the" },
|
||||
{ :match => /^(5 *|(5 )+)$/, :method => :five_alive },
|
||||
{ :match => /good bot/i, :method => Util::Util.instance.method(:getSuccess)},
|
||||
{ :match => /bad bot/i, :method => Util::Util.instance.method(:getExcuse)},
|
||||
#{ :match => /crime/i, :response => "we meddle in mcgirt, ONLINE" },
|
||||
{ :match => /queed squad/i, :response => "QUEED SQUAD RE%" },
|
||||
{ :match => /re%/i, :response => "RE% 5 EVR" },
|
||||
#{ :match => /fuckhole jones/i, :response => "EXCEPTIONS BEEN THROWN" }
|
||||
#{ :match => /^h$/i, :response => "h" , :offset => 10 },
|
||||
#{ :match => /^yes hell?o$/, :response => "hello yes" , :offset => 10 },
|
||||
#{ :match => /^helo$/, :response => "EHLO 255.255.255.255" , :offset => 10 },
|
||||
#{ :match => /^hie$/i, :response => "hie2u2" , :offset => 10 },
|
||||
{ :match => /^same$/i, :response => "[✔] Same" , :offset => 10 },
|
||||
#{ :match => /^h(i|ello)$/i, :response => "yes helo" , :offset => 10 },
|
||||
#{ :match => /ban/i, :response => "ban 0" , :offset => 10 },
|
||||
#{ :match => /^\by(a|e[as]h?)\b(?! hell?o)/i, :method => :affirm , :offset => 10 },
|
||||
#{ :match => /r(eally|ly)/i, :response => "big if tru" , :offset => 10 },
|
||||
#{ :match => /^\bn(o(pe)?|ah)\b/i, :method => :deny , :offset => 10 },
|
||||
{ :match => /^the$/i, :response => "the" , :offset => 60 },
|
||||
{ :match => /^(5 *|(5 )+)$/, :method => :five_alive , :offset => 2 },
|
||||
{ :match => /good bot/i, :method => Util::Util.instance.method(:getSuccess), :offset => 10 },
|
||||
{ :match => /bad bot/i, :method => Util::Util.instance.method(:getExcuse), :offset => 10 },
|
||||
#{ :match => /crime/i, :response => "we meddle in mcgirt, ONLINE" , :offset => 10 },
|
||||
{ :match => /queed squad/i, :response => "QUEED SQUAD RE%" , :offset => 30 },
|
||||
{ :match => /re%/i, :response => "RE% 5 EVR" , :offset => 30 },
|
||||
{ :match => /fuckhole jones/i, :response => "EXCEPTIONS BEEN THROWN", :offset => 30 }
|
||||
]
|
||||
@actions = @responses.map { |i| mak i }
|
||||
end
|
||||
|
||||
|
||||
def five_alive
|
||||
files = Dir.glob("*.5ive", base: "etc/5ive")
|
||||
file = files.sample
|
||||
|
@ -110,13 +110,13 @@ class SocialEyes
|
|||
"yuh",
|
||||
"ACK",
|
||||
"true",
|
||||
"(bool)1",
|
||||
"(bool)1",
|
||||
"!!!0",
|
||||
"!FALSE"
|
||||
]
|
||||
return res.sample
|
||||
end
|
||||
|
||||
|
||||
def mak(spec)
|
||||
puts "mak spec: #{spec.inspect}"
|
||||
if spec[:match].nil? # you think this a joke boi?
|
||||
|
@ -134,9 +134,11 @@ class SocialEyes
|
|||
else # ha SIKE we got that ouchea
|
||||
action = spec[:method] #store that shiii
|
||||
end
|
||||
offset = spec[:offset] || 10
|
||||
return add_act { |act|
|
||||
act.match! match
|
||||
act.callback! &action
|
||||
act.offset! offset
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -153,35 +155,36 @@ class SocialEyes
|
|||
raise "invalid action: #{act.inspect}"
|
||||
end
|
||||
end
|
||||
def scan (msg)
|
||||
|
||||
def scan(msg)
|
||||
if @actions.empty?
|
||||
puts "I AM SMOKING ON THAT CRACK MY GUY\n"*100
|
||||
end
|
||||
puts ("ACTIONS "*20 << "\n") * 50
|
||||
#puts ("ACTIONS "*20 << "\n") * 50
|
||||
puts @actions.inspect
|
||||
return @actions.find{ |i| i.test msg }
|
||||
end
|
||||
include Cinch::Plugin
|
||||
listen_to :message
|
||||
$responses =
|
||||
#puts $can_speak.inspect
|
||||
$offset = 10
|
||||
def listen(m)
|
||||
msg = m.message
|
||||
#target = ""
|
||||
response = ""
|
||||
#puts "canspeak: #{$can_speak.inspect}"
|
||||
puts "scanning #{msg}..."
|
||||
action = scan(msg) #scan msg across the actions
|
||||
puts "action res: #{action.inspect}"
|
||||
if(action.nil?) #no matching action
|
||||
if(action.nil? || action.mute) #no matching action, or on cooldown
|
||||
puts "fuck lol"
|
||||
return #lazyinestntis Wins!
|
||||
else
|
||||
puts " i got that shit"
|
||||
response = action.stdout
|
||||
puts response.inspect
|
||||
m.reply response
|
||||
spoke = action.speak! m
|
||||
if spoke
|
||||
Timer(action.offset, {:shots => 1}) do
|
||||
puts "hi im in the timer..."
|
||||
puts "action: #{action.inspect}"
|
||||
action.talk!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
require 'cinch'
|
||||
require 'resolv'
|
||||
require 'chronic'
|
||||
require_relative '../classes/Util.rb'
|
||||
class Ago
|
||||
include Cinch::Plugin
|
||||
include Hooks::ACLHook
|
||||
include Util::PluginHelper
|
||||
@clist = %w{dig}
|
||||
@@commands["dig"] = ":dig <record type> <host> - perform a dns lookup for the given record type and host"
|
||||
set :prefix, /^:/
|
||||
@recs = [
|
||||
"A", "AAAA", "AFSDB",
|
||||
"APL", "AXFR", "CAA",
|
||||
"CDNSKEY", "CDS", "CERT",
|
||||
"CNAME", "CSYNC", "DHCID",
|
||||
"DLV", "DNAME", "DNSKEY",
|
||||
"DS", "EUI48", "EUI64",
|
||||
"HINFO", "HIP", "HTTPS",
|
||||
"IPSECKEY", "IXFR", "KEY",
|
||||
"KX", "LOC", "MX",
|
||||
"NAPTR", "NS", "NSEC3",
|
||||
"NSEC3PARAM", "NSEC", "NXT",
|
||||
"OPENPGPKEY", "OPT", "PTR",
|
||||
"RP", "RRSIG", "SIG",
|
||||
"SMIMEA", "SOA", "SSHFP",
|
||||
"SVCB", "SRV", "TA",
|
||||
"TKEY", "TLSA", "TSIG",
|
||||
"TXT", "URI", "ZONEMD"
|
||||
]
|
||||
match /dig (\w+?) (\w+)$/, method: :dig
|
||||
|
||||
def dig(m, rec, host)
|
||||
resp = ""
|
||||
if(!@recs.include? rec.upcase)
|
||||
resp = "lol wtf kinda record is #{rec}?"
|
||||
unless(rec.upcase
|
||||
db = Util::Util.instance.getCollection("extendobot","logs")
|
||||
puts "seen seen seen seen\n"*10
|
||||
puts ":seen #{nick}"
|
||||
res = db.find({
|
||||
"server" => Util::Util.instance.hton("#{m.bot.config.server}:#{m.bot.config.port}"),
|
||||
"channel" => m.channel.name,
|
||||
'user' => nick
|
||||
}).limit(1).sort({"time" => -1})
|
||||
out = ""
|
||||
debug "lastseen #{nick}?\n"*10
|
||||
if(res.count > 0)
|
||||
row = res.to_a.shift
|
||||
tm = row[:time]
|
||||
dt = Time.at(tm)
|
||||
now = Time.now
|
||||
td = TimeDifference.between(dt,now).humanize
|
||||
out << "<#{row[:user]}>" << " "
|
||||
out << row['text']
|
||||
out << "\n#{td.downcase} ago (#{dt.strftime '%c'})"
|
||||
else
|
||||
out << "who tf is #{nick}?"
|
||||
end
|
||||
m.reply(out)
|
||||
end
|
||||
end
|
||||
=begin
|
||||
=end
|
|
@ -0,0 +1,21 @@
|
|||
require 'cinch'
|
||||
require 'open-uri'
|
||||
require 'time_difference'
|
||||
require 'date'
|
||||
require_relative '../classes/Util.rb'
|
||||
class AutoRejoin
|
||||
include Cinch::Plugin
|
||||
include Util::PluginHelper
|
||||
listen_to :kick, :rejoin
|
||||
|
||||
def rejoin(m, tgt)
|
||||
if(tgt == m.bot.nick) #someone kicked us how dare they!
|
||||
assholes = m.channel
|
||||
asshole = m.user
|
||||
m.bot.join(assholes)
|
||||
Timer(10, {:shots => 1}) do
|
||||
Channel(assholes).send(">:^[ rude af, #{asshole} ")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,43 @@
|
|||
require 'cinch'
|
||||
require 'resolv'
|
||||
require 'socket'
|
||||
require_relative '../classes/Util.rb'
|
||||
class DigDeep
|
||||
include Cinch::Plugin
|
||||
include Hooks::ACLHook
|
||||
include Util::PluginHelper
|
||||
@clist = %w{dig}
|
||||
@@commands["dig"] = ":dig <record type> <host> [@<nameserver>] - perform a dns lookup for the given record type and host (use @host optionally to specify ns)"
|
||||
set :prefix, /^:/
|
||||
@recs = [
|
||||
"A", "AAAA", "AFSDB",
|
||||
"APL", "AXFR", "CAA",
|
||||
"CDNSKEY", "CDS", "CERT",
|
||||
"CNAME", "CSYNC", "DHCID",
|
||||
"DLV", "DNAME", "DNSKEY",
|
||||
"DS", "EUI48", "EUI64",
|
||||
"HINFO", "HIP", "HTTPS",
|
||||
"IPSECKEY", "IXFR", "KEY",
|
||||
"KX", "LOC", "MX",
|
||||
"NAPTR", "NS", "NSEC3",
|
||||
"NSEC3PARAM", "NSEC", "NXT",
|
||||
"OPENPGPKEY", "OPT", "PTR",
|
||||
"RP", "RRSIG", "SIG",
|
||||
"SMIMEA", "SOA", "SSHFP",
|
||||
"SVCB", "SRV", "TA",
|
||||
"TKEY", "TLSA", "TSIG",
|
||||
"TXT", "URI", "ZONEMD"
|
||||
]
|
||||
match /dig (\w+?) (.+?)(?:@(.+))?$/, method: :dig
|
||||
|
||||
def dig(m, rec, host, ns=nil)
|
||||
resp = ""
|
||||
if(!@recs.include? rec.upcase)
|
||||
resp = "lol wtf kinda record is #{rec}?"
|
||||
end
|
||||
ns ||= Resolv::DNS::Config.default_config_hash[:nameserver]
|
||||
puts "dig #{rec} #{host} via namserver #{ns}"
|
||||
end
|
||||
end
|
||||
=begin
|
||||
=end
|
Loading…
Reference in New Issue