-
Notifications
You must be signed in to change notification settings - Fork 2
/
bot.rb
54 lines (42 loc) · 803 Bytes
/
bot.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
require 'rubygems'
require 'twitter'
def phrase
male_conectors = %w(
maracanã
show
shopping
bar
)
female_conectors = %w(
praia
praça
boate
loja
lanchonete
)
male_actions = %w(
fui\ no
estava\ no
fui\ ao
)
female_actions = %w(
fui\ na
fui\ a
fui\ à
estava\ na
)
"#{male_actions[rand(3)]} #{male_conectors[rand(4)]}"
end
def append(twitt, original_user, secound_user)
"RT @#{original_user}: #{twitt}. O que voce acha, @#{secound_user}?"
end
def run_bot
p = phrase
results = Twitter::Search.new("\"#{p}\"").to_a
if results.length > 0
original_user = results.first.from_user
twitt = results[0].text
secound_user = results[1].from_user
end
append(twitt, original_user, secound_user)
end