Top Level Namespace

Defined Under Namespace

Modules: TinyIRC

Instance Method Summary collapse

Instance Method Details

#generate(e, c, targeted) ⇒ Object



43
44
45
46
47
48
49
50
51
52
# File 'lib/tinyirc/plugins/cookies.rb', line 43

def generate(e, c, targeted)
  quality = @cookie_qualities[c.options['quality']] || @cookie_qualities.values.sample
  type = @cookie_types[c.options['type']] || @cookie_types.values.sample  
  target = if targeted
    c.positionals['who']
  else
    e[:nick]
  end
  "ACTION %Ngives %B#{target}%N a %B#{quality}#{type}%N%B%C%BROWNcookie%N"
end

#get_target(e, c, raw) ⇒ Object

get target func



106
107
108
109
110
111
112
113
# File 'lib/tinyirc/plugins/admin-utils.rb', line 106

def get_target(e, c, raw)
  host = e[:socket].usercache.get(c.positionals['who'], false)[:host]
  if raw || host == nil
    c.positionals['who']
  else
    "*!*@#{host}"
  end
end