Module: Cosgrove::Config

Included in:
Account, UpvoteJob, Utils
Defined in:
lib/cosgrove/config.rb

Instance Method Summary collapse

Instance Method Details

#channel_disable_comment_voting(channel_id) ⇒ Object



120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/cosgrove/config.rb', line 120

def channel_disable_comment_voting(channel_id)
  rules = yml[:cosgrove][:upvote_rules][:channels]
  default_disable_comment_voting = rules[:default][:disable_comment_voting].to_s == 'true' rescue false
  
  keys = rules.keys - [:default]
  
  disable_comment_voting = keys.map do |key|
    rule = rules[key]
    rule[:disable_comment_voting] if rule[:channel_id] == channel_id
  end.compact.last
  
  disable_comment_voting || default_disable_comment_voting
end

#channel_upvote_weight(channel_id) ⇒ Object



106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/cosgrove/config.rb', line 106

def channel_upvote_weight(channel_id)
  rules = yml[:cosgrove][:upvote_rules][:channels]
  default_weight = rules[:default][:upvote_weight] rescue '0.00 %'
  
  keys = rules.keys - [:default]
  
  weight = keys.map do |key|
    rule = rules[key]
    rule[:upvote_weight] if rule[:channel_id] == channel_id
  end.compact.last
  
  weight || default_weight
end

#cosgrove_allow_pm_commandsObject



19
20
21
# File 'lib/cosgrove/config.rb', line 19

def cosgrove_allow_pm_commands
  yml[:cosgrove][:allow_pm_commands].to_s == 'true'
end

#cosgrove_client_idObject



11
12
13
# File 'lib/cosgrove/config.rb', line 11

def cosgrove_client_id
  yml[:cosgrove][:client_id]
end

#cosgrove_disable_comment_votingObject



27
28
29
# File 'lib/cosgrove/config.rb', line 27

def cosgrove_disable_comment_voting
  yml[:cosgrove][:disable_comment_voting].to_s == 'true'
end

#cosgrove_operatorsObject



15
16
17
# File 'lib/cosgrove/config.rb', line 15

def cosgrove_operators
  (yml[:cosgrove][:operators] || '').split(' ')
end

#cosgrove_secureObject



3
4
5
# File 'lib/cosgrove/config.rb', line 3

def cosgrove_secure
  yml[:cosgrove][:secure]
end

#cosgrove_tokenObject



7
8
9
# File 'lib/cosgrove/config.rb', line 7

def cosgrove_token
  yml[:cosgrove][:token]
end

#cosgrove_upvote_weightObject



23
24
25
# File 'lib/cosgrove/config.rb', line 23

def cosgrove_upvote_weight
  yml[:cosgrove][:upvote_weight]
end

#discord_channelsObject



87
88
89
90
91
# File 'lib/cosgrove/config.rb', line 87

def discord_channels
  return ENV['CHANNELS'].to_s.split(' ') if !!ENV['CHANNELS']
  
  yml[:discord][:channels]
end

#discord_fancy_logObject



100
101
102
103
104
# File 'lib/cosgrove/config.rb', line 100

def discord_fancy_log
  return false if !!ENV['HELL_ENABLED']
  
  yml[:discord][:fancy_log].to_s == 'true'
end

#discord_log_modeObject



93
94
95
96
97
98
# File 'lib/cosgrove/config.rb', line 93

def discord_log_mode
  return :debug if !!ENV['HELL_ENABLED']
  return :info unless !!yml[:discord][:log_mode]
  
  yml[:discord][:log_mode].to_sym
end

#hive_accountObject



71
72
73
# File 'lib/cosgrove/config.rb', line 71

def 
  chain[:hive_account]
end

#hive_api_failover_urlsObject



43
44
45
# File 'lib/cosgrove/config.rb', line 43

def hive_api_failover_urls
  [chain[:hive_api_failover_urls]].flatten.compact
end

#hive_api_urlObject



39
40
41
# File 'lib/cosgrove/config.rb', line 39

def hive_api_url
  chain[:hive_api_url]
end

#hive_engine_api_urlObject



59
60
61
# File 'lib/cosgrove/config.rb', line 59

def hive_engine_api_url
  (chain[:hive_engine_api_url] rescue nil) || 'https://api.hive-engine.com/rpc'
end

#hive_posting_wifObject



75
76
77
# File 'lib/cosgrove/config.rb', line 75

def hive_posting_wif
  chain[:hive_posting_wif]
end

#meeseeker_urlObject



83
84
85
# File 'lib/cosgrove/config.rb', line 83

def meeseeker_url
  chain[:meeseeker][:url]
end

#steem_accountObject



63
64
65
# File 'lib/cosgrove/config.rb', line 63

def 
  chain[:steem_account]
end

#steem_api_failover_urlsObject



35
36
37
# File 'lib/cosgrove/config.rb', line 35

def steem_api_failover_urls
  [chain[:steem_api_failover_urls]].flatten.compact
end

#steem_api_urlObject



31
32
33
# File 'lib/cosgrove/config.rb', line 31

def steem_api_url
  chain[:steem_api_url]
end

#steem_engine_api_urlObject



55
56
57
# File 'lib/cosgrove/config.rb', line 55

def steem_engine_api_url
  (chain[:steem_engine_api_url] rescue nil) || 'https://api.steem-engine.com/rpc'
end

#steem_posting_wifObject



67
68
69
# File 'lib/cosgrove/config.rb', line 67

def steem_posting_wif
  chain[:steem_posting_wif]
end

#test_api_failover_urlsObject



51
52
53
# File 'lib/cosgrove/config.rb', line 51

def test_api_failover_urls
  [chain[:test_api_failover_urls]].flatten.compact
end

#test_api_urlObject



47
48
49
# File 'lib/cosgrove/config.rb', line 47

def test_api_url
  chain[:test_api_url]
end

#test_posting_wifObject



79
80
81
# File 'lib/cosgrove/config.rb', line 79

def test_posting_wif
  chain[:test_posting_wif]
end