Autumn Leaves Leaf (Irc Bot) — Chanlogger

Simple, straight forward. Logs channel messages.

class Chanlogger < AutumnLeaf
 def did_receive_channel_message(sender, channel, msg)
  log_base = File::dirname(File::dirname(__FILE__)) + "/data/logs"
   subdir = log_base + "/" + Date::today.to_s[0..6]
  Dir::mkdir(subdir) if false == File::directory?(subdir)
  logfile = subdir + "/" + channel.to_s.sub('#','') + "@" + Date::today.to_s
  f = File::open(logfile, 'a')
  f.puts(Time::now.to_s + "\t" + sender.to_s + "\t" + msg.to_s)
  f.close()
 end
end