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



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

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



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

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



103
104
105
106
107
# File 'lib/kag/irc/plugin.rb', line 103

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

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



121
122
123
124
125
# File 'lib/kag/irc/plugin.rb', line 121

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



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

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



130
131
132
133
134
# File 'lib/kag/irc/plugin.rb', line 130

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

#op(m, nick) ⇒ Object



94
95
96
97
98
# File 'lib/kag/irc/plugin.rb', line 94

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
46
47
# File 'lib/kag/irc/plugin.rb', line 39

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

#voice(m, nick) ⇒ Object



112
113
114
115
116
# File 'lib/kag/irc/plugin.rb', line 112

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