Official Telethon's chat! Rules: • Speak English • Stay on topic (questions about Telethon) • Be respectful • Don't ask to ask • Spam-related uses lead to ban • Read https://docs.telethon.dev before asking things here Read more about us @TelethonUpdates
client.send_message(chat, "<blockquote>test message</blockquote>", parse_mode="html")Читать полностью…
Is there a way to find out if Ive voted on a poll before?
Is there a method for doing this?
Hi! When a user messages me in private for the first time, is it possible to extract their phone number country (e.g. "🇷🇺 Russian Federation") and account registration date (e.g. "Joined Telegram in June 2022") using Telethon?
Читать полностью…as it turned out it is more profitable to send message in a chat using simple requests lib:
url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage"Читать полностью…
params = {
"chat_id": chat_id,
"text": text,
"parse_mode": "HTML"
}
response = requests.post(url, json=params)
bots only get messages by id. /channel/TelethonChat/606776
Читать полностью…Hi and welcome to the group. Before asking any questions, please read the rules from the group's description, and don't forget to read the docs. Make sure you are using the latest version with pip3 install -U telethon
, since most problems have already been fixed in newer versions.
async def connect(self: TelegramClient, timeout: int = 20) -> None:Читать полностью…
for attempt in range(2):
try:
await asyncio.wait_for(super().connect(), timeout)
return True
except OSError:
return print(f"Connection failed {self._phone}")
except TimeoutError as error:
self._proxy = None
print(f"Connection timeout, retrying in {error.seconds}, {attempt} attempt.")
await asyncio.sleep(error.seconds)
💻 Код:
from telethon.tl.functions.messages import GetPeerSettingsRequest
settings = await client(GetPeerSettingsRequest(6434672004))
s = settings.settings
s.registration_month, s.phone_country
('09.2023', 'PL')Читать полностью…
hallo i have probel with erorr Error a TLObject was expected when i send album ,. this my detail code . please help
Читать полностью…I have to use .start otherwise impossible to pass a token
app = TelegramClient(Читать полностью…
"my_bot",
api_id=api_id,
api_hash=api_hash,
# loop=loop,
).start(bot_token=TELEGRAM_BOT_TOKEN)
like
def main():
await bot.start()
bot.run_until_disconnected()
asyncio.run(main())
or start client inside async def and pass it to asyncio.run
Читать полностью…I never actually received the remaining photos till now
Is me calling client.catch_up messing with something?
Not that the thing works anyways (I still miss updates when offline)
It's intended Telegram design to delay updates. Telethon should already be catching up to missing ones if you successfully received latest gallery item
Читать полностью…📢 Bot Log:
❌ Error in /extract:
Traceback (most recent call last):
File "/home/theonegi/public_html/Helping/telethon/public/yt.py", line 128, in extract_handler
album_messages = await self.client.get_messages(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/theonegi/virtualenv/public_html/Helping/telethon/3.11/lib/python3.11/site-packages/telethon/client/messages.py", line 605, in get_messages
return await it.collect()
^^^^^^^^^^^^^^^^^^
File "/home/theonegi/virtualenv/public_html/Helping/telethon/3.11/lib/python3.11/site-packages/telethon/requestiter.py", line 113, in collect
async for message in self:
File "/home/theonegi/virtualenv/public_html/Helping/telethon/3.11/lib/python3.11/site-packages/telethon/requestiter.py", line 74, in anext
if await self._load_next_chunk():
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/theonegi/virtualenv/public_html/Helping/telethon/3.11/lib/python3.11/site-packages/telethon/client/messages.py", line 184, in _load_next_chunk
r = await self.client(self.request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/theonegi/virtualenv/public_html/Helping/telethon/3.11/lib/python3.11/site-packages/telethon/client/users.py", line 30, in call
return await self._call(self._sender, request, ordered=ordered)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/theonegi/virtualenv/public_html/Helping/telethon/3.11/lib/python3.11/site-packages/telethon/client/users.py", line 92, in _call
result = await future
^^^^^^^^^^^^
telethon.errors.rpcerrorlist.BotMethodInvalidError: The API access for bot users is restricted. The method you tried to invoke cannot be executed as a bot (caused by GetHistoryRequest)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/theonegi/public_html/Helping/telethon/public/yt.py", line 136, in extract_handler
print(f"Error getting album messages: {e}")
OSError: [Errno 5] Input/output error