|
@@ -134,19 +134,24 @@ def post_to_rocketchat(hook, avatar, ynab):
|
|
|
|
|
|
post_data = {
|
|
|
"alias": "YNAB",
|
|
|
- "text": 'YNAB report for week of %s (from %s)' % (today.strftime('%Y-%W'), week_ago.strftime('%a %Y-%m-%d')),
|
|
|
+ "text": 'Report for week of %s (from %s)' % (today.strftime('%Y-%W'), week_ago.strftime('%a %Y-%m-%d')),
|
|
|
"attachments": [
|
|
|
],
|
|
|
}
|
|
|
if avatar:
|
|
|
post_data['avatar'] = avatar
|
|
|
|
|
|
+ fields = []
|
|
|
for spending in ynab:
|
|
|
spending_name, spending_amount = spending
|
|
|
- post_data['attachments'].append({
|
|
|
+ fields.append({
|
|
|
"title": spending_name,
|
|
|
- "text": spending_amount,
|
|
|
+ "value": spending_amount,
|
|
|
})
|
|
|
+ post_data['attachments'] = [{
|
|
|
+ 'title': 'Top 10 categories spent',
|
|
|
+ 'fields': fields,
|
|
|
+ }]
|
|
|
|
|
|
result = requests.post(
|
|
|
hook,
|