-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.rb
99 lines (80 loc) · 2.37 KB
/
main.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
require 'cinch'
require 'twitter'
class OpenStack
include Cinch::Plugin
match(/(.*)openstack(.*)/i, {:prefix => ''})
def execute(m)
case m.message
when /openstack/
pass
when /OpenStack/
pass
end
m.reply "#{m.user.nick}: ITYM 'OpenStack'."
end
end
class Twit
@@bot ||= Twitter::REST::Client.new do |config|
config.consumer_key = "FIXME"
config.consumer_secret = "FIXME"
config.access_token = "FIXME"
config.access_token_secret = "FIXME"
end
def self.tweet(text)
@@bot.update(text)
end
end
# !chanslap <nick>:
# - rename jstir to JSTIR_THE_CHANNEL_NAZI
# - halibut the offender
# - tell them to take the conversation upstream
# - add a random insult
# - rename back
class ChanSlap
include Cinch::Plugin
match /chanslap\s+(\w+)/
def execute(m, slappee)
insults = [
"DIAF",
"you dummy",
"you're like a forty degree day!",
"you're an aeolus developer",
"YOUR MOM",
"Klaus would be disappointed",
"If you don't behave, I'll tell lifeless",
"you look exactly like tzumainn"
]
prev_nick = bot.nick
bot.nick = 'JSTIR_THE_CHANNEL_NAZI'
m.reply "><}}}*> #{slappee}"
m.reply "#{slappee}: you need take this upstream, $gender."
m.reply "#{slappee}: #{insults.sample}"
sleep(0.5) # let's see if this fixses the broken action order
bot.nick = prev_nick
end
end
bot = Cinch::Bot.new do
configure do |c|
c.server = "irc.example.com"
c.nick = "jstir"
c.channels = ["#gabelstaplerfahrer"]
#c.channels = ["#maw-test"]
c.plugins.plugins = [OpenStack, ChanSlap]
end
# Halibut match -- FIXME -- move this out of here
on :message, /^!halibut (.+)/ do |msg, target|
target = "#{msg.user.nick} :-P" if target == 'jstir'
msg.reply "><}}}*> #{target}"
end
# Let's be sassy if people nick-mention us:
on :message, /^jstir:/ do |msg|
replies = ["Whatever.", "That's nice.", "DIAF", "YOUR FACE", "I don't know.", "The Pope?",
"That's what she said.", "Absolutely. 110%.", "Why do you still work here?"]
msg.reply "#{msg.user.nick}: #{replies.sample}"
end
# Twitter!
on :message, /^!tweet (.+)/ do |prefix, body|
Twit.tweet(body)
end
end
bot.start