Module: Cosgrove::Config
Instance Method Summary collapse
- #channel_disable_comment_voting(channel_id) ⇒ Object
- #channel_upvote_weight(channel_id) ⇒ Object
- #cosgrove_allow_pm_commands ⇒ Object
- #cosgrove_client_id ⇒ Object
- #cosgrove_disable_comment_voting ⇒ Object
- #cosgrove_operators ⇒ Object
- #cosgrove_secure ⇒ Object
- #cosgrove_token ⇒ Object
- #cosgrove_upvote_weight ⇒ Object
- #discord_channels ⇒ Object
- #discord_fancy_log ⇒ Object
- #discord_log_mode ⇒ Object
- #hive_account ⇒ Object
- #hive_api_failover_urls ⇒ Object
- #hive_api_url ⇒ Object
- #hive_engine_api_url ⇒ Object
- #hive_posting_wif ⇒ Object
- #meeseeker_url ⇒ Object
- #steem_account ⇒ Object
- #steem_api_failover_urls ⇒ Object
- #steem_api_url ⇒ Object
- #steem_engine_api_url ⇒ Object
- #steem_posting_wif ⇒ Object
- #test_api_failover_urls ⇒ Object
- #test_api_url ⇒ Object
- #test_posting_wif ⇒ Object
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_commands ⇒ Object
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_id ⇒ Object
11 12 13 |
# File 'lib/cosgrove/config.rb', line 11 def cosgrove_client_id yml[:cosgrove][:client_id] end |
#cosgrove_disable_comment_voting ⇒ Object
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_operators ⇒ Object
15 16 17 |
# File 'lib/cosgrove/config.rb', line 15 def cosgrove_operators (yml[:cosgrove][:operators] || '').split(' ') end |
#cosgrove_secure ⇒ Object
3 4 5 |
# File 'lib/cosgrove/config.rb', line 3 def cosgrove_secure yml[:cosgrove][:secure] end |
#cosgrove_token ⇒ Object
7 8 9 |
# File 'lib/cosgrove/config.rb', line 7 def cosgrove_token yml[:cosgrove][:token] end |
#cosgrove_upvote_weight ⇒ Object
23 24 25 |
# File 'lib/cosgrove/config.rb', line 23 def cosgrove_upvote_weight yml[:cosgrove][:upvote_weight] end |
#discord_channels ⇒ Object
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_log ⇒ Object
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_mode ⇒ Object
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_account ⇒ Object
71 72 73 |
# File 'lib/cosgrove/config.rb', line 71 def hive_account chain[:hive_account] end |
#hive_api_failover_urls ⇒ Object
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_url ⇒ Object
39 40 41 |
# File 'lib/cosgrove/config.rb', line 39 def hive_api_url chain[:hive_api_url] end |
#hive_engine_api_url ⇒ Object
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_wif ⇒ Object
75 76 77 |
# File 'lib/cosgrove/config.rb', line 75 def hive_posting_wif chain[:hive_posting_wif] end |
#meeseeker_url ⇒ Object
83 84 85 |
# File 'lib/cosgrove/config.rb', line 83 def meeseeker_url chain[:meeseeker][:url] end |
#steem_account ⇒ Object
63 64 65 |
# File 'lib/cosgrove/config.rb', line 63 def steem_account chain[:steem_account] end |
#steem_api_failover_urls ⇒ Object
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_url ⇒ Object
31 32 33 |
# File 'lib/cosgrove/config.rb', line 31 def steem_api_url chain[:steem_api_url] end |
#steem_engine_api_url ⇒ Object
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_wif ⇒ Object
67 68 69 |
# File 'lib/cosgrove/config.rb', line 67 def steem_posting_wif chain[:steem_posting_wif] end |
#test_api_failover_urls ⇒ Object
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_url ⇒ Object
47 48 49 |
# File 'lib/cosgrove/config.rb', line 47 def test_api_url chain[:test_api_url] end |
#test_posting_wif ⇒ Object
79 80 81 |
# File 'lib/cosgrove/config.rb', line 79 def test_posting_wif chain[:test_posting_wif] end |