-
Notifications
You must be signed in to change notification settings - Fork 2
/
common.py
79 lines (63 loc) · 1.81 KB
/
common.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
VERSION_YEAR = 2019
VERSION_MONTH = 8
VERSION_DAY = 3
VERSION_REV = 0
whos_in = None
twitter = None
users = {}
twilio_client = None
ARGS = {}
smmry_api_key = None
pubg_api_key = None
pubg_api = None
# Variable hold trumps last tweet id
last_id = 0
trump_chance_roll_rdy = False
# Runtime stats
duels_conducted = 0
items_awarded = 0
trump_tweets_seen = 0
missed_trumps = 0
first = True
# Shot_duel acceptance and active
accepted = False
shot_duel_running = False
vict_name = ""
# News handles to pull from
news_handles = ['mashable', 'cnnbrk', 'whitehouse', 'cnn', 'nytimes',
'foxnews', 'reuters', 'npr', 'usatoday', 'cbsnews',
'abc', 'washingtonpost', 'msnbc', 'ap', 'aphealthscience',
'lifehacker', 'cnnnewsroom', 'theonion']
# Delays for Newsfeed and Check_trump, These are in minutes
# remember that news_del is fuzzed + (0-10)
trump_del = 25
news_del = 55
# Location of db.json and tokens.config
data_dir = "/data"
# Create/Load Local Database
db_file = '{}/db.json'.format(data_dir)
db = {}
# Global toggle for news feed
NEWS_FEED_ON = False
NEWS_FEED_CREATED = False
async def trigger_social(ctx):
"""Triggers a social """
for m in ctx.bot.get_all_members():
if m.display_name != 'brochat-bot' and m.status == 'online':
add_drink(m.display_name)
glass = ":tumbler_glass:"
await ctx.bot.say("Ah shit that's three in a row! ITS A SOCIAL! SHOTS! "
"SHOTS! SHOTS!\n{}{}{}".format(glass, glass, glass))
def add_drink(user):
"""
Adds a drink for the user.
:param user: users display name
:return:
"""
if user not in users:
users[user] = {}
if "drinks_owed" in users[user]:
users[user]['drinks_owed'] += 1
else:
users[user]['drinks_owed'] = 1
return users[user]['drinks_owed']