Those are grouped by your Telegram app. they're all seperate messages
each message will have equal message.grouped_id
Hi guyz, how can I find out the ID of a photo from a received message?
ok I think I found it, photo.id, yes?)
How can I find out the ID of only one photo if there is a random number of them in a message?
what is the difference between dс_id and id
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.
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.
Hello everybody 👋🏻
please tell me how to log into telegram using the telethon.session file
does anyone have instructions?
The cause of this error is most likely using the same session in multiple scripts (or having another older process using the same session file). To fix it you need to use one session file per script (or per client)
Читать полностью…It's still a server issue if it happens in "rust" one too. datacenter of chat versus account can delay implicit updates. pyro event system is more lacking than telethon's, it almost does nothing. other than Get*Difference when min entity is detected.. so it should be a coincidence you can rule out by running that on the chat with telethon at the start of script. if updates are still delayed, it's Telegram thing
Читать полностью…Ask the server, you can logout from both and test with new sessions under same conditions simultaneously
Читать полностью…async def normal_handler(event):Читать полностью…
if event.photo:
print('photo_id', event.photo.id, 'dc_id', event.photo.dc_id, 'gallery_id', event.grouped_id)
wdym? a message can only have one photo/media at a time
dc_id is unimportant, it's server location where media is stored
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.
New StackOverflow question
Telegram login blocked despite correct code - Python Telethon
https://stackoverflow.com/q/77353014
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.
You already have a different TelegramClient instance using that session file as mentioned above, switch to StringSession or avoid that from happening. and Quart may be more appropriate for an async library like telethon
Читать полностью…My code:
from flask import Flask
from flask_socketio import SocketIO, emit
from flask_cors import CORS
from configparser import ConfigParser
from telethon import TelegramClient, events, sync
import pandas as pd
import asyncio
from queue import Queue
app = Flask(__name__)
CORS(app, resources={r"/*": {"origins": "*"}})
socketio = SocketIO(app, cors_allowed_origins="*")
codes_queue = Queue()
def validate_config(config):
required_params = ['api_id', 'api_hash', 'phone_number']
for param in required_params:
if not config['Telegram'].get(param) or config['Telegram'].get(param) == param:
return False
return True
def get_config():
config = ConfigParser()
config.read('config.ini')
return config
def check_is_auth(phone_number, api_id, api_hash):
client = TelegramClient(phone_number, api_id, api_hash)
client.connect()
if not client.is_user_authorized():
socketio.emit("message", {"code_need": True, "data": "Code need"})
@socketio.on('get_config')
def handle_get_config_data():
config = get_config()
if not validate_config(config):
emit('error', {"valid_config": False, 'error': 'Please provide valid values for api_id, api_hash, and phone_number in the config.ini file'}), 400
return
emit('message', {'data': 'Sucsess'})
check_is_auth(config['Telegram']['phone_number'], config['Telegram']['api_id'], config['Telegram']['api_hash'])
if __name__ == '__main__':
loop = asyncio.new_event_loop(socketio.run(app, port=5000, debug=True))
asyncio.set_event_loop(loop)
Exception in thread Thread-17 (_handle_event_internal):
Traceback (most recent call last):
File "/usr/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
File "/usr/lib/python3.11/threading.py", line 982, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3/dist-packages/socketio/server.py", line 731, in _handle_event_internal
r = server._trigger_event(data[0], namespace, sid, *data[1:])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/socketio/server.py", line 756, in _trigger_event
return self.handlers[namespace][event](*args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/flask_socketio/__init__.py", line 282, in _handler
return self._handle_event(handler, message, namespace, sid,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/flask_socketio/__init__.py", line 828, in _handle_event
ret = handler(*args)
^^^^^^^^^^^^^^
File "/home/heso/Desktop/projects/5city/web/server/main.py", line 46, in handle_get_config_data
check_is_auth(config['Telegram']['phone_number'], config['Telegram']['api_id'], config['Telegram']['api_hash'])
File "/home/heso/Desktop/projects/5city/web/server/main.py", line 29, in check_is_auth
client = TelegramClient(phone_number, api_id, api_hash)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/heso/.local/lib/python3.11/site-packages/telethon/client/telegrambaseclient.py", line 308, in __init__
session.set_dc(
File "/home/heso/.local/lib/python3.11/site-packages/telethon/sessions/sqlite.py", line 168, in set_dc
self._update_session_table()
File "/home/heso/.local/lib/python3.11/site-packages/telethon/sessions/sqlite.py", line 194, in _update_session_table
c.execute('delete from sessions')
sqlite3.OperationalError: database is locked
Flask-SocketIO
, and I need to integrate Telethon. However, when I input the basic code to connect to the session, I encounter an error. I found a similar question on Stack Overflow (https://stackoverflow.com/questions/51311383/python-flask-with-telethon), but it did not help me.
Читать полностью…