Method: Cinch::Helpers#User

Defined in:
lib/cinch/helpers.rb

#User(user) ⇒ User

Helper method for turning a String into an #User object.

Examples:

on :message, /^tell me everything about (.+)$/ do |m, target|
  user = User(target)
  m.reply "%s is named %s and connects from %s" % [user.nick, user.name, user.host]
end

Since:

  • 1.0.0



52
53
54
55
56
57
58
59
# File 'lib/cinch/helpers.rb', line 52

def User(user)
  return user if user.is_a?(User)
  if user == bot.nick
    bot
  else
    bot.user_list.find_ensured(user)
  end
end