Method: Plugins::Attack#execute

Defined in:
lib/Zeta/plugins/attack.rb

#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