This document displays the differences between each release of curious.
Bring voice code inline with the standard of the rest of the code.
- Change the voice gateway to use an async thread, rather than a regular thread.
- Document and make public
VoiceClient.get_packet_header()
,VoiceClient.get_voice_packet()
andVoiceClient.get_ip_discovery_packet()
.Make
AppInfo
a subclass ofDataclass
.Only sleep on shard creation until the last shard.
Move
Channel.is_private()
toChannel.private()
.Move
IDObject.timestamp()
toIDObject.snowflake_timestamp()
.Make some things use ID references rather than object references, and deprivatize the ID attributes on these objects.
Add support for channel categories in the API and the gateway.
Reorganize commands code significantly:
- Move all of the commands code out of
Client
.- Add new
CommandsManager
.- Overhaul
Context
to do more, such as the actual processing.- Remove
Command
in favour of annotated functions.Reorganize events code significantly:
- Move all the events code out of
Client
.- Add new
EventManager
.- Add event hooks, which are called with every event the bot receives.
- Overhaul
EventManager.wait_for()
so that it usescurio.Promise
rather than terrible events.- Change temporary listeners to raising ListenerExit instead of returning a truthy/falsey value.
Reboot shards properly when they disconnect, using a while True loop inside the TaskGroup.
Add
State.guilds_ordered
.Add a 5 second timeout to each request made.
Add
Message.get_invites()
andMessage.invites
to get invites that are inside a message object.Retry on h11 errors.
Use
asyncwebsockets
instead ofcuiows
.
ReactionPaginator
can now have an optional title that is added as the content for the message sent.
- Switch to the
asks
HTTP library over the bundled HTTP library.- Add
MessageType
.- Add
ChannelType.CATEGORY
.- Separate out HTTP URLs into a
Endpoints
class.- Properly wait on shards in the start handler.
Warning
This is the last version of curious that supports Python 3.5.
Add HTTPClient.get_audit_logs()
.
Add gateway event dispatching.
Add HTTPClient.get_vanity_url()
and
HTTPClient.edit_vanity_url()
.
Add Guild.get_vanity_invite()
and Guild.set_vanity_invite()
.
Guild.get_invites()
will now return the vanity invite, if applicable.
Rearrange guild objects somewhat:
- Turn
Guild.channels
into aGuildChannelWrapper
.- Turn
Guild.roles
into aGuildRoleWrapper
.- Move
Guild.create_channel()
toGuildChannelWrapper.create()
.- Move
Guild.edit_channel()
toChannel.edit()
.- Move
Guild.delete_channel()
toChannel.delete()
.- Move
Guild.create_role()
toGuildRoleWrapper.create()
.- Move
Guild.edit_role()
toRole.edit()
.- Move
Guild.delete_role()
toRole.delete()
.
Add a message_mentioned
event.
Add User.static_avatar_url
.
Guild.large
now obeys a custom large_threshold
.
Add counts to guild_chunk
and guild_sync
events.
Fix editing profile via User.edit()
.
Add HTTPClient.get_user_applications()
and HTTPClient.get_application()
.
Don’t include @everyone
when calculating role colours.
VoiceState
now uses a property reference to the User object.Add
HTTPClient.get_mentions()
.Add
BotUser.authorized_apps
which returns an async iterator that can be used to get the authorized apps for this bot.Add
BotUser.get_recent_mentions()
andGuild.get_recent_mentions()
to allow easy iteration of recent mentions.Change statuses to new
Presence
, which are stored on Member and RelationshipUser instances.
Guild._large
is now set by GUILD_SYNC handling for userbots.Optimize
State.make_message()
slightly, by checking the cache before editing it.
_prepare_request()
automatically stringifies all items in the query string before sending it.Add search support:
HTTPClient.search_channel()
andHTTPClient.search_guild()
are the raw HTTP methods for searching.SearchQuery
,SearchResults
andMessageGroup
are the high level wrappers for searching.Add
AsyncIteratorWrapper.next()
andAsyncIteratorWrapper.all()
.Change
Guild
objects on dataclasses to mostly look up via property or weak reference rather than having a strong reference.Change commands:
- A callable that takes
(bot, message)
and returns (a) prefix(es) to match can now be provided forcommand_prefix
.- Functions are unwrapped for the .factory attr if possible.
Add the ability to listen to multiple events with one function.
Add
MFALevel
,VerificationLevel
,NotificationLevel
,ContentFilterLevel
, and update the relevant attributes onGuild
.Add HTTP downloading methods to
Client
.Add
Channel.nsfw
.
Client.start()
will now automatically reboot shards that return.Add
HTTPClient.get_authorized_apps()
to get the authorized apps for this account.Add
HTTPClient.revoke_authorized_app()
to revoke an application’s authorization.Add
BotUser.get_authorized_apps()
as the high-level equivalent.Add
Message.channel_id
andMessage.author_id
to access the raw IDs from Discord, even if the message author or channel is not cached.Unprivatize
State.find_channel()
and addClient.find_channel()
to use this method.Unprivatize
State.is_ready()
.Change sharding slightly:
Client.boot_shard()
will boot one shard and add its gateway to the internal list. This will allow finer control over shard booting.Client.start()
will now useboot_shard
to load a shard, so overriding it in a subclass can customize shard creation.The client will now wait for the gateway to be ready before firing any events.
Add
BotType
to more finely control how bots are defined.Add
EventContext.event_name
,EventContext.handlers
.Add
Client.events_handled
andGateway._dispatches_handled
to show how many events have been handled during the lifetime of the bot.Add
GuildStore
which tracks the order of guilds for user bots, and can be used to return the guilds in that order.Change
Channel
for group DMs slightly:
- New attributes have been added:
Channel.owner
,Channel.owner_id
,Channel._icon_hash
,Channel.icon_url
.Channel._recipients
has been added to replacerecipients
as the backing store, and is now a dict.- Correspondingly,
Channel.recipients
is a mapping proxy forChannel._recipients
, and can be used to access the recipients of the channel.Add
HTTPClient.update_user_settings()
to update the settings of a user.Add
UserSettings
to represent the settings of a user.Add event handler for
USER_SETTINGS_UPDATE
.
- Sync/chunk guilds when a
GUILD_CREATE
is received during the main bot lifecycle.- Decache users automatically when a
GUILD_DELETE
is received.- Fix the default role not being accounted for in permissions.
- Fix
GUILD_ROLE_DELETE
handling.- Fix async threads hanging the bot on shutdown.
- Add the ability to set
afk
in a presence change, to allow self-bots to not eat notifications.- Userbots will now ask for member chunks and then sync guilds once all chunks are received.
- Make
Guild.large
a property rather than an attribute. Discord doesn’t always send this properly, so fallback tomember_count >= 250
.
Add user account logging in support.
Add
_friends
and_blocked
toState
to represent the friends and blocked users a client has.Add
friends
andblocked
properties toBotUser
which can be used to access the State’s attributes.Add a new type called
RelationshipUser
which represents either a friend or a blocked user.Rearrange channel and guild handling in
READY
parsing.Fix
author
inside private DMs being wrong sometimes.Allow group DMs to work properly.
User cache has been redesigned:
- Users are now cached indefinitely in
_users
.- Users are referred to by property on
Member
rather than by storing them. This should reduce some memory usage as duplicate members will no longer store multiple instances of a user.- Users are only decached on a guild member remove.
State.make_user()
now takes auser_klass
param which allows customization of the user class created when caching a user.Users are now updated in
PRESENCE_UPDATE
rather thanGUILD_MEMBER_UPDATE
.
GUILD_SYNC
is now supported for user bots.Creating
HTTPClient
withbot=False
will send a user authorization header rather than a bot authorization header.Add
HTTPClient.get_user_profile()
to get a user’s profile.Add
HTTPClient.get_app_info()
to get the application information for a specific app. This method will attempt to download the bot information alongside the app - failing this, it will only request the basic app info scope.Remove
HTTPClient.get_application_info()
; callget_app_info
withNone
to get the current app’s info.Add
HTTPClient.authorize_bot()
to authorize a bot into a guild.Move
AppInfo
into its own module.Make
AppInfo
more useful than just the current application’s info.Add
bot
attribute toAppInfo
which returns the bot user associated with this app.Add
AppInfo.add_to_guild()
which authorizes a bot into a guild. Only user accounts can call this.Add
Client.get_application()
to get anAppInfo
object referring to an application.Add
HTTPClient.send_friend_request()
,HTTPClient.remove_relationship()
,HTTPClient.block_user()
for editing relationships with users.Add
User.send_friend_request()
,User.block()
,RelationshipUser.remove_friend()
andRelationshipUser.unblock()
to manage relationships between users.
BotUser
cannot send friend requests to itself or block itself.Add
User.get_profile()
to get a user’s profile.
Embed.set_image()
now validates that the link is a HTTP[S] link.
- Add
Widget
for support of widgets.- Add widget support inside the HTTPClient.
- Fix events inside cogs.
- Add new error code mapping to
HTTPException
. This provides clearer display as to what went wrong when performing a HTTP method.