Class: Cinch::Plugins::AdminToolbox

Inherits:
Object
  • Object
show all
Includes:
Admin, Cinch::Plugin
Defined in:
lib/cinch/plugins/admintoolbox.rb

Constant Summary

Constants included from Admin

Admin::TYPES

Instance Method Summary collapse

Methods included from Admin

#add_admin, #add_trusted, #delete_admin, #delete_trusted, #each_controlchannel, #each_online_admin, #each_online_trusted, #get_admins, #get_trusted, #is_admin?, #is_trusted?, #no_admins?

Methods included from Helpers

#check_user, #is_channel_disabled?, table_format

Instance Method Details

#execute_add_admin(m, mask) ⇒ Object


30
31
32
33
34
35
# File 'lib/cinch/plugins/admintoolbox.rb', line 30

def execute_add_admin(m, mask)
  return unless is_admin?(m.user)
  add_admin(mask)
  m.reply "Added admin #{mask} to network #{@bot.irc.isupport['NETWORK']}."
  @bot.handlers.dispatch :admin, m, "#{m.user.nick} just added #{mask} to Admins.", m.target
end

#execute_add_trusted(m, mask) ⇒ Object


54
55
56
57
58
59
# File 'lib/cinch/plugins/admintoolbox.rb', line 54

def execute_add_trusted(m, mask)
  return unless is_admin?(m.user)
  add_trusted(mask)
  m.reply "Added trusted #{mask} to network #{@bot.irc.isupport['NETWORK']}."
  @bot.handlers.dispatch :admin, m, "#{m.user.nick} just added #{mask} to Trusted.", m.target
end

#execute_del_admin(m, mask) ⇒ Object


38
39
40
41
42
43
# File 'lib/cinch/plugins/admintoolbox.rb', line 38

def execute_del_admin(m, mask)
  return unless is_admin?(m.user)
  delete_admin(mask)
  m.reply "Deleted #{mask} from network #{@bot.irc.isupport['NETWORK']}."
  @bot.handlers.dispatch :admin, m, "#{m.user.nick} just deleted #{mask} from Admins.", m.target
end

#execute_del_trusted(m, mask) ⇒ Object


62
63
64
65
66
67
# File 'lib/cinch/plugins/admintoolbox.rb', line 62

def execute_del_trusted(m, mask)
  return unless is_admin?(m.user)
  delete_trusted(mask)
  m.reply "Deleted trusted #{mask} from network #{@bot.irc.isupport['NETWORK']}."
  @bot.handlers.dispatch :admin, m, "#{m.user.nick} just deleted #{mask} from Trusted.", m.target
end

#execute_list_admins(m) ⇒ Object


46
47
48
49
# File 'lib/cinch/plugins/admintoolbox.rb', line 46

def execute_list_admins(m)
  return unless is_admin?(m.user)
  m.reply "Administrators on %s:\n%s" % [@bot.irc.isupport['NETWORK'], get_admins.join("\n")]
end

#execute_list_trusted(m) ⇒ Object


70
71
72
73
# File 'lib/cinch/plugins/admintoolbox.rb', line 70

def execute_list_trusted(m)
  return unless is_admin?(m.user)
  m.reply "Trusted on %s:\n%s" % [@bot.irc.isupport['NETWORK'], get_trusted.join("\n")]
end

#execute_setup_admin(m) ⇒ Object


20
21
22
23
24
25
26
27
# File 'lib/cinch/plugins/admintoolbox.rb', line 20

def execute_setup_admin(m)
  return unless no_admins?
  mask = m.user.mask("*!*@%h")
  add_admin(mask)
  m.reply "Welcome, #{m.user.nick}!"
  m.reply "Added admin #{mask} to network #{@bot.irc.isupport['NETWORK']}."
  @bot.handlers.dispatch :admin, m, "#{m.user.nick} just added #{mask} to Admins.", m.target
end