Skip to content

Instantly share code, notes, and snippets.

@jameswritescode
Created October 22, 2014 00:30
Show Gist options
  • Select an option

  • Save jameswritescode/0964fb30b74d4abf7d2b to your computer and use it in GitHub Desktop.

Select an option

Save jameswritescode/0964fb30b74d4abf7d2b to your computer and use it in GitHub Desktop.
$config = YAML.load_file('config.yml')[env]
$bot = Cinch::Bot.new do
configure do |c|
c.nick = $config['bot']['nick']
c.user = $config['bot']['user']
c.realname = "#{$config['bot']['realname']} - #{`git log --pretty=format:'%h' -n 1`} - #{env}"
c.server = $config['bot']['server']
c.channels = $config['bot']['channels']
c.password = $config['bot']['password']
c.messages_per_second = 1
if env == 'production'
c.sasl.username = $config['bot']['sasl']['username']
c.sasl.password = $config['bot']['sasl']['password']
end
c.plugins.plugins = [
Howell::Core::PluginLoader,
Howell::Core::PluginWatcher,
Howell::Core::PluginReload
]
c.plugins.prefix = /^./
end
if env == 'production'
on :connect do |m|
m.bot.irc.send $config['bot']['perform']
end
end
end
Thread.new { $bot.start }
Thread.new do
set :port, 2772
$sinatra_pid = Process.pid
Dir.glob('./plugins/requests/**/*.rb').each { |plugin| load(plugin) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment