Telethon
Telethon copied to clipboard
Mistakenly ReplyKeyboardMarkup diagnosis
Code that causes the issue
from telethon.sync import TelegramClient
from telethon.tl.types import KeyboardButtonCopy
with TelegramClient(name, API_ID, API_HASH) as client:
client.send_message('me',client.build_reply_markup(KeyboardButtonCopy('kir','kos')))
Expected behavior
A message with single button row ReplyInlineMarkup mark_up that containt KeyboardButtonCopy.
Actual behavior
TelegramClient.build_reply_markup calls telethon.Button._is_inline and it checks for almost all inline keyboard buttons , except KeyboardButtonCopy.
Traceback
Traceback (most recent call last):
File "<string>", line 4, in __aexec__
File "/home/102thDks/local/lib/python3.13/site-packages/telethon/tl/custom/message.py", line 778, in reply
return await self._client.send_message(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
await self.get_input_chat(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/102thDks/local/lib/python3.13/site-packages/telethon/client/messages.py", line 908, in send_message
result = await self(request)
^^^^^^^^^^^^^^^^^^^
File "/home/102thDks/local/lib/python3.13/site-packages/telethon/client/users.py", line 30, in __call__
return await self._call(self._sender, request, ordered=ordered)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/102thDks/local/lib/python3.13/site-packages/telethon/client/users.py", line 92, in _call
result = await future
^^^^^^^^^^^^
telethon.errors.rpcerrorlist.ButtonTypeInvalidError: The type of one of the buttons you provided is invalid (caused by SendMessageRequest)
Telethon version
1.39.0
Python version
3.13.1
Operating system (including distribution name and version)
Ubunto 23.04
Other details
No response
Checklist
- [x] The error is in the library's code, and not in my own.
- [x] I have searched for this issue before posting it and there isn't an open duplicate.
- [x] I ran
pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zipand triggered the bug in the latest version.
Feel free to send a PR!