fix(telegram): disable link previews by default (#160)
This commit is contained in:
@@ -392,6 +392,7 @@ class HttpBotClient:
|
||||
params["entities"] = entities
|
||||
if parse_mode is not None:
|
||||
params["parse_mode"] = parse_mode
|
||||
params["link_preview_options"] = {"is_disabled": True}
|
||||
if reply_markup is not None:
|
||||
params["reply_markup"] = reply_markup
|
||||
result = await self._post("sendMessage", params)
|
||||
@@ -443,6 +444,7 @@ class HttpBotClient:
|
||||
params["entities"] = entities
|
||||
if parse_mode is not None:
|
||||
params["parse_mode"] = parse_mode
|
||||
params["link_preview_options"] = {"is_disabled": True}
|
||||
if reply_markup is not None:
|
||||
params["reply_markup"] = reply_markup
|
||||
result = await self._post("editMessageText", params)
|
||||
|
||||
@@ -160,12 +160,16 @@ async def test_client_methods_build_params_and_decode() -> None:
|
||||
assert send_call[1]["message_thread_id"] == 3
|
||||
assert send_call[1]["entities"]
|
||||
assert send_call[1]["parse_mode"] == "Markdown"
|
||||
assert send_call[1]["link_preview_options"] == {"is_disabled": True}
|
||||
assert send_call[1]["reply_markup"]
|
||||
|
||||
doc_call = next(call for call in client.calls if call[0] == "sendDocument")
|
||||
assert doc_call[2]["caption"] == "doc"
|
||||
assert doc_call[3]["document"][0] == "file.txt"
|
||||
|
||||
edit_call = next(call for call in client.calls if call[0] == "editMessageText")
|
||||
assert edit_call[1]["link_preview_options"] == {"is_disabled": True}
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_decode_result_invalid_payload_returns_none() -> None:
|
||||
|
||||
Reference in New Issue
Block a user