-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathradon.rb
executable file
·53 lines (46 loc) · 1.17 KB
/
radon.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
51
52
53
#!/usr/bin/env ruby
require 'irc.rb'
class Radon < IRCBot
def initialize
@banned_words = []
end
def handle_server_msg irc, msg
case msg
when /^:(.+?)!(.+?)@(.+?)\sPRIVMSG\s(.+)\s:(.+)$/
# Someone says something
username = $1
m = $5.strip
case m
when /^#{self.name}[:,] (.+)/
# To radon...
case $1.strip.downcase
when /^ban word (.*?)$/
@banned_words.push $1.downcase
irc.send_msg "OK, #{username}. The next person to say #{$1} will be banned."
return
when /^ban phrase (.*)$/
@banned_words.push $1.downcase
irc.send_msg "OK, #{username}. The next person to say #{$1} will be banned."
return
# If it's irrelevant, ban them for five minutes
else
ban irc, username, 600
return
end
when /^(.*)$/
ban irc, username, 3600 if @banned_words.include? $1.downcase
end
end
end
def ban irc, username, time
irc.send "KICK #{irc.channel} #{username} :NOT FUNNY" # if time == 0
irc.send "MODE #{irc.channel} +b #{username}"
end
def name
'radon'
end
def fullname
"Radon"
end
end
IRC.run 'rcnet.ath.cx', 6667, 'radon', '#isp', Radon.new