dolfies / discord.py-self

A fork of the popular discord.py for user accounts.
https://discordpy-self.rtfd.io/en/latest/
MIT License
718 stars 165 forks source link

get_build_number list index out of range #616

Closed uniqueuser-repo closed 11 months ago

uniqueuser-repo commented 12 months ago

Summary

When running the bot, I receive list index out of range error. I did not receive this error before today. I was running it fine yesterday (and days before) with no code changes.

Reproduction Steps

  1. Call run() with API key

Code

Traceback (most recent call last):
  File "sniper/sniper.py", line 272, in <module>
    sniperbot.run(SELFBOT_API_KEY)
  File ".local/lib/python3.10/site-packages/discord/client.py", line 1059, in run
    asyncio.run(runner())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File ".local/lib/python3.10/site-packages/discord/client.py", line 1048, in runner
    await self.start(token, reconnect=reconnect)
  File ".local/lib/python3.10/site-packages/discord/client.py", line 978, in start
    await self.login(token)
  File ".local/lib/python3.10/site-packages/discord/client.py", line 820, in login
    data = await state.http.static_login(token.strip())
  File ".local/lib/python3.10/site-packages/discord/http.py", line 1054, in static_login
    data = await self.get_me()
  File ".local/lib/python3.10/site-packages/discord/http.py", line 698, in request
    await self.startup()
  File ".local/lib/python3.10/site-packages/discord/http.py", line 634, in startup
    self.super_properties, self.encoded_super_properties = sp, _ = await utils._get_info(session)
  File ".local/lib/python3.10/site-packages/discord/utils.py", line 1451, in _get_info
    bn = await _get_build_number(session)
  File ".local/lib/python3.10/site-packages/discord/utils.py", line 1480, in _get_build_number
    build_url = 'https://discord.com/assets/' + re.compile(r'assets/+([a-z0-9]+)\.js').findall(login_page)[-2] + '.js'

Expected Results

The bot starts

Actual Results

The bot fails with list index out of range error

System Information

Checklist

Additional Information

No response

0xCope commented 12 months ago

same, started getting it today, without any code changes. Tested on linux and windows. Python 3.10.6 discord.py-self 2.1.0a4814+g4076a3b1 Windows 11

deKhra commented 12 months ago

+1, same error

uniqueuser-repo commented 12 months ago

Not getting the error now. No code changes.

DarlingYoko commented 12 months ago

+1 no code changes, can't login from today ubuntu 22.04 python3.11

woctezuma commented 12 months ago

Fixed by #618.

Zectxr commented 12 months ago

Same issue


    """Fetches client build number"""
    try:
        login_page_request = await session.get('https://discord.com/login', timeout=7)
        login_page = await login_page_request.text()
        build_url = 'https://discord.com/assets/' + re.compile(r'assets/+([a-z0-9]+)\.js').findall(login_page)[-2] + '.js'
        build_request = await session.get(build_url, timeout=7)
        build_file = await build_request.text()
        # Check for 'buildNumber' format
        build_index = build_file.find('buildNumber') + 24
        build_number_str = build_file[build_index : build_index + 6]

        if build_number_str.isnumeric():
            return int(build_number_str)
        else:
            # Check for 'Build Number' format
            build_index = build_file.find('Build Number') + 25
            build_number_str = build_file[build_index : build_index + 6]

            if build_number_str.isnumeric():
                return int(build_number_str)
            else:
                # Handle the case where neither format contains a valid integer
                _log.warning('Client build number is not a valid integer.')
                return 9999  # Return a default value```
TutlaMC commented 11 months ago

i like how bro was making a nitro sniper

AkamePro commented 11 months ago

Aún no resuelven el error?

dolfies commented 11 months ago

Duplicate of #619