We have some weirdness and inconsistencies going on with how we use the _message_wrapper in Bot.
Some send_* methods use the @message decorator, others, however, use the _message_wrapper directly. And the way that they use it seems quite frankly, wrong to me. Take send_photo as an example.
url = '{0}/sendPhoto'.format(self.base_url)
data = {'chat_id': chat_id, 'photo': photo}
if caption:
data['caption'] = caption
return self._message_wrapper(
url,
data,
chat_id=chat_id,
photo=photo,
caption=caption,
disable_notification=disable_notification,
reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup,
timeout=timeout,
**kwargs)
To me it seems like at least chat_id, photo, and caption are totally redundant to have as kwargs too, given they are part of the data already.
I propose we figure either use the decorator everywhere (best and cleanest solution in my head) or we scrap it and use the _message_wrapper everywhere (and figure out if we really need all those extra kwargs).
We have some weirdness and inconsistencies going on with how we use the
_message_wrapperinBot.Some
send_*methods use the@messagedecorator, others, however, use the_message_wrapperdirectly. And the way that they use it seems quite frankly, wrong to me. Takesend_photoas an example.To me it seems like at least
chat_id,photo, andcaptionare totally redundant to have as kwargs too, given they are part of the data already.I propose we figure either use the decorator everywhere (best and cleanest solution in my head) or we scrap it and use the
_message_wrappereverywhere (and figure out if we really need all those extra kwargs).