Answer the question
In order to leave comments, you need to log in
How can I fix NameError: name 'msg_id' is not defined?
Good day! I have this error:
message_id = msg_id
NameError: name 'msg_id' is not defined
from telethon import TelegramClient
api_id = ''
api_hash = ''
client = TelegramClient('', api_id, api_hash)
client.start()
dlgs = client.iter_dialogs()
for dlg in dlgs:
print(dlg.title)
for dlg in dlgs:
if dlg.title == '':
tegmo = dlg
msgs = client.iter_messages(tegmo, limit=30)
for msg in msgs:
if msg.reply_markup is not None:
Button_inline = msg.reply_markup.rows[0].buttons[0].data #button.data
message_id = msg_id
print(button_data, message_id)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question