Skip to content

Commit

Permalink
Renamed new_chat_participant and left_chat_participant attrs of Message
Browse files Browse the repository at this point in the history
New names for those attributes are new_chat_member and left_chat_member,
because the upstream API changed, and I didn't like those anyway. The
old names are deprecated, but they will keep working until botogram 1.0

Fixes: GH-60
  • Loading branch information
Pietro Albini committed Apr 12, 2016
1 parent 0061dc5 commit 43a9f6f
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 8 deletions.
16 changes: 14 additions & 2 deletions botogram/objects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ def from_(self):
"caption": str,
"contact": Contact,
"location": Location,
"new_chat_participant": User,
"left_chat_participant": User,
"new_chat_member": User,
"left_chat_member": User,
"new_chat_title": str,
"new_chat_photo": Photo,
"delete_chat_photo": bool,
Expand All @@ -345,6 +345,18 @@ def from_(self):
"from": "sender",
}

@property
@utils.deprecated("Message.new_chat_participant", "1.0",
"Rename property to Message.new_chat_member")
def new_chat_participant(self):
return self.new_chat_member

@property
@utils.deprecated("Message.left_chat_participant", "1.0",
"Rename property ot Message.left_chat_member")
def left_chat_participant(self):
return self.left_chat_member


class ReplyKeyboardMarkup(BaseObject):
"""Telegram API representation of a custom keyboard
Expand Down
38 changes: 32 additions & 6 deletions docs/api/telegram.rst
Original file line number Diff line number Diff line change
Expand Up @@ -624,20 +624,28 @@ about its business.

*This attribute can be None if it's not provided by Telegram.*

.. py:attribute:: new_chat_participant
.. py:attribute:: new_chat_member
A :py:class:`~botogram.User` object representing a new participant to a
group chat. This user may be a bot.
A :py:class:`~botogram.User` object representing a new member of a group
chat. This user may be a bot.

*This attribute can be None if it's not provided by Telegram.*

.. py:attribute:: left_chat_participant
.. versionchanged:: 0.3

Before it was called ``new_chat_participant``

.. py:attribute:: left_chat_member
A :py:class:`~botogram.User` object representing a participant in a group
chat that has been removed from the group. This user may be a bot.
A :py:class:`~botogram.User` object representing a member of a group chat
that has been removed from the group. This user may be a bot.

*This attribute can be None if it's not provided by Telegram.*

.. versionchanged:: 0.3

Before it was called ``left_chat_participant``

.. py:attribute:: new_chat_title
The new title of the chat to which this message belongs.
Expand Down Expand Up @@ -693,6 +701,24 @@ about its business.

*This attribute can be None if it's not provided by Telegram.*

.. py:attribute:: new_chat_participant
Old name for the :py:attr:`~botogram.Message.new_chat_member` attribute.
Check out its documentation.

.. deprecated:: 0.3

It will be removed in botogram 1.0

.. py:attribute:: left_chat_participant
Old name for the :py:attr:`~botogram.Message.left_chat_member` attribute.
Check out its documentation.

.. deprecated:: 0.3

It will be removed in botogram 1.0

.. py:method:: forward_to(to[, notify=True])
Forward this message *to* another chat or user by specifying their ID. One
Expand Down
16 changes: 16 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,22 @@ New features
* New decorator :py:meth:`botogram.Bot.chat_unavailable`
* New method :py:meth:`botogram.Component.add_chat_unavailable_hook`

Changes
-------

* Renamed ``Message.new_chat_participant`` to
:py:meth:`botogram.Message.new_chat_member`
* Renamed ``Message.left_chat_participant`` to
:py:meth:`botogram.Message.left_chat_member`

Deprecated features
-------------------

Deprecated features will be removed in botogram 1.0!

* ``Message.new_chat_participant`` is now deprecated
* ``Message.left_chat_participant`` is now deprecated

.. _changelog-0.2.1:

botogram 0.2.1
Expand Down

0 comments on commit 43a9f6f

Please sign in to comment.