Skip to content

Commit

Permalink
added if early raise method (refactor)
Browse files Browse the repository at this point in the history
  • Loading branch information
alimaktabi committed Oct 17, 2024
1 parent fbe32de commit e27abcd
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions telegram/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,14 @@ def telebot_respond(request):
):
raise PermissionDenied("Invalid secret token")

if request.META["CONTENT_TYPE"] == "application/json":
json_data = request.body.decode("utf-8")
update = telebot.types.Update.de_json(json_data)
telebot_instance.process_new_updates([update])
return HttpResponse("")

else:
if request.META["CONTENT_TYPE"] != "application/json":
raise PermissionDenied

json_data = request.body.decode("utf-8")
update = telebot.types.Update.de_json(json_data)
telebot_instance.process_new_updates([update])
return HttpResponse("")


welcome_text = """*Welcome to Unitap!* 🎉
Expand Down

0 comments on commit e27abcd

Please sign in to comment.