Customizable start up params
parent
3ffba8f981
commit
47425fdd85
13
our.rb
13
our.rb
|
@ -2,6 +2,11 @@
|
|||
require 'socket'
|
||||
require 'open3'
|
||||
|
||||
# configurable environment variables
|
||||
nick = ENV['OUR_NICK'] || 'our'
|
||||
channels = ENV['OUR_CHANNELS'] || '#tildetown,#bots'
|
||||
prefix = ENV['OUR_PREFIX'] || "#{nick}/"
|
||||
|
||||
module IRC
|
||||
|
||||
class User
|
||||
|
@ -68,14 +73,14 @@ end
|
|||
|
||||
end
|
||||
|
||||
|
||||
puts "starting"
|
||||
i = IRC::User.new 'localhost', 6667, 'our'
|
||||
i.join '#tildetown'
|
||||
i.join '#bots'
|
||||
i = IRC::User.new 'localhost', 6667, nick
|
||||
channels.split(',').each { |channel| i.join channel }
|
||||
i.hook do |msg|
|
||||
next unless msg.cmd == 'PRIVMSG'
|
||||
target, content = msg.args
|
||||
next unless content.delete_prefix! 'our/'
|
||||
next unless content.delete_prefix! prefix
|
||||
|
||||
cmd, args = content.split(' ', 2)
|
||||
cmd = '/town/our/' + cmd
|
||||
|
|
Loading…
Reference in New Issue