Class: Admin

Inherits:
Object
  • Object
show all
Includes:
Cinch::Extensions::Authentication, Cinch::Plugin
Defined in:
lib/gitall/plugins/admin.rb

Instance Method Summary collapse

Instance Method Details

#do_Announce(m, msg = nil) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/gitall/plugins/admin.rb', line 27

def do_Announce(m, msg = nil)
  return unless authenticated? m
  if msg.nil?
    command = m.command
    m.reply "Syntax: !#{command} Message to announce..."
  else
    $bots.each do |net, bot|
      info("Announcing to #{net}")
      debug("Announcing '#{msg}'")
      bot.channels.each do |c|
        Channel(c).send("[GLOBAL - #{m.user}@#{m.bot.irc.isupport.fetch('NETWORK')}] #{msg}",
                        notice=false)
      end
    end
  end
end

#do_Join(m, channels = nil) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/gitall/plugins/admin.rb', line 59

def do_Join(m, channels = nil)
	return unless authenticated? m
	if channels.nil?
	  m.reply 'Syntax: join #channel[,#channel2,#channel3]'
	else
	  chans = channels.split(',')
	  chans.each do |chan|
	    Channel(chan).join
	  end
 	end
end

#do_Part(m, channels = nil, reasons = nil) ⇒ Object



70
71
72
73
74
75
76
77
# File 'lib/gitall/plugins/admin.rb', line 70

def do_Part(m, channels = nil, reasons = nil)
  return unless authenticated? m
  if channels.nil? && reasons.nil?
    m.reply 'Syntax: part #channel1[,#channel2,#channel3] [reason1[,reason2,reason3]]'
  else
    m.reply 'Not implemented yet'
  end
end

#do_Quit(m, msg = nil) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/gitall/plugins/admin.rb', line 44

def do_Quit(m, msg = nil)
  return unless authenticated? m
  if msg.nil?
    GitAll::Bot::Bots.bots.each do |net, bot|
      info("Exiting from #{net}")
      bot.quit('QUIT received!')
    end
  else
    GitAll::Bot::Bots.bots.each do |net, bot|
      info("Exiting from #{net}")
      bot.quit(msg)
    end
  end
  $threads.each(&:exit)
end