Skip to content

Commit 7d30205

Browse files
author
Pietro Albini
committed
Discontinue the "not_contacted" unavailable chat reason
I discovered it's not possible to detect it anymore, so it's better to remove it from the documentation. Fixes: GH-73
1 parent 6ead995 commit 7d30205

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

botogram/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def call(self, method, params=None, files=None, expect=None):
109109
elif status == 400 and "PEER_ID_INVALID" in message:
110110
# Error code # 400
111111
# PEER_ID_INVALID
112-
reason = "not_contacted"
112+
reason = "not_found"
113113

114114
# This happens when the bot can't contact the user or the user
115115
# doesn't exist

docs/changelog/0.3.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@ botogram 0.3.3
1818
(`issue 71`_)
1919
* Fix broken detection of unavailable chats, due to changes in the Bot API
2020
(`issue 72`_)
21+
* Discontinue the unavailable chat reason **not_contacted** since it's not
22+
possible to detect it anymore (`issue 73`_)
2123

2224
.. _issue 71: https://github.com/pietroalbini/botogram/issues/71
2325
.. _issue 72: https://github.com/pietroalbini/botogram/issues/72
26+
.. _issue 73: https://github.com/pietroalbini/botogram/issues/73
2427

2528
.. _changelog-0.3.2:
2629

docs/unavailable-chats.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ Here there is a list of the current reasons why a chat isn't available:
3030
* **account_deleted**: the user deleted his account, so you won't be able to
3131
send messages to him anymore.
3232

33-
* **not_contacted**: the user hasn't contacted your bot directly yet. If the
34-
user is in a group chat try to tell him to start your bot!
35-
3633
* **chat_moved**: the chat was moved to a new ID. This currently happens if the
3734
group was converted into a supergroup.
3835

tests/test_api.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,13 @@ def test_unavailable_chats(api, mock_req):
119119
assert e.value.chat_id == 123
120120
assert e.value.reason == "kicked"
121121

122-
# Test a failed request with matching error code and description to an user
123-
# which hasn't contacted your bot yet
122+
# Test a failed request with matching error code and description, and in
123+
# which Telegram failed to determine the reason why the user can't be
124+
# contacted
124125
with pytest.raises(botogram.api.ChatUnavailableError) as e:
125126
api.call("sendLocation", {"chat_id": 123})
126127
assert e.value.chat_id == 123
127-
assert e.value.reason == "not_contacted"
128+
assert e.value.reason == "not_found"
128129

129130
# Test a failed request with matching error code and description to an user
130131
# which deleted its account

0 commit comments

Comments
 (0)