Class: KAG::Bans::Plugin

Inherits:
Object
  • Object
show all
Includes:
Cinch::Commands, Cinch::Plugin, Common
Defined in:
lib/kag/bans/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

#ignore(m, nick) ⇒ Object



66
67
68
69
70
71
72
73
74
75
# File 'lib/kag/bans/plugin.rb', line 66

def ignore(m,nick)
  if is_admin(m.user)
    user = User(nick)
    if user and !user.unknown
      KAG::Bans::Report.ignore(self,m,user)
    else
      reply m,"Could not find user #{nick}"
    end
  end
end

#report(m, nick) ⇒ Object



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

def report(m,nick)
  unless is_banned?(m.user)
    u = User(nick)
    if u and !u.unknown
      KAG::Bans::Report.new(self,m,u)
    else
      reply m,"User #{nick} not found!"
    end
  end
end

#reported(m) ⇒ Object



43
44
45
46
47
# File 'lib/kag/bans/plugin.rb', line 43

def reported(m)
  unless is_banned?(m.user)
    KAG::Bans::Report.list
  end
end

#reports(m, nick) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/kag/bans/plugin.rb', line 27

def reports(m,nick)
  user = User(nick)
  if user and !user.unknown
    count = KAG::Bans::Report.reports(user)
    if count
      reply m,"User has been reported #{count.to_s} times."
    else
      reply m,"User has not been reported."
    end
  else
    reply m,"Could not find user #{nick}"
  end
end

#unignore(m, nick) ⇒ Object



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

def unignore(m,nick)
  if is_admin(m.user)
    user = User(nick)
    if user and !user.unknown
      KAG::Bans::Report.unignore(self,m,user)
    else
      reply m,"Could not find user #{nick}"
    end
  end
end

#unreport(m, nick) ⇒ Object



52
53
54
55
56
57
58
59
60
61
# File 'lib/kag/bans/plugin.rb', line 52

def unreport(m,nick)
  if is_admin(m.user)
    user = User(nick)
    if user and !user.unknown
      KAG::Bans::Report.remove(self,m,user)
    else
      reply m,"Could not find user #{nick}"
    end
  end
end