Class: Plugins::Attack
- Inherits:
-
Object
- Object
- Plugins::Attack
- Includes:
- Cinch::Helpers, Cinch::Plugin
- Defined in:
- lib/Zeta/plugins/attack.rb
Instance Method Summary collapse
-
#execute(m, target = nil) ⇒ Object
Methods.
-
#initialize(*args) ⇒ Attack
constructor
A new instance of Attack.
Methods included from Cinch::Plugin
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 |