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