Discord-py

Latest version: v0.16.12

Safety actively analyzes 682487 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 9

3.0.1

A tiny update to support webhook-sent messages properly!

- Added the utility methods `Messagewebhook?` and `Userwebhook?` to check whether a message or a user belongs to a webhook
- Added `Messagewebhook_id` to get the ID of the sending webhook for webhook messages
- Added the `webhook_commands` parameter to CommandBot that, if false (default true), prevents webhook-sent messages from being parsed and handled as commands.

Bugfixes

- Fixed webhook-sent messages being ignored because their author couldn't be resolved.
- Fixed a minor performance problem where a CommandBot would create unnecessarily create redundant objects for every received message.

3.0.0

I didn't think there could possibly be a release larger than 2.0.0 was, but here it is! Including the respective release commit, there were 540 commits from 1.8.1 to 2.0.0, but a whopping 734 commits from 2.1.3 to 3.0.0.

As with 2.0.0, there are some breaking changes! They are, as always, highlighted in bold.

- **The `application_id` parameter has been renamed to `client_id`**. With the changes to how bot applications work, it would just be confusing to have it be called `application_id` any longer. If you try to use `application_id` now, it will raise a descriptive exception; with 3.1.0 that will be removed too (you'll get a less descriptive exception).
- The gateway implementation has been completely rewritten, for more performance, stability and maintainability. This means that **to call some internal methods like `inject_reconnect`, a `Gateway` instance (available as `Botgateway`) now needs to be used.**
- **User login using email and password has been removed**. Use a user token instead, see also [here](https://github.com/hammerandchisel/discord-api-docs/issues/69issuecomment-223886862).
- In addition to the rewrite, the gateway version has also been upgraded to protocol version 6 (the rewrite was for v5). **With this, the way channel types are handled has been changed a bit!** If you've been using the abstraction methods like `Channelvoice?`, you should be fine though. This also includes support for group chats on user accounts, as that was the only real functionality change on v6. ([211](https://github.com/meew0/discordrb/pull/211), thanks Daniel-Worrall)
- **Custom prefix handlers for `CommandBot`s now get the full message object as their parameter rather than only the content**, for even more flexibility.
- For internal consistency, **the `UnknownGuild` error was renamed to `UnknownServer`**. I doubt this change affects anyone, but if you handle that error specifically in your bot, make sure to change it.
- **The API module has undergone a refactor**, if you were using any manual API calls you will have to update them to the new format. Specifically, endpoints dealing with channels have been moved to `API::Channel`, ones dealing with users to `API::User` and so on. ([203](https://github.com/meew0/discordrb/pull/203), thanks depl0y)
- **Calling `users` on a text channel will now only return users who have permission to read it** ([186](https://github.com/meew0/discordrb/issues/186))
- A variety of new fields have been added to `Message` objects, specifically embeds (`Messageembeds`), when it was last edited (`edited_timestamp`), whether it uses TTS (`tts?`), its nonce (`nonce`), whether it was ever edited (`edited?`), and whether it mentions everyone (`mention_everyone?`) ([206](https://github.com/meew0/discordrb/pull/206), thanks SnazzyPine25)
- A variety of new functionality has been added to `Server` and `Channel` objects ([181](https://github.com/meew0/discordrb/pull/181), thanks SnazzyPine25):
- Bitrate and user limit can now be read and set for voice channels
- Server integrations can now be read
- Server features and verification level can now be read
- Utility functions to generate widget, widget banner and splash URLs
- Message pinning is now supported, both reading pin status and pinning existing messages ([145](https://github.com/meew0/discordrb/issues/145) / [146](https://github.com/meew0/discordrb/pull/146), thanks hlaaftana)
- Support for the new available statuses:
- `Botdnd` to make the bot show up as DnD (red dot)
- `Botinvisible` to make the bot show up as offline
- Setting the bot's status to streaming is now supported ([128](https://github.com/meew0/discordrb/pull/128) and [143](https://github.com/meew0/discordrb/pull/143), thanks SnazzyPine25 and barkerja)
- You can now set a message to be sent when a `CommandBot`'s command fails with a `NoPermission` error ([200](https://github.com/meew0/discordrb/pull/200), thanks PoVa)
- There is now an optional field to list the parameters a command can accept ([201](https://github.com/meew0/discordrb/pull/201), thanks FormalHellhound)
- Commands can now have an array of roles set that are required to be able to use it ([178](https://github.com/meew0/discordrb/pull/178), thanks PoVa)
- Methods like `CommandEvent<<` for quickly responding to an event are now available in `MessageEvent` too ([154](https://github.com/meew0/discordrb/pull/154), thanks hlaaftana)
- Temporary messages, that automatically delete after some time, can now be sent to channels ([136](https://github.com/meew0/discordrb/issues/136) / [139](https://github.com/meew0/discordrb/pull/139), thanks unleashy)
- Captions can now be sent together with files, and files can be attached to events to be sent on completion ([130](https://github.com/meew0/discordrb/pull/130), thanks SnazzyPine25)
- There is now a `Channelload_message` method to get a single message by its ID ([174](https://github.com/meew0/discordrb/pull/174), thanks z64)
- `Channeldefine_overwrite` can now be used with a `Profile` object, together with some internal changes ([232](https://github.com/meew0/discordrb/issues/232))
- There are now endpoint methods to list a server's channels and channel invites ([197](https://github.com/meew0/discordrb/pull/197))
- Two methods, `Memberroles=` and `Membermodify_roles` to manipulate a member's roles in a more advanced way have been added ([223](https://github.com/meew0/discordrb/pull/223), thanks z64)
- Role mentionability can now be set using `Rolementionable=`
- The current bot's OAuth application can now be read ([175](https://github.com/meew0/discordrb/pull/175), thanks SnazzyPine25)
- You can now mute and deafen other members ([157](https://github.com/meew0/discordrb/pull/157), thanks SnazzyPine25)
- The internal `Logger` now supports writing to a file instead of STDOUT ([171](https://github.com/meew0/discordrb/issues/171))
- Building on top of that, you can also write to multiple streams at the same time now, in case you want to have input on both a file and STDOUT, or even more advanced setups. ([217](https://github.com/meew0/discordrb/pull/217), thanks PoVa)
- Roles can now have their permissions bitfield set directly ([177](https://github.com/meew0/discordrb/issues/177))
- The `Botinvite_url` method now supports adding permission bits into the generated URL ([218](https://github.com/meew0/discordrb/pull/218), thanks PoVa)
- A utility method `Usersend_file` has been added to directly send a file to a user in PM ([168](https://github.com/meew0/discordrb/issues/168) / [172](https://github.com/meew0/discordrb/pull/172), thanks SnazzyPine25)
- You can now get the list of members that have a particular role assigned using `Rolemembers` ([147](https://github.com/meew0/discordrb/pull/147), thanks hlaaftana)
- You can now check whether a `VoiceBot` is playing right now using `playing?` ([137](https://github.com/meew0/discordrb/pull/137), thanks SnazzyPine25)
- You can now get the channel a `VoiceBot` is playing on ([138](https://github.com/meew0/discordrb/pull/138), thanks snapcase)
- The permissions bit map has been updated for emoji, "Administrator" and nickname changes ([180](https://github.com/meew0/discordrb/pull/180), thanks megumisonoda)
- A method `Botconnected?` has been added to check whether the bot is currently connected to the gateway.
- The indescriptive error message that was previously sent when calling methods like `Botgame=` without an active gateway connection has been replaced with a more descriptive one.
- The bot's token is now, by default, redacted from any logging output; this can be turned off if desired using the `redact_token` initialization parameter. ([225](https://github.com/meew0/discordrb/issues/225) / [231](https://github.com/meew0/discordrb/pull/231), thanks Daniel-Worrall)
- The new rate limit headers are now supported. This will have no real impact on any code using discordrb, but it means discordrb is now considered compliant again. See also [here](https://github.com/hammerandchisel/discord-api-docs/issues/108).
- Rogue presences, i.e. presences without an associated cached member, now print a log message instead of being completely ignored
- A variety of aliases have been added to existing methods.
- An example to show off voice sending has been added to the repo, and existing examples have been improved.
- A large amount of fixes and clarifications have been made to the docs.

Bugfixes

- The almost a year old bug where changing the own user's username would reset its avatar has finally been fixed.
- The issue where resolving a large server with the owner offline would sometimes cause a stack overflow has been fixed ([169](https://github.com/meew0/discordrb/issues/169) / [170](https://github.com/meew0/discordrb/issues/170) / [191](https://github.com/meew0/discordrb/pull/191), thanks stoodfarback)
- Fixed an issue where if a server had an AFK channel set, but that AFK channel couldn't be connected to, resolving the server (and in turn all objects depending on it) would fail. This likely fixes any random `NoPermission` errors you've ever encountered in your log.
- A message's author will be resolved over the REST API like other objects in case it's not cached yet. This should fix all instances of "Member not cached even thought it should be". ([210](https://github.com/meew0/discordrb/pull/210), thanks megumisonoda)
- Voice state handling has been completely redone, fixing a variety of caching issues. ([159](https://github.com/meew0/discordrb/issues/159))
- Getting a voice channel's users no longer does a chunk request ([142](https://github.com/meew0/discordrb/issues/142))
- `Channeldefine_overwrite` can now be used to define user overwrites, apparently that didn't work at all before
- Nested command chains where an inner command doesn't exist now no longer crash the command chain handler ([215](https://github.com/meew0/discordrb/issues/215))
- Gateway errors should no longer spam the console ([141](https://github.com/meew0/discordrb/issues/141) / [148](https://github.com/meew0/discordrb/pull/148), thanks meew0)
- Role hoisting (both setting and reading it) should now work properly
- The `VoiceBotstop_playing` method should now work more predictably
- Voice states with a nil channel should no longer crash when accessed ([183](https://github.com/meew0/discordrb/pull/183), thanks Apexal)
- A latent bug in how PM channels were cached is fixed, previously they were cached twice - once by channel ID and once by recipient ID. Now they're only cached by recipient ID.
- Two problems in how Discord outages are handled are now fixed; the bot should now no longer break when one happens. Specifically, the fixed problems are:
- `GUILD_DELETE` events for unavailable servers are now ignored
- Opcode 9 packets which are received while no session currently exists are handled correctly
- A possible regression in PM channel creation was fixed. ([227](https://github.com/meew0/discordrb/issues/227) / [228](https://github.com/meew0/discordrb/pull/228), thanks heimidal)

2.1.3

*Bugfix-only release.*

Bugfixes

- Various messages that were just printed to stdout that should have been using the `Logger` system now do ([132](https://github.com/meew0/discordrb/issues/132) and [133](https://github.com/meew0/discordrb/pull/133), thanks PoVa)
- A mistake in the documentation was fixed ([140](https://github.com/meew0/discordrb/issues/140))
- Handling of the `GUILD_MEMBER_DELETE` gateway event should now work even if, for whatever reason, Discord sends an invalid server ID ([129](https://github.com/meew0/discordrb/issues/129))
- If the processing of a particular voice packet takes too long, the user will now be warned instead of an error being raised ([134](https://github.com/meew0/discordrb/issues/134))

2.1.2

- A reader was added (`Botawaits`) to read the hash of awaits, so ones that aren't necessary anymore can be deleted.
- `Channelprune` now uses the bulk delete endpoint which means it will be much faster and no longer rate limited ([118](https://github.com/meew0/discordrb/pull/118), thanks snapcase)

Bugfixes

- A few unresolved links in the documentation were fixed.
- The tracking of streamed servers was updated so that very long lists of servers should now all be processed.
- Resolution methods now return nil if the object to resolve can't be found, which should alleviate some rare caching problems ([124](https://github.com/meew0/discordrb/pull/124), thanks Snazzah)
- In the rare event that Discord sends a voice state update for a nonexistent member, there should no longer be a gateway error ([125](https://github.com/meew0/discordrb/issues/125))
- Network errors (`EPIPE` and the like) should no longer cause an exception while processing ([127](https://github.com/meew0/discordrb/issues/127))
- Uncached members in messages are now logged.

2.1.1

*Bugfix-only release.*

Bugfixes

- Fixed a caching error that occurred when deleting roles ([113](https://github.com/meew0/discordrb/issues/113))
- Commands should no longer be triggered with nil authors ([114](https://github.com/meew0/discordrb/issues/114))

2.1.0

- API support for the April 29 Discord update, which was the first feature update in a while with more than a few additions to the API, was added. This includes: ([111](https://github.com/meew0/discordrb/pull/111))
- Members' nicknames can now be set and read (`Membernick`) and updates to them are being tracked.
- Roles now have a `mentionable?` property and a `mention` utility method.
- `Message` now tracks a message's role mentions.
- The internal REST rate limit handler was updated:
- It now tracks message rate limits server wide to properly handle new bot account rate limits. ([100](https://github.com/meew0/discordrb/issues/100))
- It now keeps track of all requests, even those that are known not to be rate limited (it just won't do anything to them). This allows for more flexibility should future rate limits be added.
- Guild sharding is now supported using the optional `shard_id` and `num_shards` to bot initializers. Read about it here: https://github.com/hammerandchisel/discord-api-docs/issues/17 ([98](https://github.com/meew0/discordrb/issues/98))
- Commands can now require users to have specific action permissions to be able to execute them using the `:required_permissions` attribute. ([104](https://github.com/meew0/discordrb/issues/104) / [112](https://github.com/meew0/discordrb/pull/112))
- A `heartbeat` event was added that gets triggered every now and then to allow for roughly periodic actions. ([110](https://github.com/meew0/discordrb/pull/110))
- Prefixes are now more flexible in the format they can have - arrays and callables are now allowed as well. Read the documentation for more info.([107](https://github.com/meew0/discordrb/issues/107) / [109](https://github.com/meew0/discordrb/pull/109))

Page 2 of 9

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.