Skip to content

Consider making chat_id a positional argument in chat.send_message and similar to avoid error messages when not using kwargs #1048

@xates

Description

@xates

When doing chat.send_message("Hello") the following error occurs:

TypeError: send_message() got multiple values for keyword argument 'chat_id'

This can be solved by providing each argument through its keyword (like that: chat.send_message(text="Hello")), however this is not very convenient.

By replacing keyword argument chat_id=self.id with positional argument self.id (it is the first argument in of the bot.send_message method) in the Chat class, you can avoid to be forced to always use kwargs when calling this method.

The same thing happens for the other shortcut methods (send_photo, send_audio, ...) and for the corresponding methods of the User class.

return self.bot.send_message(chat_id=self.id, *args, **kwargs)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions