Customizable start up params

main
Stef Dunlap 2022-08-23 22:41:40 -04:00
parent 3ffba8f981
commit 47425fdd85
2 changed files with 13 additions and 4 deletions

13
our.rb
View File

@ -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

4
start.sh 100755
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
DIR=$(dirname -- $0)
/usr/bin/bwrap --unshare-all --ro-bind / / --share-net --dev /dev --tmpfs /tmp $DIR/our.rb