C
C
CookieMonster322020-05-21 09:23:59
Python
CookieMonster32, 2020-05-21 09:23:59

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

Here is the source code:
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)

Please help me fix it!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zexer, 2020-05-21
@zexer

You have not declared a msg_id object.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question