Prevent double keyword argument in async_wrapper

This commit is contained in:
Davte 2020-02-16 13:40:45 +01:00
parent 23b04d6207
commit ceef3103f4
2 changed files with 5 additions and 2 deletions

View File

@ -14,7 +14,7 @@ __author__ = "Davide Testa"
__email__ = "davide@davte.it" __email__ = "davide@davte.it"
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"] __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
__license__ = "GNU General Public License v3.0" __license__ = "GNU General Public License v3.0"
__version__ = "2.3.29" __version__ = "2.3.30"
__maintainer__ = "Davide Testa" __maintainer__ = "Davide Testa"
__contact__ = "t.me/davte" __contact__ = "t.me/davte"

View File

@ -469,6 +469,9 @@ async def async_wrapper(coroutine, *args1, **kwargs1):
async def wrapped_coroutine(*args2, bot=None, update=None, user_record=None, **kwargs2): async def wrapped_coroutine(*args2, bot=None, update=None, user_record=None, **kwargs2):
# Update keyword arguments # Update keyword arguments
kwargs1.update(kwargs2) kwargs1.update(kwargs2)
kwargs1['bot'] = bot
kwargs1['update'] = update
kwargs1['user_record'] = user_record
# Pass only supported arguments # Pass only supported arguments
kwargs = { kwargs = {
name: argument name: argument
@ -477,7 +480,7 @@ async def async_wrapper(coroutine, *args1, **kwargs1):
coroutine coroutine
).parameters ).parameters
} }
return await coroutine(*args1, *args2, bot=bot, update=update, user_record=user_record, **kwargs) return await coroutine(*args1, *args2, **kwargs)
return wrapped_coroutine return wrapped_coroutine