-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdispatchers.py
37 lines (21 loc) · 1.09 KB
/
dispatchers.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
from fetchers import steam_category_offers_fetcher, steam_app_details_fetcher
from formatters import format_embed_offers_msg, format_app_details
def steam_offers_dispatcher(action_type, payload):
if action_type == 'SEND_SPECIALS':
country_code = payload.get('alpha2_code')
specials = steam_category_offers_fetcher('specials', country_code)
embed_msg = format_embed_offers_msg(
'Special Offers', f'Special Offers on Steam {country_code}', specials)
return embed_msg
if action_type == 'SEND_TOP_SELLERS':
country_code = payload.get('alpha2_code')
specials = steam_category_offers_fetcher('top_sellers', country_code)
embed_msg = format_embed_offers_msg(
'Top Sellers', f'Top Sellers on Steam {country_code}', specials)
return embed_msg
if action_type == 'SEND_APP_DETAILS':
app_id = payload.get('app_id')
country_code = payload.get('alpha2_code')
app_data = steam_app_details_fetcher(app_id, country_code)
embed_msg = format_app_details(app_data)
return embed_msg