-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgreenlight.rb
More file actions
81 lines (60 loc) · 1.93 KB
/
greenlight.rb
File metadata and controls
81 lines (60 loc) · 1.93 KB
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
#!/usr/bin/env ruby
# Twitter bot to generate descriptions of cliched games on Steam
# Greenlight and tweet those descriptions
require 'Twitter'
Twitter.configure do |config|
config.consumer_key = YOUR_CONSUMER_KEY
config.consumer_secret = YOUR_CONSUMER_SECRET
config.oauth_token = YOUR_OAUTH_TOKEN
config.oauth_token_secret = YOUR_OAUTH_TOKEN_SECRET
end
business_model = "crowd-funded"
game_cliche1 = "survival"
game_cliche2 = "zombie"
game_genre = "FPS"
#This gets a game cliche from a list of cliches in a text file
def get_game_cliche
#initialize variable
chosen_line = nil
#Get the cliche
File.foreach("game_cliches.txt").each_with_index do |line, number|
chosen_line = line if rand < 1.0/(number+1)
end
return chosen_line.chomp
end
#This gets a business model from a list in a text file
def get_business_model
#initialize variable
chosen_line = nil
#Get the cliche
File.foreach("business_models.txt").each_with_index do |line, number|
chosen_line = line if rand < 1.0/(number+1)
end
return chosen_line.chomp
end
#This gets a game genre from a list in a text file
def get_game_genre
#initialize variable
chosen_line = nil
#Get the cliche
File.foreach("game_genres.txt").each_with_index do |line, number|
chosen_line = line if rand < 1.0/(number+1)
end
return chosen_line.chomp
end
#Get the cliches
game_cliche1 = get_game_cliche
game_cliche2 = get_game_cliche
#Make sure they're different!
while game_cliche1 == game_cliche2 do
game_cliche2 = get_game_cliche
end
#Get business model and genre
business_model = get_business_model
game_genre = get_game_genre
#Compose the tweet
composed_tweet = "Vote for our #{business_model} #{game_cliche1} #{game_cliche2} #{game_genre} on Steam Greenlight!"
#Output to console for testing
puts composed_tweet
#Output to Twitter
Twitter.update(composed_tweet)