dolfies / discord.py-self

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

Brotli required when it shouldn't be #275

Closed Sunlightcoder closed 2 years ago

Sunlightcoder commented 2 years ago

Summary

selfbot is not runing

Reproduction Steps

So first at all i copied rep, then opened an example folder, entered my token to "reply.py" and ran it. Error code is given bellow. it happens to all .py files, in examples folder and wrote by myself too.

Code

reply.py code you have in repo,so i  will post here traceback:
Traceback (most recent call last):
  File "C:\Users\User\ki\discord.py-self\examples\reply.py", line 19, in <module>
    client.run('mytoken')
  File "C:\Python310\lib\site-packages\discord\client.py", line 715, in run
    asyncio.run(runner())
  File "C:\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete
    return future.result()
  File "C:\Python310\lib\site-packages\discord\client.py", line 712, in runner
    await self.start(*args, **kwargs)
  File "C:\Python310\lib\site-packages\discord\client.py", line 685, in start
    await self.login(token)
  File "C:\Python310\lib\site-packages\discord\client.py", line 553, in login
    data = await state.http.static_login(token.strip())
  File "C:\Python310\lib\site-packages\discord\http.py", line 650, in static_login
    await self.startup()
  File "C:\Python310\lib\site-packages\discord\http.py", line 372, in startup
    self.user_agent, self.browser_version, self.client_build_number = ua, bv, bn = await utils._get_info(session)
  File "C:\Python310\lib\site-packages\discord\utils.py", line 1242, in _get_info
    bn = await _get_build_number(session)
  File "C:\Python310\lib\site-packages\discord\utils.py", line 1251, in _get_build_number
    login_page = await login_page_request.text()
  File "C:\Python310\lib\site-packages\aiohttp\client_reqrep.py", line 1076, in text
    await self.read()
  File "C:\Python310\lib\site-packages\aiohttp\client_reqrep.py", line 1032, in read
    self._body = await self.content.read()
  File "C:\Python310\lib\site-packages\aiohttp\streams.py", line 344, in read
    raise self._exception
aiohttp.client_exceptions.ClientPayloadError: 400, message='Can not decode content-encoding: br'
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000258DF0B6320>
Traceback (most recent call last):
  File "C:\Python310\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "C:\Python310\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "C:\Python310\lib\asyncio\base_events.py", line 750, in call_soon
    self._check_closed()
  File "C:\Python310\lib\asyncio\base_events.py", line 515, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is close

Expected Results

working bot

Actual Results

not working bot

System Information

Checklist

Additional Information

I see that issue form for first time. sorry if filled it wrong)

dolfies commented 2 years ago

Weird aiohttp bug, install brotli.

TheOnlyWayUp commented 2 years ago

Weird aiohttp bug, install brotli.

@dolfies could we bump the aiohttp req from 3.6 to 3.8? https://github.com/aio-libs/aiohttp/issues/6705

dolfies commented 2 years ago

Oh did you open an issue?

I had to mess with the internals to get br to send in the headers at all so they probably don't support this lmao

TheOnlyWayUp commented 2 years ago

Oh did you open an issue?

I had to mess with the internals to get br to send in the headers at all so they probably don't support this lmao

:skull:

Updating aiohttp seemed to work to solve this issue in most cases, aiohttp 3.8 should have proper brotli support by now

TheOnlyWayUp commented 2 years ago

@machinexa2 Consider putting all your comments into one comment, makes it cleaner and can prevent repetition. Also improves the cohesiveness of whatever you're trying to say

One big comment is easier to read and quote than 10 one liners :)