-
Notifications
You must be signed in to change notification settings - Fork 0
/
adminbot.rb
50 lines (42 loc) · 1.14 KB
/
adminbot.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
require 'cinch'
class Kick
include Cinch::Plugin
prefix "."
match /k ([^ ]+) ?(.*)/
match /kick ([^ ]+) ?(.*)/
def execute(m, nick, reason)
if (m.channel.opped? m.user) && (nick.downcase != @bot.nick.downcase)
m.channel.kick(nick, reason)
end
end
end
class KickBan
include Cinch::Plugin
prefix "."
match /kb ([^ ]+) ?(.*)/
match /unban ([^ ]+)/, method: :unban
def execute(m, nick, reason)
if (m.channel.opped? m.user) && (nick.downcase != @bot.nick.downcase)
n = User(nick)
return if n.unknown
m.channel.ban("*!*@"+n.host)
m.channel.kick(n, reason)
end
end
def unban(m, nick)
m.channel.reply User(nick).authname
end
end
adminbot = Cinch::Bot.new do
configure do |c|
c.server = 'irc.freenode.net'
c.channels = ["#bossko-hii"]
c.nick = 'kunaldAdminBot'
c.realname = 'Almost Kunal Desai'
f = File.new("admin-credentials.txt")
c.password = f.readline
f.close
c.plugins.plugins = [Kick, KickBan]
end
end
adminbot.start