Class: KAG::IRC::Plugin

Inherits:
Object
  • Object
show all
Includes:
Cinch::Commands, Cinch::Plugin, Common
Defined in:
lib/kag/irc/plugin.rb

Instance Method Summary collapse

Methods included from Common

#_h, #debug, #is_admin, #is_banned?, #reply, #send_channels_msg

Methods included from Cinch::Commands

included

Instance Method Details

#authed(m) ⇒ Object



49
50
51
52
53
54
55
56
# File 'lib/kag/irc/plugin.rb', line 49

def authed(m)
  m.user.refresh
  if m.user.authed?
    reply m,"#{m.user.nick} is authed."
  else
    reply m,"#{m.user.nick} is not yet authed. Please type !help to get help with authenticating."
  end
end

#authname(m, nick) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
# File 'lib/kag/irc/plugin.rb', line 61

def authname(m,nick)
  if is_admin(m.user)
    user = User(nick)
    user.refresh
    if user and !user.unknown
      reply m,"Authname for #{nick} is #{user.authname}"
    else
      reply m,"Could not find user #{nick}"
    end
  end
end

#deop(m, nick) ⇒ Object



101
102
103
104
105
# File 'lib/kag/irc/plugin.rb', line 101

def deop(m,nick)
  if is_admin(m.user)
    m.channel.deop(nick)
  end
end

#devoice(m, nick, reason = '') ⇒ Object



119
120
121
122
123
# File 'lib/kag/irc/plugin.rb', line 119

def devoice(m,nick,reason = '')
  if is_admin(m.user)
    m.channel.devoice(nick)
  end
end

#hostname(m, nick) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/kag/irc/plugin.rb', line 15

def hostname(m,nick)
  if is_admin(m.user)
    user = User(nick)
    if user and !user.unknown
      reply m,"Hostname for #{nick} is #{user.host}"
    else
      reply m,"Could not find user #{nick}"
    end
  end
end

#idle(m, nick) ⇒ Object



76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/kag/irc/plugin.rb', line 76

def idle(m,nick)
  if is_admin(m.user)
    user = User(nick)
    user.refresh
    if user and !user.unknown
      s = user.idle.to_i / 60
      reply m,"#{nick} has been idle #{s} minutes"
    else
      reply m,"Could not find user #{nick}"
    end
  end
end

#kick(m, nick, reason) ⇒ Object



128
129
130
131
132
# File 'lib/kag/irc/plugin.rb', line 128

def kick(m,nick,reason)
  if is_admin(m.user)
    m.channel.kick(nick,reason)
  end
end

#op(m, nick) ⇒ Object



92
93
94
95
96
# File 'lib/kag/irc/plugin.rb', line 92

def op(m,nick)
  if is_admin(m.user)
    m.channel.op(nick)
  end
end

#refresh(m) ⇒ Object



30
31
32
33
# File 'lib/kag/irc/plugin.rb', line 30

def refresh(m)
  m.user.refresh
  m.reply "#{m.user.nick} refreshed as #{m.user.authname}."
end

#refresh_specific(m, nick) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/kag/irc/plugin.rb', line 39

def refresh_specific(m,nick)
  u = User(nick)
  if u
    u.refresh
    m.reply "#{u.nick} refreshed as #{u.authname}."
  end
end

#voice(m, nick) ⇒ Object



110
111
112
113
114
# File 'lib/kag/irc/plugin.rb', line 110

def voice(m,nick)
  if is_admin(m.user)
    m.channel.voice(nick)
  end
end