class Plugins::BotInfo
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/Zeta/plugins/botinfo.rb, line 19 def initialize *args super @started_at = Time.now end
Public Instance Methods
execute(m)
click to toggle source
Methods
# File lib/Zeta/plugins/botinfo.rb, line 35 def execute(m) tags = { bot_name: @bot.nick, cinch_version: Cinch::VERSION, #is_admin: config[:admins].is_admin?(m.user.mask) ? "an admin" : "not an admin", owner_name: 'Liothen', plugins_count_remaining: @bot.plugins.length - 10, plugins_head: @bot.plugins[0..9].map {|p| p.class.plugin_name }.join(", "), ruby_platform: RUBY_PLATFORM, ruby_release_date: RUBY_RELEASE_DATE, ruby_version: RUBY_VERSION, session_start_date: @started_at.strftime("%A, %B %e, %Y, at %l:%M:%S %P"), total_channels: @bot.channels.length, total_users: proc { users = [] @bot.channels.each {|c| c.users.each {|u| users << u[0].nick } } users.uniq.size }.call, uptime: ChronicDuration.output(Time.now.to_i - @started_at.to_i) } tf = TagFormatter.new open(File.join(__dir__, '../botinfo.txt'),&:read), tags: tags m.user.notice tf.parse end
execute_help(m, name)
click to toggle source
# File lib/Zeta/plugins/botinfo.rb, line 71 def execute_help(m, name) list = {} @bot.plugins.each {|p| list[p.class.plugin_name.downcase] = {name: p.class.plugin_name, help: p.class.help} }; return m.user.notice("Help for \"#{name}\" could not be found.") if !list.has_key?(name.downcase) m.user.notice("Help for #{Format(:bold,list[name.downcase][:name])}:\n#{list[name.downcase][:help]}") end
execute_list(m)
click to toggle source
# File lib/Zeta/plugins/botinfo.rb, line 64 def execute_list(m) list = [] @bot.plugins.each {|p| list << p.class.plugin_name }; m.user.notice("All #{list.size} currently loaded plugins for #{@bot.nick}:\n#{list.to_sentence}.\nTo view help for a plugin, use `/msg #{@bot.nick} help <plugin name>`.") end