From 3b416a1e0e4f153bba4d618ce616d4e6dac8908f Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Tue, 30 May 2017 22:42:50 +0300 Subject: [PATCH] Exclude local variables --- aiogram/utils/payload.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aiogram/utils/payload.py b/aiogram/utils/payload.py index 26907971..39af37d3 100644 --- a/aiogram/utils/payload.py +++ b/aiogram/utils/payload.py @@ -4,4 +4,7 @@ DEFAULT_FILTER = ['self'] def generate_payload(exclude=None, **kwargs): if exclude is None: exclude = [] - return {key: value for key, value in kwargs.items() if key not in exclude + DEFAULT_FILTER and value} + return {key: value for key, value in kwargs.items() if + key not in exclude + DEFAULT_FILTER + and value + and not key.startswith('_')}