174 Commits

Author SHA1 Message Date
Rapptz
8953938a53 Update Pyright to v1.1.394 2025-02-18 03:29:09 -05:00
Rapptz
ed615887f0 Handle improper 1000 closures by Discord 2024-10-28 18:11:33 -04:00
Lilly Rose Berner
91f300a28a
Add zstd gateway compression to speed profile 2024-10-09 17:30:03 -04:00
Andrin
a70217a719
Support for Soundboard and VC effects 2024-10-09 17:05:17 -04:00
Imayhaveborkedit
a9ff58724b
Fix move_to related voice state bugs 2024-01-26 20:14:19 -05:00
Rapptz
163a86c4a0 Raise WebSocketClosure on protocol level errors
Ref: #9561
2023-10-19 01:16:48 -04:00
Imayhaveborkedit
44284ae107
Rewrite voice connection internals 2023-09-28 17:51:22 -04:00
Imayhaveborkedit
7bdfd454be
Normalize thread names
Every thread now has a name and either a contextually relevant
identifier or their in hex to disambiguate multiple threads of the same
type.  Also finally gets rid of that old python 2 style init call.
2023-09-03 02:41:16 -04:00
Andrew Morgan
8ba830eeb8
Include ssrc parameter when sending a SPEAKING payload
As it is a required parameter.

Don't unnecessarily send a second SPEAKING payload after
connecting to voice

We do need to send a SPEAKING payload in order to set our SSRC value
after connecting to voice, yet that can be with a `state` of 0
(SpeakingState.none).

There is no reason to send 2 packets; one marking ourselves as
speaking, and then not speaking.
2023-03-14 03:18:23 -04:00
Florian Spieß
6910943703
Fix udp discovery not using 74 byte layout 2023-03-01 18:11:06 -05:00
Rapptz
8aaeb6acfa Parse gateway URL as an actual URL using yarl
Discord has changed the URL format to make it infeasible to edit it
using basic string interpolation.
2022-09-17 22:51:23 -04:00
Rapptz
3802780f77 Change a lot of logging INFO calls to be less verbose
Some of the logs were only useful for debug scenarios, so they have
been downgraded to DEBUG. Others were in INFO but supposed to be in
WARNING so those were upgraded.
2022-08-15 10:21:36 -04:00
Rapptz
7da2048d1a Add support for resume_gateway_url 2022-08-10 22:47:27 -04:00
Bryan Forbes
d707019348
Bump Pyright to 1.1.265, fix type errors, and remove unnecessary ignores 2022-08-04 22:46:02 -04:00
Rapptz
922e52b6df Update IDENTIFY payload to match new format 2022-06-17 20:56:44 -04:00
Rapptz
66881ba458 Remove gateway trace information
This was unused anyway
2022-06-13 01:06:15 -04:00
Lilly Rose Berner
2dbf14bb72
Separately delay ready event for each shard 2022-04-25 02:01:46 -04:00
Rapptz
c582940401 Remove ancient IDENTIFY key that is no longer used 2022-04-05 05:22:00 -04:00
Kellen
0f18d93e47
Remove unused imports 2022-04-02 04:58:39 -04:00
jack1142
5ffa3e85de
Update comments after # type: ignore to be compatible with PEP 484 2022-03-27 22:26:34 -04:00
Rapptz
6d75d2e937 Fix unnecessary type ignores in gateway 2022-03-16 01:19:45 -04:00
Stocker
5aa696ccfa
Fix typing issues and improve typing completeness across the library
Co-authored-by: Danny <Rapptz@users.noreply.github.com>
Co-authored-by: Josh <josh.ja.butt@gmail.com>
2022-03-13 23:52:10 -04:00
Rapptz
58ad146a4e Remove window re-assignment in gateway rate limiter
This was a hold over from the old cooldown implementation.
2022-03-13 12:09:07 -04:00
Rapptz
0c690bc949 Fix audio not sending
Fixes #7531
2022-03-08 01:18:32 -05:00
Predä
32f131566f
Update gateway version docstring in DiscordWebSocket 2022-02-27 21:18:41 -05:00
Josh
2b69b5d545
Remove discord.InvalidArgument
This uses TypeError and ValueError instead.
2022-02-26 01:44:49 -05:00
Rapptz
8d52ddaff6 Fix remaining type errors in main package
This doesn't fix the type errors in the ext packages though.
2022-02-22 04:19:46 -05:00
Josh
c8064ba6f2 Type-hint gateway 2022-02-22 03:59:58 -05:00
Rapptz
88b520b5ab Reformat code using black
Segments where readability was hampered were fixed by appropriate
format skipping directives. New code should hopefully be black
compatible. The moment they remove the -S option is probably the moment
I stop using black though.
2022-02-20 08:04:58 -05:00
Rapptz
78598d59d7 Change on_socket_raw_receive to dispatch right before JSON conversion 2021-08-25 01:26:37 -04:00
Rapptz
4a72201617 Make json conversion functions private 2021-08-22 02:35:58 -04:00
Rapptz
ea2d972666 Make global log variable in modules private 2021-08-22 02:33:51 -04:00
Rapptz
035d110837 Fix debug event toggle not triggering for raw receive 2021-08-01 02:42:11 -04:00
Rapptz
b640493300 Add enable_debug_events parameter to enable expensive debug events
This should allow less dispatching during heavy gateway event streams.
2021-07-31 20:35:28 -04:00
Rapptz
e2250d402e Add on_socket_event_type event 2021-07-31 20:12:40 -04:00
Aaron Hennessey
15eb3d2e5d
Remove afk parameter from change_presence 2021-07-21 02:45:57 -04:00
Rapptz
88d825a803 Allow use of orjson instead of json
The difference in speed seems negligible at start up, which is when
most time is taken for actually parsing JSON. I could potentially be
missing something but profiling didn't point to any discernable
difference.
2021-07-07 20:19:17 -04:00
Imayhaveborkedit
ac061c31fb
Fix default hook signature
Since the hook function can be both bound and unbound
the bound signature needs to accept an extra argument
2021-05-25 02:22:21 -04:00
Imayhaveborkedit
8e08bd6af2
Add vws message hook 2021-05-23 03:42:07 -04:00
Rapptz
81b259ab36 Fix sending arrays with nulls in them when changing presences 2021-05-16 07:15:53 -04:00
apple502j
dea92a69dc
Remove support for guild subscriptions 2021-04-14 00:47:46 -04:00
Rapptz
d85805ab6d First pass at supporting v8 API 2021-04-11 00:39:13 -04:00
Rapptz
54288879e2 Remove userbot functionality
This has a lot of legacy and cruft so there may be some stuff I've
missed but this first pass is enough to get a clear separation.
2021-04-04 10:15:30 -04:00
Rapptz
9d39b135f4 Modernize code to use f-strings
This also removes the encoding on the top, since Python 3 does it by
default. It also changes some methods to use `yield from`.
2021-04-04 07:03:53 -04:00
Nadir Chowdhury
63ec23bac2
Code optimisations and refactoring via Sourcery 2021-02-24 21:26:51 -05:00
Riley Shaw
fafc3d9185
Fix ZeroDivisionError in DiscordVoiceWebSocket.average_latency 2021-02-18 06:53:08 -05:00
Nihaal Sangha
69bdc3a184
Change copyright year to present 2021-01-15 05:28:11 -05:00
Rapptz
5c868ed871 Fix SyntaxError from PR implementing presences in member querying 2021-01-01 09:37:47 -05:00
Nadir Chowdhury
59c11e71a2
Implement presences for Guild.query_members 2020-12-31 13:50:22 -05:00
Rapptz
2509ca6a82 Add internal method to check if the websocket is currently ratelimited 2020-10-17 22:51:29 -04:00