# encoding: utf-8 require 'cinch' require_relative '../classes/Util.rb' require_relative '../classes/Mooks.rb' class SocialEyes include Util::PluginHelper def initialize(*args) super puts "WATCH ME INITIALIZE " * 500 @responses = [ #{ :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 => 0 }, { :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 res = File.open("etc/5ive/#{file}") { |f| f.read } return res end def deny res = [ "nah", "negative", "lolno ", "fake news", "false", "incorrect", "nopers", "nope", "hahahaha no", "uh no", "no way", "NOE WAI", "deny", "neh", "nein", "NAK", "FIN ACK", "disagree", "disagreed", "!TRUE", "disagrees", ] return res.sample end def affirm res = [ "affirmative", 'roger', 'wilco', 'roger wilco', "indeed", "tru", "agrees", "agreed", "agree", "big if tru", "big if tru", "big if tru", "big if tru", "big if tru", "big if tru", "big if tru", "big if tru", "big if tru", "big if tru", "big if tru", 'same', "10-4", "ya", "ofc", "yas", "yes", "yeah", "totally", "confirm", "confirmed", "mos def", "accurate ! ! !", "indubitably", "truly", "undeniably", "totes mcgotes", "totes", "u alreddi kno", "u kno it", "ah, yes.", "yuh", "ACK", "true", "(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? raise "no match providedl" # you need to provide match tho end match=spec[:match] action=nil if spec[:method].is_a? Symbol #asshole gave a symbol spec[:method] = self.method(spec[:method]) #so let me get the right thing i guess. end if spec[:response] and spec[:method].nil? #no method but a response? pretty lame. action=->() { return spec[:response] } #quickgen proc to return specific text elsif spec[:method].nil? or !spec[:method].respond_to? :call #oh wait it can't be called? raise "the method provided was either missing, or not callable: #{spec[:method].inspect}" 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 def add_act act = Mooks::Opticon.new raise "what the fuck are you, stupid?" if !block_given? puts "add new action.." yield act puts "action state: #{act.inspect}" if(act.valid?) puts "action valid, pushing it INNNN" return act else raise "invalid action: #{act.inspect}" end end 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.inspect return @actions.find{ |i| i.test msg } end include Cinch::Plugin listen_to :message #puts $can_speak.inspect def listen(m) msg = m.message #puts "canspeak: #{$can_speak.inspect}" puts "scanning #{msg}..." action = scan(msg) #scan msg across the actions puts "action res: #{action.inspect}" if(action.nil? || action.mute) #no matching action, or on cooldown puts "fuck lol" return #lazyinestntis Wins! else 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 end