SHOW:
|
|
- or go back to the newest paste.
1 | #!/usr/bin/env ruby | |
2 | ||
3 | require "cinch" | |
4 | ||
5 | users = Hash.new | |
6 | ||
7 | bot = Cinch::Bot.new do | |
8 | configure do |c| | |
9 | c.nick = "SimpleBot" | |
10 | c.server = "irc.freenode.net" | |
11 | c.channels = ["#cinch-bots"] | |
12 | end | |
13 | ||
14 | ||
15 | on :message, /(^hi$|^sup$|^hi everyone$|^hello$)/ do |m| | |
16 | unless users.has_key? m.user.nick.downcase and users[m.user.nick.downcase] - Time.now < 60 | |
17 | - | users[m.user.nick.downcase] = Time.now |
17 | + | users[m.user.nick.downcase] = Time.now.to_i |
18 | m.reply "Hi, #{m.user.nick}" | |
19 | end | |
20 | end | |
21 | end | |
22 | ||
23 | ||
24 | ||
25 | bot.start |