Module: KAG::Common
- Includes:
- Cinch::Plugin
- Included in:
- Cinch::Commands::Help, Bans::Plugin, Bot::Plugin, Gather::Plugin, Help::Plugin, IRC::Plugin, Stats::Plugin, User::Plugin
- Defined in:
- lib/kag/common.rb
Instance Method Summary collapse
- #_h(key, params = {}) ⇒ Object
- #debug(msg) ⇒ Object
- #is_admin(user) ⇒ Object
- #is_banned?(user) ⇒ Boolean
- #reply(message, text, colorize = true) ⇒ Object
- #send_channels_msg(msg, colorize = true) ⇒ Object
Instance Method Details
#_h(key, params = {}) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/kag/common.rb', line 35 def _h(key,params = {}) if KAG::Help::Book.instance.key?(key.to_sym) text = KAG::Help::Book.instance[key.to_sym].to_s params.each do |k,v| text.gsub!("[[+"+k.to_s+"]]",v) end text else "" end end |
#debug(msg) ⇒ Object
23 24 25 26 27 |
# File 'lib/kag/common.rb', line 23 def debug(msg) if KAG::Config.instance[:debug] puts msg end end |
#is_admin(user) ⇒ Object
29 30 31 32 33 |
# File 'lib/kag/common.rb', line 29 def is_admin(user) user.refresh o = (KAG::Config.instance[:owners] or []) o.include?(user.authname) end |
#is_banned?(user) ⇒ Boolean
19 20 21 |
# File 'lib/kag/common.rb', line 19 def is_banned?(user) KAG::Bans::Report.is_banned?(user) end |
#reply(message, text, colorize = true) ⇒ Object
7 8 9 10 |
# File 'lib/kag/common.rb', line 7 def reply(,text,colorize = true) text = Format(:grey,text) if colorize .reply text end |