-
Notifications
You must be signed in to change notification settings - Fork 1
/
bot.py
executable file
·166 lines (153 loc) · 3.88 KB
/
bot.py
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#!/usr/bin/env python
# encoding: utf-8
import requests
import tweepy
import secrets
import random
counts = [
'Double',
'Triple',
'Quadruple',
]
adjectives = [
'Beefy',
'Cheesy',
'Spicy',
'Fiery',
'Crunchy',
'Crispy',
'Loaded',
'Grilled',
'Smothered',
'Stuft',
'Cantina',
]
fillers = [
'Potato',
'Nacho Cheese',
'Bean',
'Black Bean',
'Seasoned Rice',
'Ground Beef',
'Shredded Chicken',
'Chicken',
'Steak',
'Fajitas',
u'Fritos®',
u'Doritos® Locos',
u'Fiery Doritos® Locos',
u'Cool Ranch® Doritos® Locos',
u'Nacho Cheese Doritos® Locos',
]
meal_modifiers = [
'Fiesta',
'Fresco',
'Fresco Grilled',
'Lava',
]
meals = [
'Taco',
'Soft Taco',
u'Double Decker® Taco',
'Taco Salad',
'Burrito',
'Gordita',
'Chalupa',
'Triplelupa', # https://www.tacobell.com/food/specialties/triplelupa
'Crunchwrap',
'Quesadilla',
'Griller',
'Mexican Pizza',
'Quesarito',
'Crunchwrap Slider',
'Tostada',
u'Meximelt®',
'XXL Grilled Stuft Burrito',
'Smothered Burrito',
'Combo Burrito',
'5-Layer Burrito',
'7-Layer Burrito',
'Nachos',
u'Nachos Bellgrande®',
u'Doritos® Locos Taco',
u'Doritos® Locos Gordita',
u'Doritos® Locos Chalupa',
u'Doritos® Locos Nachos',
'Waffle Taco',
'Enchirito',
'Roll-Up',
'Power Bowl',
]
modifiers = [
'Crunch',
u'Supreme®',
'Party Pack',
]
meats = [
'Nacho Cheese',
'Quesarito',
'Quesadilla',
'Griller',
'Mexican Pizza',
'Beef'
'Beefy'
'Ground Beef',
'Shredded Chicken',
'Chicken',
'Steak',
'Fajitas',
]
def get_next_phrase(phrases, skips=None, randomness=0.5, vegan=False):
trues = int(randomness * 100)
falses = int(100 - trues)
chance = [True] * trues + [False] * falses
if not random.choice(chance):
return []
if not skips:
skips = []
for _ in range(len(phrases)):
word = random.choice(phrases)
skip = False
for s in skips:
if s in word:
skip = True
if vegan:
if s in meats:
skip = True
if not skip:
break
return [word]
def generate_taco_bell(vegan=False):
food = get_next_phrase(counts, randomness=.1, vegan=vegan)
food += get_next_phrase(adjectives, skips=food, randomness=.85, vegan=vegan)
food += get_next_phrase(fillers, skips=food, randomness=.75, vegan=vegan)
food += get_next_phrase(meal_modifiers, skips=food, randomness=.1, vegan=vegan)
food += get_next_phrase(meals, skips=food, randomness=1.0, vegan=vegan)
food += get_next_phrase(modifiers, skips=food, randomness=.25, vegan=vegan)
return ' '.join(food)
def tacobellitem():
drinks = ["Mtn Dew Baja Blast"]
items = []
for _ in range(random.randint(1, 3)):
items.append(generate_taco_bell())
if len(items) <= 2 and random.randint(1, 11) == 1:
items.append(random.choice(drinks))
if len(items) > 1:
saying = ", a ".join(items[:-1]) + ", and a " + items[-1]
else:
saying = items[0]
return u"You should get a {}.".format(saying)
def tweet(message):
auth = tweepy.OAuthHandler(secrets.consumer_key, secrets.consumer_secret)
auth.set_access_token(secrets.access_token, secrets.access_token_secret)
api = tweepy.API(auth)
auth.secure = True
search_phrases = ["\"I'm so high\"", "\"so high rn\"", "\"high af\"", "\"so blazed\""]
if random.randint(1, 5) == 1:
phrase = random.choice(search_phrases)
taco_recipient = api.search(q=phrase, rpp=1, count=1)[0]
retweet_url = " https://twitter.com/" + taco_recipient.user.screen_name + "/status/" + str(taco_recipient.id)
message += retweet_url
print("Posting message {}".format(message))
api.update_status(status=message)
tweet(tacobellitem())