class Cinch::Plugins::Octospy

Public Instance Methods

greet(m) click to toggle source
# File lib/cinch/plugins/octospy.rb, line 23
def greet(m)
  m.reply "hi #{m.user.nick}"
end
join(m, channel) click to toggle source
# File lib/cinch/plugins/octospy.rb, line 35
def join(m, channel)
  ch = "##{channel.gsub('#', '')}"
  Channel(ch).join
  m.reply "#{ch} joined!"
end
join_on_invite(m) click to toggle source
# File lib/cinch/plugins/octospy.rb, line 69
def join_on_invite(m)
  Channel(m.channel).join
end
part(m, channel) click to toggle source
# File lib/cinch/plugins/octospy.rb, line 41
def part(m, channel)
  channel ||= m.channel
  if channel
    ch = "##{channel.gsub('#', '')}"
    Channel(ch).part
    m.reply "#{ch} parted!" unless ch == m.channel
  end
end
pong(m) click to toggle source
# File lib/cinch/plugins/octospy.rb, line 27
def pong(m)
  m.reply "#{m.user.nick}: pong"
end
rename(m) click to toggle source
# File lib/cinch/plugins/octospy.rb, line 31
def rename(m)
  @bot.nick += '_'
end
show_commands(m) click to toggle source
# File lib/cinch/plugins/octospy.rb, line 57
def show_commands(m)
  m.reply "#{m.bot.name}:"
  @handlers.each do |handler|
    pattern = handler.pattern.pattern
    command = case pattern.class.name
      when 'Regexp' then pattern.source unless pattern.source == ''
      when 'String' then pattern unless pattern.empty?
      end
    m.reply " #{command}" if command
  end
end
show_status(m) click to toggle source
# File lib/cinch/plugins/octospy.rb, line 50
def show_status(m)
  @bot.channels.each.with_index(1) do |channel, i|
    number = ::Octospy::Recordable.channel(channel).repos.count
    m.reply "#{"%02d" % i} #{channel}: #{number} repo#{'s' unless number.zero?}"
  end
end