-
Notifications
You must be signed in to change notification settings - Fork 1
/
env.rb
53 lines (35 loc) · 1.25 KB
/
env.rb
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
52
53
require 'net/http'
require "net/https"
require 'date'
require 'bundler'
Bundler.require :default
path = File.expand_path '../', __FILE__
PATH = path
require_relative 'constants'
require_relative 'lib/herald'
require_relative 'lib/env_secret'
raise "No secret `CLIENT_SECRET`" unless defined? CLIENT_SECRET
raise "No secret `BOT_TOKEN`" unless defined? BOT_TOKEN
raise "No secret `PUSHED_APP_SECRET`" unless defined? PUSHED_APP_SECRET
# DISCORD
CLIENT_KEY = "558267878462324736"
CHANNEL_ID = "277589735780777984" # BIT #general
# PUSHED
PUSHED_APP_KEY = "jGu2mv5YlezTFekha1rY"
# BOT = Discordrb::Bot.new token: BOT_TOKEN
BOT = Discordrb::Commands::CommandBot.new token: BOT_TOKEN, prefix: '!'
# use this url to authorize (replace client id with your `client_id`):
# https://discordapp.com/oauth2/authorize?&client_id=558267878462324736&scope=bot&permissions=8
# DB
DataMapper::Logger.new $stdout, :info
DataMapper.setup :default, "sqlite://#{PATH}/db/db.sqlite"
# DataMapper.setup :default, 'mysql://root:foo@localhost/pp_production'
require_relative 'models/guild'
DataMapper.finalize
APP_ENV = ENV["RACK_ENV"] || "development"
begin
Guild.count
rescue DataObjects::SyntaxError => e
puts "No guilds tabl found, migrating!"
DataMapper.auto_migrate!
end