0

it keeps on awaiting for a username or link in every message I send.

@dp.message_handler(commands="posts")
async def cmd_stat(message: types.Message):
  await message.answer("Input a username or else send profile link")

  @dp.message_handler()
  async def get_username(message: types.Message):
    get_username = message.text
    username = get_username.replace(URL, '').replace('/', '')
    print(username)
    profile = L.check_profile_id(username)
    await message.answer("User found, please wait... ⏳", disable_notification=True)
    
    profile = L.check_profile_id(username)
    L.download_profile(profile)
    dirname = str(username)
 
    print('path: ', dirname)
    await asyncio.sleep(1)
    media = types.MediaGroup()
    await types.ChatActions.upload_photo()
    os.chdir(dirname)

idk if maybe there's a way to make a command to stop it

I tried if else but did not went well, I'm new to this.

CallMeStag
  • 5,467
  • 1
  • 7
  • 22
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Friedrich May 25 '23 at 12:20
  • please only use the tags of libraries that are used in your code. – CallMeStag May 25 '23 at 17:23
  • Maybe the problem is that there are extra tabs and get_username is inner function of cmd_stat Also change the name of the variable here get_username = message.text because the get_username is name of the function – progerg May 27 '23 at 09:36

0 Answers0