Class: Plugins::Attack

Inherits:
Object
  • Object
show all
Includes:
Cinch::Helpers, Cinch::Plugin
Defined in:
lib/Zeta/plugins/attack.rb

Instance Method Summary collapse

Methods included from Cinch::Plugin

#check?, #log2chan

Constructor Details

#initialize(*args) ⇒ Attack

Returns a new instance of Attack.



18
19
20
21
# File 'lib/Zeta/plugins/attack.rb', line 18

def initialize(*args)
  @attackdict = []
  super
end

Instance Method Details

#execute(m, target = nil) ⇒ Object

Methods



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/Zeta/plugins/attack.rb', line 27

def execute(m, target=nil)
  target = target.rstrip
  target = m.user.nick if !target.nil? && target.match(/(\bmy\b|\b#{@bot.nick}\S*\b|\b\S*self\b)/i)
  target.gsub(/(\bmy\b|\b#{@bot.nick}\S*\b|\b\S*self\b)/i,m.user.nick+"'s") if !target.nil?;
   populate_attacks!
   output = if target
    attack!(target.gsub(/\x03([0-9]{2}(,[0-9]{2})?)?/,''), m.user.nick)
  else
    random_attack!(m.channel.users, m.user.nick)
  end
  m.channel.action output
end