Class: Admin::Oper

Inherits:
Object
  • Object
show all
Includes:
Cinch::Helpers, Cinch::Plugin
Defined in:
lib/Zeta/admin/oper.rb

Instance Method Summary collapse

Methods included from Cinch::Plugin

#check?, #log2chan

Instance Method Details

#oper_clearchan(m, chan, confirm = false) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/Zeta/admin/oper.rb', line 30

def oper_clearchan(m, chan, confirm=false)
  if confirm == 'yes' || confirm == 'true'
    Channel(chan).join
    User('OperServ').send("mode #{chan} +o #{Zeta}")
    User('OperServ').send("mode #{chan} +mi")
    Channel(chan).send('This channel is being cleared')

    number_killed = 0
    Channel(chan).users.each_key do |u|
      if u != Zeta
        number_killed += 1
        @bot.irc.send("KILL #{u.nick} This channel is being cleared")
      end
    end
    m.safe_reply "#{chan} has been cleared, #{number_killed} clients killed"

  end
end

#oper_kill(m, nick, message) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/Zeta/admin/oper.rb', line 22

def oper_kill(m, nick, message)
  return if User(nick).oper?
  message = message || 'We do not condone such behavior!'
  if @bot.irc.send("KILL #{nick} #{message}")
    m.reply "#{nick}: has been killed by #{m.user.nick} for #{message}"
  end
end

#oper_up(m) ⇒ Object

Methods



16
17
18
19
20
# File 'lib/Zeta/admin/oper.rb', line 16

def oper_up(m)
  if Config.oper_username && Config.oper_password
    @bot.oper(Config.oper_password, Config.oper_username)
  end
end

#operserv_mode(m, modes) ⇒ Object



49
50
51
# File 'lib/Zeta/admin/oper.rb', line 49

def operserv_mode(m, modes)
  User('OperServ').send("MODE #{m.channel} #{modes}")
end