Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions botogram/objects/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,20 @@ def send_album(self, album=None, reply_to=None, notify=True):
return albums.send()
return albums

@_require_api
def set_title(self, title):
"""Set a new chat title"""
if type(title) is not str or len(title) > 255 or len(title) < 1:
raise ValueError(
"The new chat title must be a string between" +
" 1 and 255 characters long"
)
else:
return self._api.call("setChatTitle", {
"chat_id": self.id,
"title": title
})


class MessageMixin:
"""Add some methods for messages"""
Expand Down
10 changes: 10 additions & 0 deletions docs/api/telegram.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,16 @@ about its business.

.. versionadded:: 0.6

.. py:method:: set_title(title)

Set a new chat title.

The bot must be an administrator with the correct rights for this method to work.

:param str title: The new chat title, must be between 1 and 255 characters long

.. versionadded:: 0.7

.. py:class:: botogram.ParsedText

This class contains the parsed representation of the text of a received
Expand Down
3 changes: 3 additions & 0 deletions docs/changelog/0.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ New features
* New method :py:meth:`~Message.edit_live_location`
* New method :py:meth:`~Message.stop_live_location`

* Added support for editing the chat title

* New method :py:meth:`~Chat.set_title`

Bug fixes
---------