class Admin::AutoVoice

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# File lib/Zeta/admin/autovoice.rb, line 12
def initialize(*args)
  @auto_voice_state = Array.new
  super
end

Public Instance Methods

autovoice(msg) click to toggle source

Methods

# File lib/Zeta/admin/autovoice.rb, line 32
def autovoice(msg)
  if @auto_voice_state.include?(msg.channel.to_s) && msg.user.authed?
    Channel(msg.channel).voice(msg.user)
  end
end
autovoice_mode(msg, mode='status') click to toggle source
# File lib/Zeta/admin/autovoice.rb, line 17
def autovoice_mode(msg, mode='status')
  return unless msg.user.oper?

  if mode == 'on' || mode == 'true'
    @auto_voice_state << msg.channel.to_s
    return msg.reply "AutoVoice is now enabled!"
  elsif mode == 'off' || mode == 'false'
    @auto_voice_state.delete_if { _1 == msg.channel.to_s }
    return msg.reply "AutoVoice is now disabled!"
  end

  msg.reply "AutoVoice is currently: #{@auto_voice_state.include?(msg.channel.to_s) ? 'On' : 'Off'}"
end