mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-08 07:38:26 -05:00
fixed telegram bot
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import json
|
import json
|
||||||
|
import traceback
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
@@ -52,10 +53,10 @@ def hook(request, token):
|
|||||||
f = ingredient_parser.get_food(food)
|
f = ingredient_parser.get_food(food)
|
||||||
u = ingredient_parser.get_unit(unit)
|
u = ingredient_parser.get_unit(unit)
|
||||||
|
|
||||||
ShoppingListEntry.objects.create(food=f, unit=u, amount=amount, original_text=ingredient, created_by=request.user, space=request.space)
|
ShoppingListEntry.objects.create(food=f, unit=u, amount=amount, original_text=data['message']['text'], created_by=request.user, space=request.space)
|
||||||
|
|
||||||
return JsonResponse({'data': data['message']['text']})
|
return JsonResponse({'data': data['message']['text']})
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
traceback.print_exc()
|
||||||
|
|
||||||
return JsonResponse({})
|
return JsonResponse({})
|
||||||
|
|||||||
Reference in New Issue
Block a user