Skip to content

Commit

Permalink
Add optional direct links to Untappd app
Browse files Browse the repository at this point in the history
  • Loading branch information
decibyte committed Oct 3, 2020
1 parent e88036b commit b640ac7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
9 changes: 7 additions & 2 deletions slappd/__main__.py
Expand Up @@ -197,8 +197,13 @@ def main():
text=badge['badge_description'])

# Render the message from a Jinja2 template
text += tmpl.render(checkin=checkin,
untappd_domain='https://untappd.com')
text += tmpl.render(
checkin=checkin,
untappd_domain='https://untappd.com',
display_app_links=CONFIG['untappd'].getboolean(
'display_app_links'
),
)

# Use the beer label as an icon if it exists
if checkin['beer']['beer_label']:
Expand Down
1 change: 1 addition & 0 deletions slappd/templates/app-links.j2
@@ -0,0 +1 @@
<untappd://user/{{ checkin.user.user_name }}|:adult:> <untappd://beer/{{ checkin.beer.bid }}|:beer:> <untappd://brewery/{{ checkin.brewery.brewery_id }}|:factory:> {% if checkin.venue %}<untappd://venue/{{ checkin.venue.venue_id }}|:round_pushpin:>{% endif %}
3 changes: 2 additions & 1 deletion slappd/templates/check-in.j2
Expand Up @@ -5,5 +5,6 @@
{%- if checkin.venue %} at *<{{ untappd_domain }}/v/{{ checkin.venue.venue_slug
}}/{{ checkin.venue.venue_id }}|{{ checkin.venue.venue_name | safe }}>*{% endif -%}
{%- if checkin.rating_score %} ({{ checkin.rating_score }}/5){% endif %}
{%- if display_app_links %} – open in app: <untappd://user/{{ checkin.user.user_name }}|:adult:> <untappd://beer/{{ checkin.beer.bid }}|:beer:> <untappd://brewery/{{ checkin.brewery.brewery_id }}|:factory:> {% if checkin.venue %}<untappd://venue/{{ checkin.venue.venue_id }}|:round_pushpin:>{% endif %}{% endif %}
{% if checkin.checkin_comment %}> "{{ checkin.checkin_comment }}"
{% endif %}
{% endif %}
1 change: 1 addition & 0 deletions slappd/templates/config.j2
Expand Up @@ -21,6 +21,7 @@ users = foo,bar,baz
lastseen = 0
display_media = true
display_badges = true
display_app_links = false

[slack]
token = TXXXXXXXX/BXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX

0 comments on commit b640ac7

Please sign in to comment.