-
Notifications
You must be signed in to change notification settings - Fork 16
/
config.ru
51 lines (41 loc) · 938 Bytes
/
config.ru
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
$LOAD_PATH.unshift(File.dirname(__FILE__))
$env = ENV["BOT_ENV"] || "development"
# Basic setup
require 'rubygems'
require 'bundler/setup'
Bundler.require(:default, $env.to_sym)
Dotenv.load if defined?(Dotenv)
# Config & Initializers
Dir[File.expand_path('config/initializers', __dir__) + '/**/*.rb'].each do |file|
require file
end
# Bot & API stuff
require 'cord/cord'
# CommandBot init
Thread.abort_on_exception = true
Thread.new do
begin
client = Cord::CommandBot.client
client.include! Cord::Commands
client.run
rescue Exception => e
STDERR.puts "ERROR: #{e}"
STDERR.puts e.backtrace
raise e
end
end
# EventBot init
Thread.abort_on_exception = true
Thread.new do
begin
client = Cord::EventBot.client
client.include! Cord::Events
client.run
rescue Exception => e
STDERR.puts "ERROR: #{e}"
STDERR.puts e.backtrace
raise e
end
end
# API init
run Cord::Web::Base