Permalink
Browse files

add a sequel database and mock some more ideas, like link logging & g…

…eneral logging
  • Loading branch information...
1 parent 4a1f4a9 commit 4bd8e730274730d0973404d8e04339f8464280a1 @jamiew committed Apr 13, 2009
Showing with 25 additions and 15 deletions.
  1. +25 −15 fatbot.rb
View
@@ -2,11 +2,16 @@
# this is jamiew's IRC bot for #fatlab
# his name is DUBTRON 9000
# http://jamiedubs.com
+#
+# dependencies: isaac, sequel, jnunemaker-twitter
require 'rubygems'
-require 'isaac'
require 'open-uri'
+require 'sequel'
+require 'isaac'
+#gem 'jnunemaker-twitter'; require 'twitter'
+DB = Sequel.sqlite('irc.db')
configure do |c|
c.nick = "dubtron"
@@ -19,9 +24,9 @@
# just a simple check for FAT Lab fellows
# count on NickServ for security :x
def ops?(nick)
- # ['jamiew','ttttbx','fi5e','randofo','bekathwia','Geraldine','Geraldine_'].include?(nick)
+ ['jamiew','ttttbx','fi5e','randofo','bekathwia','Geraldine','Geraldine_'].include?(nick)
# w/e, everyone for now
- true
+ # true
end
@@ -31,26 +36,16 @@ def ops?(nick)
end
-# log all text
-#on :channel, /.*/ do
-# open("#{channel}.log", "a") do |log|
-# log.puts "#{nick}: #{message}"
-# end
-# puts "#{channel}: #{nick}: #{message}"
-#end
# echo things like "quote this: some text"
+#TODO: make just if via a private msg from ops or something
on :channel, /^\!echo (.*)/ do
msg channel, "#{match[0]}"
# msg channel, "#{match[0]} by #{nick}"
end
-# private echo for ops
-# TODO
-
-
-# give me a meme
+# give me a meme using inky's automeme ENTERPRISE API
on :channel, /^\!meme/ do
meme = open("http://meme.boxofjunk.ws/moar.txt?lines=1").read.chomp
msg channel, meme
@@ -65,6 +60,7 @@ def ops?(nick)
# give you a taco. via gerry
# TODO: we need more tacos
+# FIXME: how to do actions? not sure if isaac handles
on :channel, /^\!taco/ do
tacos = ['carnitas', 'barbacoa', 'fish', 'shrimp']
msg channel, "/me gives #{nick} a #{tacos[(rand*tacos.length).floor]} taco"
@@ -75,3 +71,17 @@ def ops?(nick)
topic(channel, "#{match[0]} [#{nick}]") if ops?(nick)
end
+
+# do URL detection & logging, idea vi sh1v
+on :channel, /http\:\/\/(.*)\s?/ do
+ puts "URL: #{match[0]} by #{nick}"
+end
+
+# lastly, do logging
+# from http://github.com/jamie/ircscribe/
+on :channel, /.*/ do
+ msg = message.chomp
+ puts "#{channel} <#{nick}> #{msg}"
+ DB[:messages] << {:channel => channel, :nick => nick, :message => msg, :at => Time.now}
+end
+

0 comments on commit 4bd8e73

Please sign in to comment.