Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'ack' #5800

Closed
SamSanai opened this issue Sep 8, 2020 · 1 comment
Closed

AttributeError: 'NoneType' object has no attribute 'ack' #5800

SamSanai opened this issue Sep 8, 2020 · 1 comment
Labels
bug This is a bug with the library.
Milestone

Comments

@SamSanai
Copy link

SamSanai commented Sep 8, 2020

Summary

At random times every other day I get this error and it just shuts down one of my clusters having to restart it. Only started happening a week maybe 2 ago.

Reproduction Steps

Happens while the bot is running no idea how to reproduce it.

Expected Results

Bot running as usual without an issue.

Actual Results

Traceback:

2020-09-08 09:18:22   -   ready to go...

Traceback (most recent call last):
  File "voicemaster.py", line 264, in <module>
    bot.run(bot_token)
  File "/usr/local/lib/python3.6/dist-packages/discord/client.py", line 678, in run
    return future.result()
  File "/usr/local/lib/python3.6/dist-packages/discord/client.py", line 658, in runner
    await self.start(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/discord/client.py", line 622, in start
    await self.connect(reconnect=reconnect)
  File "/usr/local/lib/python3.6/dist-packages/discord/shard.py", line 414, in connect
    raise item.error
  File "/usr/local/lib/python3.6/dist-packages/discord/shard.py", line 140, in worker
    await self.ws.poll_event()
  File "/usr/local/lib/python3.6/dist-packages/discord/gateway.py", line 504, in poll_event
    await self.received_message(msg.data)
  File "/usr/local/lib/python3.6/dist-packages/discord/gateway.py", line 401, in received_message
    self._keep_alive.ack()
AttributeError: 'NoneType' object has no attribute 'ack'
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f88a6110828>

logging.INFO logs:

2020-09-08 09:15:16,922:WARNING:discord.client: PyNaCl is not installed, voice will NOT be supported
2020-09-08 09:15:16,978:INFO:discord.client: logging in using static token
2020-09-08 09:15:17,161:INFO:discord.gateway: Shard ID 20 has sent the IDENTIFY payload.
2020-09-08 09:15:19,908:INFO:discord.gateway: Shard ID 20 has connected to Gateway: ["gateway-prd-main-2j63",{"micros":2706904,"calls":["discord-sessions-prd-2-8",{"micros":2698737,"calls":["start_session",{"micros":312750,"calls":["api-prd-main-h0tw",{"micros":309532,"calls":["get_user",{"micros":2331},"add_authorized_ip",{"micros":1428},"get_guilds",{"micros":274016},"coros_wait",{"micros":1}]}]},"guilds_connect",{"micros":247,"calls":[]},"presence_connect",{"micros":2,"calls":[]}]}]}] (Session ID: f24b951795256219ffd2ff261f316e58).
2020-09-08 09:15:22,497:INFO:discord.gateway: Shard ID 21 has sent the IDENTIFY payload.
2020-09-08 09:15:25,932:INFO:discord.gateway: Shard ID 21 has connected to Gateway: ["gateway-prd-main-1m02",{"micros":3052390,"calls":["discord-sessions-prd-2-37",{"micros":3045827,"calls":["start_session",{"micros":330474,"calls":["api-prd-main-6vkw",{"micros":327521,"calls":["get_user",{"micros":3166},"add_authorized_ip",{"micros":3395},"get_guilds",{"micros":289982},"coros_wait",{"micros":2}]}]},"guilds_connect",{"micros":316,"calls":[]},"presence_connect",{"micros":2,"calls":[]}]}]}] (Session ID: 5c2a13dee95a5e8806c5851fe4304a46).
2020-09-08 09:15:29,782:INFO:discord.gateway: Shard ID 22 has sent the IDENTIFY payload.
2020-09-08 09:15:32,499:INFO:discord.gateway: Shard ID 22 has connected to Gateway: ["gateway-prd-main-s26j",{"micros":2411567,"calls":["discord-sessions-prd-2-14",{"micros":2410148,"calls":["start_session",{"micros":344898,"calls":["api-prd-main-2zjb",{"micros":341073,"calls":["get_user",{"micros":4378},"add_authorized_ip",{"micros":1150},"get_guilds",{"micros":301009},"coros_wait",{"micros":1}]}]},"guilds_connect",{"micros":327,"calls":[]},"presence_connect",{"micros":1,"calls":[]}]}]}] (Session ID: 847f17168c4fed7002bfb2ee090ce6d5).
2020-09-08 09:15:38,889:INFO:discord.gateway: Shard ID 23 has sent the IDENTIFY payload.
2020-09-08 09:15:41,996:INFO:discord.gateway: Shard ID 23 has connected to Gateway: ["gateway-prd-main-03dm",{"micros":2696066,"calls":["discord-sessions-prd-2-64",{"micros":2693648,"calls":["start_session",{"micros":364325,"calls":["api-prd-main-p2gv",{"micros":360985,"calls":["get_user",{"micros":2164},"add_authorized_ip",{"micros":1576},"get_guilds",{"micros":302213},"coros_wait",{"micros":2}]}]},"guilds_connect",{"micros":294,"calls":[]},"presence_connect",{"micros":1,"calls":[]}]}]}] (Session ID: 312d352583211747b4ab9b5f368f6f16).
2020-09-08 09:15:49,855:INFO:discord.gateway: Shard ID 24 has sent the IDENTIFY payload.
2020-09-08 09:15:53,051:INFO:discord.gateway: Shard ID 24 has connected to Gateway: ["gateway-prd-main-tm2c",{"micros":2780324,"calls":["discord-sessions-prd-2-55",{"micros":2778892,"calls":["start_session",{"micros":702783,"calls":["api-prd-main-wt4c",{"micros":362976,"calls":["get_user",{"micros":9065},"add_authorized_ip",{"micros":3078},"get_guilds",{"micros":285071},"coros_wait",{"micros":2}]}]},"guilds_connect",{"micros":334,"calls":[]},"presence_connect",{"micros":2,"calls":[]}]}]}] (Session ID: 9ca5f871f05ff3f3e13a37c03838f3ae).
2020-09-08 09:16:02,620:INFO:discord.gateway: Shard ID 25 has sent the IDENTIFY payload.
2020-09-08 09:16:10,111:INFO:discord.gateway: Shard ID 25 has connected to Gateway: ["gateway-prd-main-z971",{"micros":2477527,"calls":["discord-sessions-prd-2-30",{"micros":2471539,"calls":["start_session",{"micros":389085,"calls":["api-prd-main-pt6w",{"micros":383349,"calls":["get_user",{"micros":7201},"add_authorized_ip",{"micros":1152},"get_guilds",{"micros":323830},"coros_wait",{"micros":1}]}]},"guilds_connect",{"micros":367,"calls":[]},"presence_connect",{"micros":2,"calls":[]}]}]}] (Session ID: 655f3edcde8af9dd334f89ff94b79290).
2020-09-08 09:16:23,644:INFO:discord.gateway: Shard ID 26 has sent the IDENTIFY payload.
2020-09-08 09:16:27,988:INFO:discord.gateway: Shard ID 26 has connected to Gateway: ["gateway-prd-main-lnn3",{"micros":3144030,"calls":["discord-sessions-prd-2-83",{"micros":3117874,"calls":["start_session",{"micros":363126,"calls":["api-prd-main-cw38",{"micros":358212,"calls":["get_user",{"micros":4005},"add_authorized_ip",{"micros":2811},"get_guilds",{"micros":300032},"coros_wait",{"micros":1}]}]},"guilds_connect",{"micros":290,"calls":[]},"presence_connect",{"micros":1,"calls":[]}]}]}] (Session ID: 2bec50d228c730b3be390b4d57d4faa5).
2020-09-08 09:16:30,951:WARNING:discord.gateway: Can't keep up, shard ID 21 websocket is 31.9s behind.
2020-09-08 09:16:35,969:WARNING:discord.gateway: Can't keep up, shard ID 22 websocket is 23.7s behind.
2020-09-08 09:16:47,269:INFO:discord.gateway: Shard ID 27 has sent the IDENTIFY payload.
2020-09-08 09:16:48,628:WARNING:discord.gateway: Can't keep up, shard ID 27 websocket is 11.5s behind.
2020-09-08 09:16:51,405:INFO:discord.gateway: Shard ID 27 has connected to Gateway: ["gateway-prd-main-kb8w",{"micros":2946426,"calls":["discord-sessions-prd-2-90",{"micros":2944703,"calls":["start_session",{"micros":348158,"calls":["api-prd-main-txfb",{"micros":344844,"calls":["get_user",{"micros":2055},"add_authorized_ip",{"micros":1363},"get_guilds",{"micros":306547},"coros_wait",{"micros":2}]}]},"guilds_connect",{"micros":321,"calls":[]},"presence_connect",{"micros":1,"calls":[]}]}]}] (Session ID: 3a50213defa37b7503ad9b5eed18fe0a).
2020-09-08 09:16:56,861:WARNING:discord.gateway: Shard ID 23 has stopped responding to the gateway. Closing and restarting.
2020-09-08 09:16:58,210:INFO:discord.gateway: Websocket closed with 4000, attempting a reconnect.
2020-09-08 09:17:07,911:WARNING:discord.gateway: Shard ID 24 has stopped responding to the gateway. Closing and restarting.
2020-09-08 09:17:09,297:INFO:discord.gateway: Shard ID 28 has sent the IDENTIFY payload.
2020-09-08 09:17:16,513:INFO:discord.gateway: Websocket closed with 4000, attempting a reconnect.
2020-09-08 09:17:16,797:WARNING:discord.gateway: Can't keep up, shard ID 28 websocket is 15.3s behind.
2020-09-08 09:17:16,798:INFO:discord.gateway: Shard ID 28 has connected to Gateway: ["gateway-prd-main-5xkz",{"micros":2773752,"calls":["discord-sessions-prd-2-2",{"micros":2768516,"calls":["start_session",{"micros":444463,"calls":["api-prd-main-cp73",{"micros":433409,"calls":["get_user",{"micros":4161},"add_authorized_ip",{"micros":8450},"get_guilds",{"micros":334813},"coros_wait",{"micros":1}]}]},"guilds_connect",{"micros":368,"calls":[]},"presence_connect",{"micros":1,"calls":[]}]}]}] (Session ID: 2c8d94c5c250be742700228c907ccd2f).
2020-09-08 09:17:20,630:WARNING:discord.gateway: Shard ID 25 has stopped responding to the gateway. Closing and restarting.
2020-09-08 09:17:21,431:INFO:discord.gateway: Websocket closed with 4000, attempting a reconnect.
2020-09-08 09:17:25,242:WARNING:discord.gateway: Can't keep up, shard ID 20 websocket is 43.4s behind.
2020-09-08 09:17:31,898:INFO:discord.gateway: Shard ID 29 has sent the IDENTIFY payload.
2020-09-08 09:17:32,194:INFO:discord.shard: Got a request to RESUME the websocket at Shard ID 23.
2020-09-08 09:17:41,700:INFO:discord.gateway: Shard ID 29 has connected to Gateway: ["gateway-prd-main-lvh8",{"micros":2956798,"calls":["discord-sessions-prd-1-3",{"micros":2952611,"calls":["start_session",{"micros":401718,"calls":["api-prd-main-t21x",{"micros":398278,"calls":["get_user",{"micros":8808},"add_authorized_ip",{"micros":2558},"get_guilds",{"micros":330566},"coros_wait",{"micros":1}]}]},"guilds_connect",{"micros":196,"calls":[]},"presence_connect",{"micros":2,"calls":[]}]}]}] (Session ID: a1facf6bf240fa85226ab6b11ca5b415).
2020-09-08 09:17:46,242:WARNING:discord.gateway: Shard ID 26 has stopped responding to the gateway. Closing and restarting.
2020-09-08 09:17:47,589:INFO:discord.gateway: Websocket closed with 4000, attempting a reconnect.
2020-09-08 09:17:53,235:INFO:discord.gateway: Shard ID 23 has sent the RESUME payload.
2020-09-08 09:17:53,737:INFO:discord.shard: Got a request to RESUME the websocket at Shard ID 24.
2020-09-08 09:17:57,557:INFO:discord.gateway: Shard ID 23 session has been invalidated.
2020-09-08 09:17:59,644:INFO:discord.gateway: Shard ID 24 has sent the RESUME payload.
2020-09-08 09:18:00,022:INFO:discord.shard: Got a request to RESUME the websocket at Shard ID 25.
2020-09-08 09:18:02,231:WARNING:discord.gateway: Shard ID 27 has stopped responding to the gateway. Closing and restarting.
2020-09-08 09:18:03,105:INFO:discord.gateway: Websocket closed with 4000, attempting a reconnect.
2020-09-08 09:18:10,635:INFO:discord.gateway: Shard ID 24 session has been invalidated.
2020-09-08 09:18:11,397:INFO:discord.gateway: Shard ID 25 has sent the RESUME payload.
2020-09-08 09:18:11,685:INFO:discord.shard: Got a request to RESUME the websocket at Shard ID 26.
2020-09-08 09:18:15,388:WARNING:discord.gateway: Can't keep up, shard ID 28 websocket is 27.4s behind.
2020-09-08 09:18:16,078:INFO:discord.gateway: Shard ID 26 has sent the RESUME payload.
2020-09-08 09:18:16,274:INFO:discord.gateway: Shard ID 25 session has been invalidated.
2020-09-08 09:18:16,672:INFO:discord.shard: Got a request to RESUME the websocket at Shard ID 27.
2020-09-08 09:18:18,375:INFO:discord.gateway: Shard ID 27 has sent the RESUME payload.
2020-09-08 09:18:18,406:INFO:discord.shard: Got a request to IDENTIFY the websocket at Shard ID 23.
2020-09-08 09:18:20,247:WARNING:discord.state: GUILD_MEMBER_UPDATE referencing an unknown member ID: 732729941413593149. Discarding.
2020-09-08 09:18:20,774:WARNING:discord.state: GUILD_MEMBER_UPDATE referencing an unknown member ID: 707974029482524843. Discarding.
2020-09-08 09:18:21,694:WARNING:discord.gateway: Can't keep up, shard ID 29 websocket is 10.9s behind.
2020-09-08 09:18:22,103:WARNING:discord.state: GUILD_MEMBER_UPDATE referencing an unknown member ID: 613807479318511656. Discarding.
2020-09-08 09:18:22,147:INFO:discord.gateway: Shard ID 26 session has been invalidated.
2020-09-08 09:18:22,464:INFO:discord.gateway: Shard ID 27 session has been invalidated.
2020-09-08 09:18:22,516:WARNING:discord.state: GUILD_MEMBER_UPDATE referencing an unknown member ID: 476282438457360385. Discarding.
2020-09-08 09:18:25,191:INFO:discord.gateway: Shard ID 23 has sent the IDENTIFY payload.
2020-09-08 09:18:25,193:INFO:discord.shard: Got a request to IDENTIFY the websocket at Shard ID 24.
2020-09-08 09:18:27,509:WARNING:discord.state: GUILD_MEMBER_UPDATE referencing an unknown member ID: 720159593443098665. Discarding.
2020-09-08 09:18:28,119:INFO:discord.gateway: Shard ID 23 has connected to Gateway: ["gateway-prd-main-l5rc",{"micros":2867935,"calls":["discord-sessions-prd-2-35",{"micros":2865720,"calls":["start_session",{"micros":288478,"calls":["api-prd-main-2zjb",{"micros":285912,"calls":["get_user",{"micros":2310},"add_authorized_ip",{"micros":1390},"get_guilds",{"micros":260897},"coros_wait",{"micros":2}]}]},"guilds_connect",{"micros":243,"calls":[]},"presence_connect",{"micros":1,"calls":[]}]}]}] (Session ID: b2c22c0533f5b4fffa174e24d6cbf73e).
2020-09-08 09:18:37,268:INFO:discord.gateway: Shard ID 24 has sent the IDENTIFY payload.
2020-09-08 09:18:37,579:INFO:discord.shard: Got a request to IDENTIFY the websocket at Shard ID 26.
2020-09-08 09:18:38,317:WARNING:discord.gateway: Can't keep up, shard ID 24 websocket is 13.0s behind.
2020-09-08 09:18:40,930:INFO:discord.gateway: Shard ID 24 has connected to Gateway: ["gateway-prd-main-0qhl",{"micros":2662003,"calls":["discord-sessions-prd-1-15",{"micros":2657197,"calls":["start_session",{"micros":309374,"calls":["api-prd-main-nssz",{"micros":305972,"calls":["get_user",{"micros":2500},"add_authorized_ip",{"micros":1273},"get_guilds",{"micros":282041},"coros_wait",{"micros":1}]}]},"guilds_connect",{"micros":360,"calls":[]},"presence_connect",{"micros":1,"calls":[]}]}]}] (Session ID: cc18d29da330c64934aa86f7122e4d88).
2020-09-08 09:18:48,477:WARNING:discord.state: GUILD_MEMBER_UPDATE referencing an unknown member ID: 142280884219805696. Discarding.
2020-09-08 09:18:56,331:WARNING:discord.state: GUILD_MEMBER_UPDATE referencing an unknown member ID: 690959611716436019. Discarding.
2020-09-08 09:19:01,910:WARNING:discord.state: GUILD_MEMBER_UPDATE referencing an unknown member ID: 402079984807575552. Discarding.
2020-09-08 09:19:02,859:INFO:discord.gateway: Shard ID 26 has sent the IDENTIFY payload.
2020-09-08 09:19:03,209:INFO:discord.shard: Got a request to IDENTIFY the websocket at Shard ID 25.
2020-09-08 09:19:03,803:WARNING:discord.gateway: Can't keep up, shard ID 26 websocket is 10.4s behind.
2020-09-08 09:19:07,360:INFO:discord.gateway: Shard ID 26 has connected to Gateway: ["gateway-prd-main-59ft",{"micros":3516608,"calls":["discord-sessions-prd-1-10",{"micros":3514130,"calls":["start_session",{"micros":754318,"calls":["api-prd-main-nnm0",{"micros":750671,"calls":["get_user",{"micros":3096},"add_authorized_ip",{"micros":2333},"get_guilds",{"micros":697028},"coros_wait",{"micros":1}]}]},"guilds_connect",{"micros":286,"calls":[]},"presence_connect",{"micros":2,"calls":[]}]}]}] (Session ID: 4af5cdea8c3f10c0328addb89994ee0e).
2020-09-08 09:19:14,764:WARNING:discord.state: GUILD_MEMBER_UPDATE referencing an unknown member ID: 662371003409760298. Discarding.
2020-09-08 09:19:17,656:WARNING:discord.state: GUILD_MEMBER_UPDATE referencing an unknown member ID: 347563165615390732. Discarding.
2020-09-08 09:19:18,095:WARNING:discord.state: GUILD_MEMBER_UPDATE referencing an unknown member ID: 717220354669674556. Discarding.
2020-09-08 09:19:22,804:INFO:discord.gateway: Shard ID 25 has sent the IDENTIFY payload.
2020-09-08 09:19:23,309:INFO:discord.shard: Got a request to IDENTIFY the websocket at Shard ID 27.
2020-09-08 09:19:26,123:INFO:discord.gateway: Shard ID 25 has connected to Gateway: ["gateway-prd-main-ftqk",{"micros":2460180,"calls":["discord-sessions-prd-2-70",{"micros":2458583,"calls":["start_session",{"micros":373347,"calls":["api-prd-main-9s61",{"micros":368662,"calls":["get_user",{"micros":4199},"add_authorized_ip",{"micros":1873},"get_guilds",{"micros":321653},"coros_wait",{"micros":1}]}]},"guilds_connect",{"micros":319,"calls":[]},"presence_connect",{"micros":2,"calls":[]}]}]}] (Session ID: 71f3a176f23bbb281df009276079bc86).
2020-09-08 09:19:44,557:WARNING:discord.gateway: Shard ID 23 has stopped responding to the gateway. Closing and restarting.
2020-09-08 09:19:46,723:WARNING:discord.state: GUILD_MEMBER_UPDATE referencing an unknown member ID: 535151998199136282. Discarding.
2020-09-08 09:19:47,999:INFO:discord.gateway: Websocket closed with 4000, attempting a reconnect.
2020-09-08 09:19:48,000:INFO:discord.gateway: Shard ID 27 has sent the IDENTIFY payload.
2020-09-08 09:19:48,429:INFO:discord.shard: Got a request to RESUME the websocket at Shard ID 23.
2020-09-08 09:19:49,931:WARNING:discord.gateway: Can't keep up, shard ID 27 websocket is 10.1s behind.
2020-09-08 09:19:52,242:INFO:discord.gateway: Shard ID 27 has connected to Gateway: ["gateway-prd-main-fk5n",{"micros":2813932,"calls":["discord-sessions-prd-2-17",{"micros":2809549,"calls":["start_session",{"micros":282855,"calls":["api-prd-main-4mft",{"micros":279794,"calls":["get_user",{"micros":2090},"add_authorized_ip",{"micros":1841},"get_guilds",{"micros":254247},"coros_wait",{"micros":1}]}]},"guilds_connect",{"micros":227,"calls":[]},"presence_connect",{"micros":1,"calls":[]}]}]}] (Session ID: c681f4c09860e4d9ecac30c61d9524f8).
2020-09-08 09:19:59,392:WARNING:discord.gateway: Shard ID 24 has stopped responding to the gateway. Closing and restarting.
2020-09-08 09:20:01,288:WARNING:discord.state: GUILD_MEMBER_UPDATE referencing an unknown member ID: 165119165286318080. Discarding.
2020-09-08 09:20:01,320:WARNING:discord.state: GUILD_MEMBER_UPDATE referencing an unknown member ID: 709618535789363202. Discarding.
2020-09-08 09:20:01,508:WARNING:discord.state: GUILD_MEMBER_UPDATE referencing an unknown member ID: 665423770273579041. Discarding.
2020-09-08 09:20:04,283:WARNING:discord.state: GUILD_MEMBER_UPDATE referencing an unknown member ID: 442417222317637642. Discarding.
2020-09-08 09:20:09,452:INFO:discord.gateway: Shard ID 23 has sent the RESUME payload.
2020-09-08 09:20:12,752:INFO:discord.client: Cleaning up tasks.
2020-09-08 09:20:12,752:INFO:discord.client: Cleaning up after 6 tasks.
2020-09-08 09:20:12,773:INFO:discord.client: All tasks finished cancelling.
2020-09-08 09:20:12,773:INFO:discord.client: Closing the event loop.

Checklist

  • [x ] I have searched the open issues for duplicates.
  • [x ] I have shown the entire traceback, if possible.
  • [x ] I have removed my token from display, if visible.

System Information

  • Python v3.6.9-final
  • discord.py v1.4.1-final
  • aiohttp v3.6.2
  • system info: Linux 4.15.0-51-generic Retrieve images #55-Ubuntu SMP Wed May 15 14:27:21 UTC 2019
@Rapptz
Copy link
Owner

Rapptz commented Sep 8, 2020

This should be unlikely to happen but it might be a regression from switching over to aiohttp from websockets. There's no harm in guarding these though.

@Rapptz Rapptz added the bug This is a bug with the library. label Sep 8, 2020
@Rapptz Rapptz added this to the 1.5 milestone Sep 8, 2020
@Rapptz Rapptz closed this as completed in f8808db Sep 10, 2020
diceroll123 added a commit to diceroll123/discord.py that referenced this issue Dec 5, 2020
* Fix incorrect class reference in documentation

* Fix minor markdown typo in migrating.rst

* Support discord.com/invite URL in resolve_invite

* Fix TypeError on missing shard_id kwarg

* Escape masked URLs; Support quotes for as_needed

* Fix reconnecting loop due to failed handshake on region change

* Change PartialInviteGuild.icon_url_as to mimic Guild.icon_url_as

* Fix error raised when using the roles parameter.

* Add versionadded to VoiceClient latency and average_latency

* Update Message.system_content join strings to be up to date.

Fixes Rapptz#4211

* Fix Guild.by_category not showing empty categories.

* Fix a KeyError for channels with no category in Guild.by_category

* Fix various inconsistencies within the documentation (Rapptz#5067)

* [commands] Add a new exception class for command registration errors

* [tasks] Fix issue with default error handler in class context

* [commands] Raise TypeError when Optional is used with Greedy converter

* Add support for Discord templates

* Add support for integrations

* Add support for bulk editing role positions

* [bugs] stop resolving Object for template/invite; remove dupe methods

* Fix typo with voice_client documentation

* Documentation formatting

* Allow Webhook to be hashable and comparable

* Allow more methods to set an audit log reason

* Add a licence and encoding declaration to missing files

* Document raises for Converter.convert

* [docs] fix reference to `Guild` and document `utils.resolve_template`

* Fix TypeError when not specifying roles.

* Don't use a namedtuple for _Overwrites

Fix Rapptz#5109

* Fix detection of some JPEG images without JFIF or Exif info

Closes Rapptz#5143

* Add Guild.change_voice_state to control our voice state.

* Add double backticks for some parameter mentions in the documentation.

* Added exception documentation for Guild.create_voice_channel

* [commands] GroupView.get_command shouldn't raise errors for empty names

* Add gray alias for discord.Colour

* [commands] Add documentation for exceptions in Context.(re)invoke

* Fix typo in on_socket_raw_send documentation

* Add a changelog entry for v1.3.4

* Add documentation on bot_check_once

* Add revisions to check_once docs

* Rewrite of AutoShardedClient to prevent overlapping identify

This is experimental and I'm unsure if it actually works

* Add shard ID to keep alive logger messages

* Can't use %d in here

* Fix AttributeError on reconnection

* Rewrite gateway to use aiohttp instead of websockets

* Use a proper type for the event queue

* Fix voice websocket connections

* Fix READY not firing for multi-processed AutoShardedClient clusters

* Add before_identify_hook to have finer control over IDENTIFY syncing

* Make every shard maintain its own reconnect loop

Previously if a disconnect happened the client would get in a bad state
and certain shards would be double sending due to unhandled exceptions
raising back to Client.connect and causing all shards to be reconnected
again.

This new code overrides Client.connect to have more finer control and
allow each individual shard to maintain its own reconnect loop and then
serially request reconnection to ensure that IDENTIFYs are not
overlapping.

* Handle connection errors during reidentify flow.

* Add shard related connection and resume events.

These include:
* on_shard_resumed
* on_shard_connect
* on_shard_disconnect

* Handle Connection Reset by Peer connection errors.

This should work both on Windows and on Linux.

Apparently these types of blips are considered normal for Discord. So
rather than letting the reconnect logic handler expect these to be
catastrophic, it should handle it specially so it doesn't waste an
IDENTIFY for what ultimately should just be a small networking blip.

This also makes it less noisy for the end-user as these complaints
happen from time to time.

* If we're out of retries just raise the OSError

* Add a timeout for receiving websocket messages.

* Add guild_ready_timeout to control the timeout of GUILD_CREATE stream

This also fixes a timing issue where READY would take far too long to
load for big bot authors.

Closes Rapptz#4112

* Update message references in AutoShardedConnectionState

Fixes Rapptz#5133

* Use a subclass rather than monkey-patching for the websocket

* Propagate exceptions when an unhandled error happens

* Add an exposed way to extract shard-specific information.

Closes Rapptz#2654

* Fix AttributeError from internal queue being double underscore.

* Fix NameError with resolving codes with Template

* Specify where to get max_members in documentation

* Fix typo when creating a guild via template

* Terminate shard processing queue when a clean close is encountered.

Fix Rapptz#5180

* Optimize Channel.permissions_for by not creating temporary objects

This seemed to have shaved a few microseconds:
10.8 µs ± 79.6 ns per loop → 8.53 µs ± 48.1 ns per loop
12 µs ± 613 ns per loop → 8.72 µs ± 30.2 ns per loop

With 100K loops each

* Fix AttributeError when fetching reactions without cache

* Fix gramatical error in Client guild_subscriptions docs

* [tasks] Remove HTTPException as an exception to silently continue for

* Fix endpoint strings with :443 instead of :80

Fix Rapptz#5191
Close Rapptz#5188

* Propagate manual close codes to socket subclass

aiohttp seems to not set it during its state machine flow

* Require people to use templates when making an issue

* Fix NameError and AttributeError in Template and Integrations

* Be defensive in case Discord breaks something with WS URLs again

* [commands] Restart subcommand_passed chain on invoke

Fix Rapptz#5198

* [commands] Provide a way to retrieve time left for a cooldown

* [commands] implement HelpCommand.add/remove_check

* Add missing comma in template.py

* Fix a typo with webhook documentation

* Fixed a typo in message unpinning docs

* Add remaining user flags

* Add changelog for 1.4

* Version bump to 1.4

* Terminate connection if a close code couldn't be handled

* Fix error when trying to clear empty image/thumbnail in embeds

* Extend __path__ with pkgutil to allow editable extensions

* Add changelog for 1.4.1

* Version bump to 1.4.1

* Document on_error "special" behavior

* Add South Korea VoiceRegion

* update the docs on RawReactionActionEvent.member

* Fix letter to be consistent with the rest of the docs

* Fix hyperlink reference to PartialInviteChannel in Client

* Document merging behaviour of AllowedMentions in Messageable.send

* Fix bug with Guild.by_category not showing some channels

If categories come after a child channel in the dictionary mapping for
whatever reason, then the previous code would remove it from the
mapping and set it to []. This commit aims to fix this.

* Version bump for development purposes

* Fix issue with empty overwrites

Fixes Rapptz#5756.

* [commands] Use edited timestamp if provided for cooldown timing

* [tasks] Don't update _next_iteration on retry

* [commands] Added ColorConverter alias

* Don't call close() if we've already been closed in Client.run

* Added __eq__ to Message

* Add COMMUNITY to Guild.features

* Classmethods all and none for AllowedMentions

* [commands] Add subclasses of BadArgument for converters

* [commands] BadBooleanArgument -> BadBoolArgument

* [commands] add require_var_positional

* [docs] remove unresolved doc refs, fix attribute ref

* [commands] Update Bot.command() decorator docs

* Add fetch_message_fast using history endpoint

* Add discord.Colour classmethod dark_theme

* Fix Member.joined_at documentation

* [commands] Fix exception raised in Command invoke hooks.

* [commands] Correct command removing during cog injecting

* Fix comparison for overwrites when checking if a channel is synced

* Add logging to webhooks

Fixes Rapptz#5798

* Handle cloudflare bans on webhook requests

Fixes Rapptz#5221

* Guard uses of the keep alive thread in case they're None

Fixes Rapptz#5800

* Add a more concrete exception for 500 status codes.

Fixes Rapptz#5797

* [tasks] Lazily fetch event loop if one isn't provided

Fixes Rapptz#5808

* Remove caching from AutoShardedClient.shards

* Add missing permission in clone documentation

* Revert "Add fetch_message_fast using history endpoint"

This reverts commit a309088.

A rate limited was added to this method after 5 years defeating the
purpose of it.

* Completely update member references from message inner members.

Fixes Rapptz#5819

* Add labels to the issue templates

* Update issue template to redirect to discussions

* issue/PR templates: use h2 instead of h3

`h2` is the semantically correct heading here, as `h1` is for 
document titles and `h2` is for the top level headings within
a document. `h3` should be used for subheadings of `h2` headings.

* Add competing activity type

* Fix allowed_mentions when sending files

* Add bot.listen() suggestion to on_message faq

* Remove namedtuples to better future guard the library

* Use quotes when installing in the README

Other shells have a hard time with square brackets.

Closes Rapptz#5821

* Add support for message_reference on Message object

* Fix and add documentation

* Implement VoiceProtocol lower level hooks.

This allows changing the connect flow and taking control of it without
relying on internal events or tricks.

* Correct some protocol errors in v4 of voice gateway

* Fix issues with VoiceProtocol docstrsings.

* Properly handle disconnects in voice when force disconnected

* Add support for guild intents

* Handle gateway rate limits by using a rate limiter.

With the new chunking changes this will become necessary and we don't
want to disconnect from having too many outwards requests.

* Change unknown cache log warnings from WARNING -> DEBUG

* Add more close codes that can't be handled for reconnecting.

* Rewrite chunking to work with intents.

This slows down chunking significantly for bots in a large number of
guilds since it goes down from 75 guilds/request to 1 guild/request.
However the logic was rewritten to fire the chunking request
immediately after receiving the GUILD_CREATE rather than waiting for
all the guilds in the ready stream before doing it.

* Handle user updates within GUILD_MEMBER_UPDATE

* All guilds require chunking if opting into it

* Heartbeats bypass the rate limits for gateway

* Use a lock for the gateway rate limiter.

This will allow for higher concurrency in AutoSharded situations where
I can mostly "fire and forget" the chunk requests.

* Maximize concurrency when chunking on AutoSharded clients

* Speed up chunking for guilds with presence intent enabled

* Check for zombie connections through last received payload

The previous code would check zombie connections depending on whether
HEARTBEAT_ACK was received. Unfortunately when there's exceeding
backpressure the connection can terminate since the HEARTBEAT_ACK is
buffered very far away despite it being there, just not received yet.

* Maximize the amount of concurrency while chunking.

In order to reduce our amount of backpressure we need to limit the
amount of concurrent chunk requests we can have so the gateway buffer
has some time to breathe.

* Fix timeouts due to hitting the gateway rate limit

* Explicitly disable the members presence by default

* Add versionadded for intents enum

* Fix Client.request_offline_members no longer working

* Add Guild.chunk and deprecated Client.request_offline_members

* Don't cache members during guild start up if cache is disabled.

This is mainly a half-implemented commit. There are a few more places
where cache consistency is necessary. In the future there will
probably be a member cache policy enum that will be used and cache
consistency will be tackled in part of that larger refactoring.

* Raise if member intent is not enabled

* Allow finer grained control over the member cache.

* Intern status and overwrite strings

* Pass default intents if not explicitly given

* Add a special exception for required privileged intents

* Default MemberCacheFlags based on intents

* Some documentation fixes for MemberCacheFlags and Intents

* Fix up wording in MemberCacheFlags exception

* Disable voice cache in weird intent configurations.

* Fix presence intent docstring

* Mention potential Guild.member_count accuracy issues

* Add documentation for gateway intents

* Use /invites/ instead of /invite/

* Use delete_message_days instead of delete-message-days

* Add support for flag alias

* Fix typos in Intents documentation

* Add chunk_guilds_at_startup and deprecate fetch_offline_members

* More intent related documentation

* More intent documentation.

Mention that you can downgrade the library to revert. Also mention
that intents need to be updated in the code as well as the developer
portal.

* Fix typo in ValueError message

* Make Intent class creation more intuitive

* Fixed incorrectly named 'Intent' class in doc.

`Intent.members` -> `Intents.members`.

* Add Client.intents to query the current intents

Closes Rapptz#5854

* Update intents with small typo fixes

* Guard GUILD_MEMBER_ADD/GUILD_MEMBER_REMOVE from errors

If the guilds intent is disabled all guilds are unavailable. This means
we don't receive a member_count attribute and cannot update it.

* Add warning if guilds intent is disabled.

* Add changelog for v1.5.0

* Add changelog for v1.4.2

* Version bump to v1.5.0

* Some minor documentation fixes.

Make examples all mention where to put it for the unaware.

* Add intents to examples

* Add intents to event reference

* Update intent documentation to use defaults

* Add intents to the issue template

* Add note pointing to discord.AllowedMentions

* Fix typo in event reference

* Use Hashable mixin for Message

* logging.rst: Fix some typos and grammar errors

* Fix Colour.dark_theme docstring.

* Escape multi-line quotes properly

Fix Rapptz#5897

* Properly insert at the end if position is not found when moving.

Fixes Rapptz#5923

* Evict keys when they're set to None in PermissionOverwrite

Fixes Rapptz#5929

* Mark intent alias flags as actual aliases to skip them in __iter__

Fix Rapptz#5945

* Fix disconnect when trying to move to another voice channel.

Not overly proud of this implementation but this allows the library
to differentiate between a 4014 that means "move to another channel" or
"move nowhere". Sometimes the VOICE_STATE_UPDATE comes before the
actual websocket disconnect so special care had to be taken in that
case.

Fix Rapptz#5904

* Fix attribute errors when timing out during chunking start-up

* Add internal method to check if the websocket is currently ratelimited

* Ensure our own member is never evicted from the cache in any policy.

* [commands] Lazily fetch members in discord.Member converters

This makes commands taking members mostly work transparently without
much effort from the user.

* Load member from guild_member_update dispatch

* Allow concurrent calls to guild.chunk()

This allows people who write guild.chunk() calls in highly concurrent
places such as on_message or checks to not spam the gateway with an
actual request and instead waits for the pre-existing request to finish

* Fix error when querying members from the gateway.

I accidentally made this return True instead of the actual member list

* Add changelog for v1.5.1

* Version bump to v1.5.1

* Translation sync with crowdin

* Implement icon_rl_as and cover_image_url_as for AppInfo

* Raise ClientException when members intent is not enabled on guild.fetch_members

* [commands] Update MessageConverter link regex

Remove redundant parts of the MessageConverter regexes and support www

* Emphasize intents in the constructors of the examples

* Raise DiscordServerError for 503 Service Unavailable errors

* Properly document that categories throw 404's on create_invite.

* Add Colour.random factory method

* Clarify Colour.random RNG

* Bump version for development purposes

* Fix error with templates not having access to member cache flags.

This also changes the attribute from having an underscore

Fix Rapptz#5986

* Fix attribute error during rapid disconnects in VoiceClient.

Fix Rapptz#6039

* Clear the connected flag when potentially reconnecting the player

Fix Rapptz#5953

* Bump dependencies for 3.9 to work without build tools

Fix Rapptz#5984, Rapptz#5970

* Suppress the creation of a command window from ffmpeg on Windows

Fix Rapptz#6038

* Add sticker support

* Don't store a user cache if there's no member intent or cache is off

Without a cache or member intent the user cache can get out of date
with no events to update the underlying user in the member object.

Ref: Rapptz#6034

* Ensure member key is not overwritten by author key in MESSAGE_UPDATE

This also coerces the older message to take the member data from the
newer message so the types are not incompatible.

Fix Rapptz#5999

* Sticker implementation cleanup

* [commands] Fetch user if an ID is passed and cache lookup fails.

* Fix preview_asset key name in Sticker

* [commands] Allow setting description of cogs

* Implement role tags.

This comes with:

* The RoleTags class
* Role.is_premium_subscriber()
* Role.is_bot_managed()
* Role.is_integration()
* Guild.self_role
* Guild.premium_subscriber_role

* Add a way to check if the websocket is rate limited.

This is mainly for low level decision making for utilities that need
to know whether to fetch a member by HTTP or to query through the
websocket.

The library already does this trick in some places so it's only fair
that end users possess the same ability as well.

* Fix `discord.RoleTags` resolution

* Implement discord.Message.reply

* Code cleanup involving enums and message replies

* Allow MessageReference to be constructible by users

* Added MessageReference.resolved attribute to get replied to message

* Correct docstring missing ]

* Fix Message.to_reference from the MessageReference changes

* Change reply example to use replies

* Fix `UnboundLocalError` for editing `public_updates_channel`

* [chore] Remove redundant imports

This also removes the historical patch for NullHandler implemented in bbf1c54, as it has been available since Python 3.1.

* [bug] call super constructor for `CustomActivity` to fix `created_at`

* Fix Team.icon_url_as format argument default value

* Add reaction roles example

* Update documentation for rules/updates channels

* Add support for chunking AsyncIterator objects

* [commands] Cog unload failures are swallowed.

Fix Rapptz#6113

Co-authored-by: JohnyTheCarrot <[email protected]>
Co-authored-by: Tarek <[email protected]>
Co-authored-by: apple502j <[email protected]>
Co-authored-by: Anurag <[email protected]>
Co-authored-by: NCPlayz <[email protected]>
Co-authored-by: Jeffrey <[email protected]>
Co-authored-by: Tsumiki <[email protected]>
Co-authored-by: Rapptz <[email protected]>
Co-authored-by: Sebastian Law <[email protected]>
Co-authored-by: jack1142 <[email protected]>
Co-authored-by: Josh <[email protected]>
Co-authored-by: Skezza <[email protected]>
Co-authored-by: Znunu <[email protected]>
Co-authored-by: James <[email protected]>
Co-authored-by: James <[email protected]>
Co-authored-by: AXVin <[email protected]>
Co-authored-by: Jaime Garcia Jr <[email protected]>
Co-authored-by: Jaime Garcia Jr <[email protected]>
Co-authored-by: Riley S <[email protected]>
Co-authored-by: Tyler North <[email protected]>
Co-authored-by: Dan Hess <[email protected]>
Co-authored-by: Xua <[email protected]>
Co-authored-by: ELginas <[email protected]>
Co-authored-by: Bryan Forbes <[email protected]>
Co-authored-by: Vexs <[email protected]>
Co-authored-by: Patrick <[email protected]>
Co-authored-by: Zomatree <[email protected]>
Co-authored-by: sinus-x <[email protected]>
Co-authored-by: Nanofaux <[email protected]>
Co-authored-by: parafoxia <[email protected]>
Co-authored-by: alkatar21 <[email protected]>
Co-authored-by: Andres Torres <[email protected]>
Co-authored-by: Alex Nørgaard <[email protected]>
Co-authored-by: Saphielle Akiyama <[email protected]>
Co-authored-by: Simon Beal <[email protected]>
Co-authored-by: khazhyk <[email protected]>
Co-authored-by: Skye Im <[email protected]>
Co-authored-by: BluePhoenixGame <[email protected]>
Co-authored-by: rodovia <[email protected]>
Co-authored-by: Duck <[email protected]>
Co-authored-by: iomintz <[email protected]>
Co-authored-by: iDutchy <[email protected]>
Co-authored-by: PikalaxALT <[email protected]>
Co-authored-by: Michael <[email protected]>
Co-authored-by: Muhammad Hamza <[email protected]>
Co-authored-by: Nekokatt <[email protected]>
Co-authored-by: ChristopherJHart <[email protected]>
Co-authored-by: Eric Chan <[email protected]>
Co-authored-by: PythonCoderAS <[email protected]>
Co-authored-by: numbermaniac <[email protected]>
Co-authored-by: Florian Spieß <[email protected]>
Co-authored-by: Lukas <[email protected]>
Co-authored-by: Jonathan Feenstra <[email protected]>
Co-authored-by: Harmon <[email protected]>
Co-authored-by: webtax-gh <[email protected]>
Co-authored-by: Caio Alexandre <[email protected]>
Co-authored-by: SNVMK <[email protected]>
Co-authored-by: Kippiii <[email protected]>
Co-authored-by: RocketRace <[email protected]>
diceroll123 added a commit to diceroll123/discord.py that referenced this issue Dec 7, 2020
* Fix minor markdown typo in migrating.rst

* Support discord.com/invite URL in resolve_invite

* Fix TypeError on missing shard_id kwarg

* Escape masked URLs; Support quotes for as_needed

* Fix reconnecting loop due to failed handshake on region change

* Change PartialInviteGuild.icon_url_as to mimic Guild.icon_url_as

* Fix error raised when using the roles parameter.

* Add versionadded to VoiceClient latency and average_latency

* Update Message.system_content join strings to be up to date.

Fixes Rapptz#4211

* Fix Guild.by_category not showing empty categories.

* Fix a KeyError for channels with no category in Guild.by_category

* Fix various inconsistencies within the documentation (Rapptz#5067)

* [commands] Add a new exception class for command registration errors

* [tasks] Fix issue with default error handler in class context

* [commands] Raise TypeError when Optional is used with Greedy converter

* Add support for Discord templates

* Add support for integrations

* Add support for bulk editing role positions

* [bugs] stop resolving Object for template/invite; remove dupe methods

* Fix typo with voice_client documentation

* Documentation formatting

* Allow Webhook to be hashable and comparable

* Allow more methods to set an audit log reason

* Add a licence and encoding declaration to missing files

* Document raises for Converter.convert

* [docs] fix reference to `Guild` and document `utils.resolve_template`

* Fix TypeError when not specifying roles.

* Don't use a namedtuple for _Overwrites

Fix Rapptz#5109

* Fix detection of some JPEG images without JFIF or Exif info

Closes Rapptz#5143

* Add Guild.change_voice_state to control our voice state.

* Add double backticks for some parameter mentions in the documentation.

* Added exception documentation for Guild.create_voice_channel

* [commands] GroupView.get_command shouldn't raise errors for empty names

* Add gray alias for discord.Colour

* [commands] Add documentation for exceptions in Context.(re)invoke

* Fix typo in on_socket_raw_send documentation

* Add a changelog entry for v1.3.4

* Add documentation on bot_check_once

* Add revisions to check_once docs

* Rewrite of AutoShardedClient to prevent overlapping identify

This is experimental and I'm unsure if it actually works

* Add shard ID to keep alive logger messages

* Can't use %d in here

* Fix AttributeError on reconnection

* Rewrite gateway to use aiohttp instead of websockets

* Use a proper type for the event queue

* Fix voice websocket connections

* Fix READY not firing for multi-processed AutoShardedClient clusters

* Add before_identify_hook to have finer control over IDENTIFY syncing

* Make every shard maintain its own reconnect loop

Previously if a disconnect happened the client would get in a bad state
and certain shards would be double sending due to unhandled exceptions
raising back to Client.connect and causing all shards to be reconnected
again.

This new code overrides Client.connect to have more finer control and
allow each individual shard to maintain its own reconnect loop and then
serially request reconnection to ensure that IDENTIFYs are not
overlapping.

* Handle connection errors during reidentify flow.

* Add shard related connection and resume events.

These include:
* on_shard_resumed
* on_shard_connect
* on_shard_disconnect

* Handle Connection Reset by Peer connection errors.

This should work both on Windows and on Linux.

Apparently these types of blips are considered normal for Discord. So
rather than letting the reconnect logic handler expect these to be
catastrophic, it should handle it specially so it doesn't waste an
IDENTIFY for what ultimately should just be a small networking blip.

This also makes it less noisy for the end-user as these complaints
happen from time to time.

* If we're out of retries just raise the OSError

* Add a timeout for receiving websocket messages.

* Add guild_ready_timeout to control the timeout of GUILD_CREATE stream

This also fixes a timing issue where READY would take far too long to
load for big bot authors.

Closes Rapptz#4112

* Update message references in AutoShardedConnectionState

Fixes Rapptz#5133

* Use a subclass rather than monkey-patching for the websocket

* Propagate exceptions when an unhandled error happens

* Add an exposed way to extract shard-specific information.

Closes Rapptz#2654

* Fix AttributeError from internal queue being double underscore.

* Fix NameError with resolving codes with Template

* Specify where to get max_members in documentation

* Fix typo when creating a guild via template

* Terminate shard processing queue when a clean close is encountered.

Fix Rapptz#5180

* Optimize Channel.permissions_for by not creating temporary objects

This seemed to have shaved a few microseconds:
10.8 µs ± 79.6 ns per loop → 8.53 µs ± 48.1 ns per loop
12 µs ± 613 ns per loop → 8.72 µs ± 30.2 ns per loop

With 100K loops each

* Fix AttributeError when fetching reactions without cache

* Fix gramatical error in Client guild_subscriptions docs

* [tasks] Remove HTTPException as an exception to silently continue for

* Fix endpoint strings with :443 instead of :80

Fix Rapptz#5191
Close Rapptz#5188

* Propagate manual close codes to socket subclass

aiohttp seems to not set it during its state machine flow

* Require people to use templates when making an issue

* Fix NameError and AttributeError in Template and Integrations

* Be defensive in case Discord breaks something with WS URLs again

* [commands] Restart subcommand_passed chain on invoke

Fix Rapptz#5198

* [commands] Provide a way to retrieve time left for a cooldown

* [commands] implement HelpCommand.add/remove_check

* Add missing comma in template.py

* Fix a typo with webhook documentation

* Fixed a typo in message unpinning docs

* Add remaining user flags

* Add changelog for 1.4

* Version bump to 1.4

* Terminate connection if a close code couldn't be handled

* Fix error when trying to clear empty image/thumbnail in embeds

* Extend __path__ with pkgutil to allow editable extensions

* Add changelog for 1.4.1

* Version bump to 1.4.1

* Document on_error "special" behavior

* Add South Korea VoiceRegion

* update the docs on RawReactionActionEvent.member

* Fix letter to be consistent with the rest of the docs

* Fix hyperlink reference to PartialInviteChannel in Client

* Document merging behaviour of AllowedMentions in Messageable.send

* Fix bug with Guild.by_category not showing some channels

If categories come after a child channel in the dictionary mapping for
whatever reason, then the previous code would remove it from the
mapping and set it to []. This commit aims to fix this.

* Version bump for development purposes

* Fix issue with empty overwrites

Fixes Rapptz#5756.

* [commands] Use edited timestamp if provided for cooldown timing

* [tasks] Don't update _next_iteration on retry

* [commands] Added ColorConverter alias

* Don't call close() if we've already been closed in Client.run

* Added __eq__ to Message

* Add COMMUNITY to Guild.features

* Classmethods all and none for AllowedMentions

* [commands] Add subclasses of BadArgument for converters

* [commands] BadBooleanArgument -> BadBoolArgument

* [commands] add require_var_positional

* [docs] remove unresolved doc refs, fix attribute ref

* [commands] Update Bot.command() decorator docs

* Add fetch_message_fast using history endpoint

* Add discord.Colour classmethod dark_theme

* Fix Member.joined_at documentation

* [commands] Fix exception raised in Command invoke hooks.

* [commands] Correct command removing during cog injecting

* Fix comparison for overwrites when checking if a channel is synced

* Add logging to webhooks

Fixes Rapptz#5798

* Handle cloudflare bans on webhook requests

Fixes Rapptz#5221

* Guard uses of the keep alive thread in case they're None

Fixes Rapptz#5800

* Add a more concrete exception for 500 status codes.

Fixes Rapptz#5797

* [tasks] Lazily fetch event loop if one isn't provided

Fixes Rapptz#5808

* Remove caching from AutoShardedClient.shards

* Add missing permission in clone documentation

* Revert "Add fetch_message_fast using history endpoint"

This reverts commit a309088.

A rate limited was added to this method after 5 years defeating the
purpose of it.

* Completely update member references from message inner members.

Fixes Rapptz#5819

* Add labels to the issue templates

* Update issue template to redirect to discussions

* issue/PR templates: use h2 instead of h3

`h2` is the semantically correct heading here, as `h1` is for 
document titles and `h2` is for the top level headings within
a document. `h3` should be used for subheadings of `h2` headings.

* Add competing activity type

* Fix allowed_mentions when sending files

* Add bot.listen() suggestion to on_message faq

* Remove namedtuples to better future guard the library

* Use quotes when installing in the README

Other shells have a hard time with square brackets.

Closes Rapptz#5821

* Add support for message_reference on Message object

* Fix and add documentation

* Implement VoiceProtocol lower level hooks.

This allows changing the connect flow and taking control of it without
relying on internal events or tricks.

* Correct some protocol errors in v4 of voice gateway

* Fix issues with VoiceProtocol docstrsings.

* Properly handle disconnects in voice when force disconnected

* Add support for guild intents

* Handle gateway rate limits by using a rate limiter.

With the new chunking changes this will become necessary and we don't
want to disconnect from having too many outwards requests.

* Change unknown cache log warnings from WARNING -> DEBUG

* Add more close codes that can't be handled for reconnecting.

* Rewrite chunking to work with intents.

This slows down chunking significantly for bots in a large number of
guilds since it goes down from 75 guilds/request to 1 guild/request.
However the logic was rewritten to fire the chunking request
immediately after receiving the GUILD_CREATE rather than waiting for
all the guilds in the ready stream before doing it.

* Handle user updates within GUILD_MEMBER_UPDATE

* All guilds require chunking if opting into it

* Heartbeats bypass the rate limits for gateway

* Use a lock for the gateway rate limiter.

This will allow for higher concurrency in AutoSharded situations where
I can mostly "fire and forget" the chunk requests.

* Maximize concurrency when chunking on AutoSharded clients

* Speed up chunking for guilds with presence intent enabled

* Check for zombie connections through last received payload

The previous code would check zombie connections depending on whether
HEARTBEAT_ACK was received. Unfortunately when there's exceeding
backpressure the connection can terminate since the HEARTBEAT_ACK is
buffered very far away despite it being there, just not received yet.

* Maximize the amount of concurrency while chunking.

In order to reduce our amount of backpressure we need to limit the
amount of concurrent chunk requests we can have so the gateway buffer
has some time to breathe.

* Fix timeouts due to hitting the gateway rate limit

* Explicitly disable the members presence by default

* Add versionadded for intents enum

* Fix Client.request_offline_members no longer working

* Add Guild.chunk and deprecated Client.request_offline_members

* Don't cache members during guild start up if cache is disabled.

This is mainly a half-implemented commit. There are a few more places
where cache consistency is necessary. In the future there will
probably be a member cache policy enum that will be used and cache
consistency will be tackled in part of that larger refactoring.

* Raise if member intent is not enabled

* Allow finer grained control over the member cache.

* Intern status and overwrite strings

* Pass default intents if not explicitly given

* Add a special exception for required privileged intents

* Default MemberCacheFlags based on intents

* Some documentation fixes for MemberCacheFlags and Intents

* Fix up wording in MemberCacheFlags exception

* Disable voice cache in weird intent configurations.

* Fix presence intent docstring

* Mention potential Guild.member_count accuracy issues

* Add documentation for gateway intents

* Use /invites/ instead of /invite/

* Use delete_message_days instead of delete-message-days

* Add support for flag alias

* Fix typos in Intents documentation

* Add chunk_guilds_at_startup and deprecate fetch_offline_members

* More intent related documentation

* More intent documentation.

Mention that you can downgrade the library to revert. Also mention
that intents need to be updated in the code as well as the developer
portal.

* Fix typo in ValueError message

* Make Intent class creation more intuitive

* Fixed incorrectly named 'Intent' class in doc.

`Intent.members` -> `Intents.members`.

* Add Client.intents to query the current intents

Closes Rapptz#5854

* Update intents with small typo fixes

* Guard GUILD_MEMBER_ADD/GUILD_MEMBER_REMOVE from errors

If the guilds intent is disabled all guilds are unavailable. This means
we don't receive a member_count attribute and cannot update it.

* Add warning if guilds intent is disabled.

* Add changelog for v1.5.0

* Add changelog for v1.4.2

* Version bump to v1.5.0

* Some minor documentation fixes.

Make examples all mention where to put it for the unaware.

* Add intents to examples

* Add intents to event reference

* Update intent documentation to use defaults

* Add intents to the issue template

* Add note pointing to discord.AllowedMentions

* Fix typo in event reference

* Use Hashable mixin for Message

* logging.rst: Fix some typos and grammar errors

* Fix Colour.dark_theme docstring.

* Escape multi-line quotes properly

Fix Rapptz#5897

* Properly insert at the end if position is not found when moving.

Fixes Rapptz#5923

* Evict keys when they're set to None in PermissionOverwrite

Fixes Rapptz#5929

* Mark intent alias flags as actual aliases to skip them in __iter__

Fix Rapptz#5945

* Fix disconnect when trying to move to another voice channel.

Not overly proud of this implementation but this allows the library
to differentiate between a 4014 that means "move to another channel" or
"move nowhere". Sometimes the VOICE_STATE_UPDATE comes before the
actual websocket disconnect so special care had to be taken in that
case.

Fix Rapptz#5904

* Fix attribute errors when timing out during chunking start-up

* Add internal method to check if the websocket is currently ratelimited

* Ensure our own member is never evicted from the cache in any policy.

* [commands] Lazily fetch members in discord.Member converters

This makes commands taking members mostly work transparently without
much effort from the user.

* Load member from guild_member_update dispatch

* Allow concurrent calls to guild.chunk()

This allows people who write guild.chunk() calls in highly concurrent
places such as on_message or checks to not spam the gateway with an
actual request and instead waits for the pre-existing request to finish

* Fix error when querying members from the gateway.

I accidentally made this return True instead of the actual member list

* Add changelog for v1.5.1

* Version bump to v1.5.1

* Translation sync with crowdin

* Implement icon_rl_as and cover_image_url_as for AppInfo

* Raise ClientException when members intent is not enabled on guild.fetch_members

* [commands] Update MessageConverter link regex

Remove redundant parts of the MessageConverter regexes and support www

* Emphasize intents in the constructors of the examples

* Raise DiscordServerError for 503 Service Unavailable errors

* Properly document that categories throw 404's on create_invite.

* Add Colour.random factory method

* Clarify Colour.random RNG

* Bump version for development purposes

* Fix error with templates not having access to member cache flags.

This also changes the attribute from having an underscore

Fix Rapptz#5986

* Fix attribute error during rapid disconnects in VoiceClient.

Fix Rapptz#6039

* Clear the connected flag when potentially reconnecting the player

Fix Rapptz#5953

* Bump dependencies for 3.9 to work without build tools

Fix Rapptz#5984, Rapptz#5970

* Suppress the creation of a command window from ffmpeg on Windows

Fix Rapptz#6038

* Add sticker support

* Don't store a user cache if there's no member intent or cache is off

Without a cache or member intent the user cache can get out of date
with no events to update the underlying user in the member object.

Ref: Rapptz#6034

* Ensure member key is not overwritten by author key in MESSAGE_UPDATE

This also coerces the older message to take the member data from the
newer message so the types are not incompatible.

Fix Rapptz#5999

* Sticker implementation cleanup

* [commands] Fetch user if an ID is passed and cache lookup fails.

* Fix preview_asset key name in Sticker

* [commands] Allow setting description of cogs

* Implement role tags.

This comes with:

* The RoleTags class
* Role.is_premium_subscriber()
* Role.is_bot_managed()
* Role.is_integration()
* Guild.self_role
* Guild.premium_subscriber_role

* Add a way to check if the websocket is rate limited.

This is mainly for low level decision making for utilities that need
to know whether to fetch a member by HTTP or to query through the
websocket.

The library already does this trick in some places so it's only fair
that end users possess the same ability as well.

* Fix `discord.RoleTags` resolution

* Implement discord.Message.reply

* Code cleanup involving enums and message replies

* Allow MessageReference to be constructible by users

* Added MessageReference.resolved attribute to get replied to message

* Correct docstring missing ]

* Fix Message.to_reference from the MessageReference changes

* Change reply example to use replies

* Fix `UnboundLocalError` for editing `public_updates_channel`

* [chore] Remove redundant imports

This also removes the historical patch for NullHandler implemented in bbf1c54, as it has been available since Python 3.1.

* [bug] call super constructor for `CustomActivity` to fix `created_at`

* Fix Team.icon_url_as format argument default value

* Add reaction roles example

* Update documentation for rules/updates channels

* Add support for chunking AsyncIterator objects

* [commands] Cog unload failures are swallowed.

Fix Rapptz#6113

* Add created_at property to PartialEmoji

Also fixed docstring for PartialEmoji.url

Co-authored-by: Tarek <[email protected]>
Co-authored-by: apple502j <[email protected]>
Co-authored-by: Anurag <[email protected]>
Co-authored-by: NCPlayz <[email protected]>
Co-authored-by: Jeffrey <[email protected]>
Co-authored-by: Tsumiki <[email protected]>
Co-authored-by: Rapptz <[email protected]>
Co-authored-by: Sebastian Law <[email protected]>
Co-authored-by: jack1142 <[email protected]>
Co-authored-by: Josh <[email protected]>
Co-authored-by: Skezza <[email protected]>
Co-authored-by: Znunu <[email protected]>
Co-authored-by: James <[email protected]>
Co-authored-by: James <[email protected]>
Co-authored-by: AXVin <[email protected]>
Co-authored-by: Jaime Garcia Jr <[email protected]>
Co-authored-by: Jaime Garcia Jr <[email protected]>
Co-authored-by: Riley S <[email protected]>
Co-authored-by: Tyler North <[email protected]>
Co-authored-by: Dan Hess <[email protected]>
Co-authored-by: Xua <[email protected]>
Co-authored-by: ELginas <[email protected]>
Co-authored-by: Bryan Forbes <[email protected]>
Co-authored-by: Vexs <[email protected]>
Co-authored-by: Patrick <[email protected]>
Co-authored-by: Zomatree <[email protected]>
Co-authored-by: sinus-x <[email protected]>
Co-authored-by: Nanofaux <[email protected]>
Co-authored-by: parafoxia <[email protected]>
Co-authored-by: alkatar21 <[email protected]>
Co-authored-by: Andres Torres <[email protected]>
Co-authored-by: Alex Nørgaard <[email protected]>
Co-authored-by: Saphielle Akiyama <[email protected]>
Co-authored-by: Simon Beal <[email protected]>
Co-authored-by: khazhyk <[email protected]>
Co-authored-by: Skye Im <[email protected]>
Co-authored-by: BluePhoenixGame <[email protected]>
Co-authored-by: rodovia <[email protected]>
Co-authored-by: Duck <[email protected]>
Co-authored-by: iomintz <[email protected]>
Co-authored-by: iDutchy <[email protected]>
Co-authored-by: PikalaxALT <[email protected]>
Co-authored-by: Michael <[email protected]>
Co-authored-by: Muhammad Hamza <[email protected]>
Co-authored-by: Nekokatt <[email protected]>
Co-authored-by: ChristopherJHart <[email protected]>
Co-authored-by: Eric Chan <[email protected]>
Co-authored-by: PythonCoderAS <[email protected]>
Co-authored-by: numbermaniac <[email protected]>
Co-authored-by: Florian Spieß <[email protected]>
Co-authored-by: Lukas <[email protected]>
Co-authored-by: Jonathan Feenstra <[email protected]>
Co-authored-by: Harmon <[email protected]>
Co-authored-by: webtax-gh <[email protected]>
Co-authored-by: Caio Alexandre <[email protected]>
Co-authored-by: SNVMK <[email protected]>
Co-authored-by: Kippiii <[email protected]>
Co-authored-by: RocketRace <[email protected]>
yagomichalak pushed a commit to yagomichalak/discord.py that referenced this issue May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This is a bug with the library.
Projects
None yet
Development

No branches or pull requests

2 participants