Releases: hikari-py/hikari
Bugfixing!
Hikari 2.0.0.dev110 (2022-08-08)
Breaking Changes
- Removed case of
Member.mentionreturning bang (!) mention, as it is deprecated by Discord. (#1207)
Deprecation
RESTClient.edit_permission_overwritesrenamed toRESTClient.edit_permission_overwrite(#1195)
Features
- Add
hikari.events.StickersUpdateEventand relevant cache internals.
Add sticker related public methods ontohikari.impl.CacheImplandhikari.guilds.Guild. (#1126) GuildVoiceChannelnow inherits fromTextableGuildChannelinstead ofGuildChannel. (#1189)- Add the
app_permissionsfield to command and component interactions. (#1201) - Add application command badge (#1225)
Bugfixes
- Fix how CommandBuilder handles
default_member_permissionsto match the behaviour on PartialCommand. (#1212)
Application commands V2 and polishing
Hikari 2.0.0.dev109 (2022-06-26)
Breaking Changes
- Removal of all application commands v1 related fields and endpoints.
- Discord has completely disabled some endpoints, so we unfortunately can't
deprecate them instead of removing them (#1148)
- Discord has completely disabled some endpoints, so we unfortunately can't
- Removed the
resolvedattribute fromAutocompleteInteractionas autocomplete interactions never have resolved objects. (#1152) buildmethods are now typed as returningMutableMapping[str, typing.Any]. (#1164)
Deprecation
messages.Mentionsobject deprecated- Alternatives can be found in the base message object (#1149)
Features
- Add
createmethod toCommandBuilder. (#1016) - Support for attachments in REST-based interaction responses. (#1048)
- Add option to disable automatic member chunking.
Added theauto_chunk_memberskwarg toGatewayBotandEventManagerImpl, which whenFalsewill disable automatic member chunking. (#1084) - Allow passing multiple event types to the listen decorator.
Parse union type hints for events if listen decorator is empty. (#1103) - Animated guild banner support. (#1116)
- Implement application commands permission v2.
- New
default_member_permissionsandis_dm_enabledrelated fields. - Added
hikari.events.application_events.ApplicationCommandPermissionsUpdate. - Added
APPLICATION_COMMAND_PERMISSION_UPDATEaudit log entry (#1148)
- New
Bugfixes
- Improved pyright support. (#1108)
RESTClientImpl.fetch_bansnow return aLazyIteratorto allow pagination of values. (#1119)- Fix unicode decode error caused by
latin-1encoding when sending the banner. (#1120) - Don't error on an out-of-spec HTTP status code (e.g one of Cloudflare's custom status codes).
HTTPResponseError.statusmay now be of typehttp.HTTPStatusorint. (#1121) - Fix name of polish locale (
hikari.Locale.OL->hikari.Locale.PL) (#1144) - Properly garbage collect message references in the cache
- Properly deserialize
PartialMessage.referenced_messageas a partial message (#1192)
- Properly deserialize
Scheduled events and huge event dispatching optimization
Breaking Changes
hikari.confighas now been split up tohikari.api.configandhikari.impl.configto avoid leaking impl detail.
This also means that config types are no-longer accessible at the top level (directly onhikari). (#1067)- Hide the entity factory's component deserialize methods. (#1074)
- Remove nonce parameter from create message.
This was purposely removed from the bot api documentation inferring that its no-longer officially supported. (#1075) - Remove
VoiceRegion.is_vipdue to Discord no longer sending it. (#1086) - Remove store sku related application fields and store channels. (#1092)
Deprecation
- Renamed
nickargument tonicknamefor edit member and add user to guild REST methods. (#1095)
Features
- Scheduled event support. (#1056)
get_guild()is now available onhikari.GuildChannel. (#1057)- Optimize receiving websocket JSON for the happy path. (#1058)
- The threaded file reader now persists the open file pointer while the context manager is active. (#1073)
- Optimize event dispatching by only deserializing events when they are needed. (#1094)
- Add
hikari.locales.Localeto help with Discord locale strings. (#1090)
Bugfixes
fetch_my_guildsno-longer returns duplicate guilds nor makes unnecessary (duplicated) requests whennewest_firstis set toTrue. (#1059)- Add
InviteEventtohikari.events.channel_events.__all__,hikari.events.__all__andhikari.__all__. (#1065) - Fix incorrect type for ATTACHMENT option values. (#1066)
EventManager.get_listenersnow correctly defines polymorphic and returns accordingly. (#1094)- Take the major param for webhook without token endpoints when handling bucket ratelimits. (#1102)
- Fix incorrect value for
GuildFeature.MORE_STICKERS. (#1989)
Cleanups and bugfixing
Features
- Added a
total_lengthfunction tohikari.embeds.Embed- Takes into account the character length of the embed's title, description, fields (all field names and values), footer, and author combined.
- Useful for determining if the embed exceeds Discord's 6000 character limit. (#796)
- Added attachment command option type support. (#1015)
- Add MESSAGE_CONTENT intent. (#1021)
- Custom substitutions can now be used in
hikari.internal.ux.print_banner. (#1022) get_guild()is now available onhikari.Member. (#1025)- The notorious "failed to communicate with server" log message is now a warning rather than an error. (#1041)
hikari.applications,hikari.files,hikari.snowflakesandhikari.undefinedare now all explicitly exported byhikari.__init__, allowing pyright to see them without a direct import. (#1042)
Bugfixes
-
Fix bucket lock not being released on errors while being acquired, which locked the bucket infinitely (#841)
-
enable_signal_handlersnow only defaults toTruewhen the run/start method is called in the main thread.
This avoids these functions from always raising when being run in a threaded environment as only the main thread can register signal handlers. (#998) -
Sub-command options are now properly deserialized in the autocomplete flow to
AutocompleteInteractionOptioninstead ofCommandInteractionOption. (#1012) -
Attempt to reconnect on a gateway
TimeoutError. (#1014) -
Properly close
GatewayBotwhen not fully started. (#1023) -
The async context manager returned by
File.streamnow errors on enter if the target file doesn't exist to improve error handling when a file that doesn't exist is sent as an attachment.The multiprocessing file reader strategy now expands user relative (
~) links (like the threaded strategy). (#1046)
Context menus and switch to PyNacl for interaction server
Breaking Changes
-
Running the standard interaction server implementation now requires a
hikari[server]install.This matches a switch over to PyNacl for the cryptographic payload validation. (#986)
Deprecation
-
Deprecated
RESTClient.command_builderandRESTClient.create_application_command.You should switch to
RESTClient.slash_command_builderandRESTClient.create_slash_commandrespectively. (#924)
Features
-
Add context menu commands and command autocomplete. (#924)
-
Added support for GET /users/@me/guilds/{guild}/member. (#955)
-
Add the
SUPPRESS_USER_JOIN_REPLIESsystem channel flag. (#957) -
Add new message content intent related application flags. (#958)
-
Add the
BOT_HTTP_INTERACTIONSuser flag. (#959) -
Add new presence activity flags. (#960)
-
Add URL methods and properties for rich presence assets. (#961)
-
Add
localeandguild_localeproperties to interactions. (#962) -
Add ability to send attachments in an interaction initial response. (#971)
-
Add
display_avatar_urlproperty tohikari.Memberandhikari.User. (#975) -
old_x keyword arguments in the event factory now default to
None. (#984) -
Strip tokens in the standard bot impls and RESTApp.
This helps avoids a common mistake with trailing new-lines which leads to confusing errors on request. (#989)
Bugfixes
- Relaxed typing of methods with union entry specific specialisations through overloads. (#876)
- Fix deprecation warnings raised by usage of
asyncio.gatheroutside of an active event loop inGatewayBot.run. (#954) - UTF-8 characters are now properly handled for audit-log reasons in REST requests. (#963)
- Fix magic methods for
UserImpland its subclasses. (#982)
Member timeout and bugfixes
Features
- Add min_value and max_value to
CommandOption(#920) - Add
flagsattribute to Application (#939) - Implement member timeouts
- Add
raw_communication_disabled_untilandcommunication_disabled_untiltoMember - Add
MODERATE_MEMBERStoPermission - Add
communication_disabled_untilattribute toedit_member(#940)
- Add
Bugfixes
- Improved pyright compatibility and introduced pyright "type-completeness" checking. (#916)
- Add EventStream.filter specialisation to the abc. (#917)
- Update the app command name regex to account for more recently documented support for non-english characters on Discord's end. (#918)
- Fix reposition_roles using the wrong route. (#928)
- Fix
PartialSticker.image_urlnot passing the hash as a string (#930) - Fixed the url being generated for role icons to not erroneously insert ".png" before the file extension (#931)
- Fix some bugs in message deserialization
- Remove case for setting
memberandreference_messagetoundefined.Undefinedin full message deserialization - Don't set
message.membertoundefined.UNDEFINEDon partial message deserialization if message was sent by a webhook (#933)
- Remove case for setting
Event type changes and various rest and other methods improvements
Breaking Changes
- Remove the redundant
ChannelCreateEvent,ChannelUpdateEventandChannelDeleteEventbase classes.
GuildChannelCreateEvent,GuildChannelUpdateEventandGuildChannelDeleteEventshould now be used. (#862) - Split bulk message delete from normal delete
- The new event is now
hikari.events.message_events.GuildBulkMessageDeleteEvent(#897)
- The new event is now
Deprecation
Features
- User banners and accent colors to user models. (#811)
- Add attachment "is_ephemeral" field (#824)
- Guild member avatars (#825)
- RESTClient
edit_my_membermethod which currently only takes "nick". (#827) - Add role icons (#838)
- RESTClient.entity_factory property (#848)
- Added component support to InteractionMessageBuilder. (#851)
EventStream.filternow always returnsEventStream. (#864)- Allow for passing a URL for avatar_url on execute_webhook. (#889)
- Add
old_messageattribute tohikari.events.message_events.MessageDelete(#897) - Switch to more relaxed requirements. (#906)
Bugfixes
- Don't raise in bulk delete when message not found by delete single message endpoint (#828)
- Setup basic handler if no handlers are defined in favour passed to
logging.config.dictConfig(#832) - InteractionMessageBuilder and RESTClientImpl.create_interaction_response now cast content to str to be consistent with the other message create methods. (#834)
- create_sticker method failing due to using an incorrect body. (#858)
- Fix logic for asserting listeners to not error when using defaults for other arguments (#911)
- Fix error message given by action row when a conflicted type is added. (#912)
Various bugfixes and improvements
Breaking Changes
USE_PUBLIC_THREADSandUSE_PRIVATE_THREADSpermissions have been removed in favour of new threads permission- New permissions are split into
CREATE_PUBLIC_THREADS,CREATE_PRIVATE_THREADSandSEND_MESSAGES_IN_THREADS(#799)
- New permissions are split into
GuildAvailableEventwill no longer fire when the bot joins new guilds- Some
guild_create-ish methods were renamed toguild_available(#809)
- Some
- Remove
hikari.errors.RESTErrorCodeenum- The message that is sent with the error code is the info that the enum contained (#816)
- PermissionOverwrite doesn't inherit from Unique anymore and isn't hashable. Equality checks now consider all its fields. (#820)
Features
- Add new
START_EMBEDDED_ACTIVITIESpermission (#798) - Support new
channel_typesfield inCommandOption(#800) - Add the
add_componentmethod tohikari.api.special_endpoints.ActionRowBuilder(#804) - Add
old_guildattribute toGuildLeaveEvent. (#806) - Add
GuildJoinEventthat will fire when the bot joins new guilds (#809)
Bugfixes
- Fix re-uploading forms with resources (#787)
- Prevent double linking embed resources, which causes them to upload twice
- This was caused by attempting to move the resource from one embed to another (#788)
- Fix
BulkDeleteErrorreturning incorrect values formessages_skipped- This affected the
__str__andpercentage_completion, which also returned incorrect values (#817)
- This affected the
Documentation Improvements
- Add docstrings to the remaining undocumented
GatewayBotmethods (#804)
Components and stickers
Deprecations and Removals
MessageType.APPLICATION_COMMANDrenamed toMessageType.CHAT_INPUT(#775)- Removal of deprecated
hikari.impl.bot.BotAppandhikari.traits.BotAware- Use
hikari.impl.bot.GatewayBotandhikari.traits.GatewayBotAwarerespectively instead (#778)
- Use
Features
- Message components support (#684)
- Web dashboard example with
rillrate(#752) - Sticker methods to PartialGuild (#754)
- Sticker audit log event types (#756)
- Helpful Application object methods (#757)
- Missing audit log change keys (#759)
- Retry request on 500, 502, 503 and 504 errors
- Default retry count is 3, with a hard top of 5. This can be changed with the
max_retriesargument (#763)
- Default retry count is 3, with a hard top of 5. This can be changed with the
- New
is_for_emojimethods to relevant reaction events (#770) - Add
USE_EXTERNAL_STICKERSpermission (#774) - Add
MessageType.CONTEXT_MENU_COMMANDmessage type (#775) - Add
ApplicationCommand.version(#776)
Bugfixes
- Handling of interaction models passed to the webhook message endpoints as the "webhook" field (#759)
- Fix passing
embedsarguments increate_interaction_responseandedit_initial_responseendpoints- Fix deserialization of embeds in
create_interaction_response - Fix
TypeErrorsraised inedit_initial_responsewhen passing a list of embeds (#779)
- Fix deserialization of embeds in
- Improve typing for message objects and message update methods
- Fix the use of
typing.Optionalwhereundefined.UndefinedOrshould have been used - Remove trying to acquire guild_id from the cached channel on PartialMessage
- Instead, clearly document the issue Discord imposes by not sending the guild_id
is_webhookwill now returnundefined.UNDEFINEDif the information is not available- Fix logic in
is_humanto account for the changes in the typing - Set
PartialMessage.membertoundefined.UNDEFINEDwhen Discord edit the message to display an embed/attachment (#783)
- Fix the use of
CommandInteractionOption.valuewill now be cast to aSnowflakefor types 6-9 (#785)
Improved Documentation
Base interactions, slash commands support and a lot of bugfixes
Breaking changes.
- New sticker objects with their respective routes
PartialSticker,GuildStickerandStandardSticker.
Message.contentnow defaults toNoneon an empty string- This was typed and expected but never enforced
- Application command events have been removed due to Discord no longer sending them
subscribeno longer returns the function that it is subscribingmemberandauthorare now separate attributes in GuildMessage* events to cause less confusionGuild.is_nsfwhas been replaced withGuild.nsfw_level- Switch cache configurations to flag based configurations
Application.verify_keyrenamed toApplication.public_keyEmoji.parsevalidation removed for the time being- This was removed due to a new unicode version breaking the emojis in old versions of Python and Discord not providing any standardization regarding emojis accepted by the API (discord/discord-api-docs#2782). In light of this, we have also removed
Emoji.unicode_namesas it is not guaranteed to not error
These will be re-enabled or replaced in the future
- This was removed due to a new unicode version breaking the emojis in old versions of Python and Discord not providing any standardization regarding emojis accepted by the API (discord/discord-api-docs#2782). In light of this, we have also removed
regionarguments have been moved fromx_guildtox_channel- This includes moving the attribute in the objects too
format_xmethods have been renamed tomake_x_urlMessage.linkhas been changed toMessage.make_link- This is due to
Message.linkrelying on cache and giving bad results when information was not available
- This is due to
Member.nicknamecan no longer beUndefined. It will default toNoneif unset- Remove
preview_asset_hashfromStickeras it has been fully removed from the API debugargument removed fromVoiceConnectionABC
Features
- Better and cleaner logging
- Base Interaction and slash commands support
- Message components are still being worked on and can be found here: #684
- Improve 50035 400 error reprs
- All components are now multi-use
- More helpful methods and properties added to objects.
- Even more speedups when using python optimization flags (
-Oor-OO) RESTAppis no longer bound to the loop after the first acquire (#619)- New
ComponentStateConflictErrorto better handle state in objects - You can now set the permissions argument to
create_roletoundefined.Undefinedto fallback to default Discord behavior. - Change in rate limit handling to per bucket locks
- This will greatly speedup your application and allow for multiple requests to different buckets without having to wait for another request to a different bucket to finish
- Ability to use models in cache calls (same functionality as REST)
get_guilds_viewmethod has been added to the cache- Ability to replace attachments when PATCHing messages
- See
edit_messageandedit_webhook_messagefor usage
- See
- New
ShardPayloadEventevent- This event will trigger when a shard receives a payload
- Improved interface around
delete_messagesto allow a sequence of messages - New
applications.ApplicationFlags ShardReadyEventnow provides theapplication_idandapplication_flags- New
USE_APPLICATION_COMMANDSpermission - New
Attachment.contentattribute - New
Team.nameattribute - New
Invite.expires_atattribute and newInviteWithMetadata.uses_leftproperty - Fetch authorization endpoint + models
#rest.fetch_authorizationapplications.AuthorizationApplicationapplications.AuthorizationInformation
- Stage channels + methods
- New message flags
MessageFlag.EPHEMERALMessageFlag.LOADING
- New message types
MessageType.GUILD_DISCOVERY_DISQUALIFIEDMessageType.GUILD_DISCOVERY_REQUALIFIEDMessageType.APPLICATION_COMMANDMessageType.GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNINGMessageType.GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNINGMessageType.GUILD_INVITE_REMINDER
- Slash commands OAuth2 scopes (slash command support will come in a future update)
OAuth2Scope.APPLICATIONS_COMMANDSOAuth2Scope.APPLICATIONS_COMMANDS_UPDATE
- Application TOS and privacy policy urls
Application.terms_of_service_urlApplication.privacy_policy_urlAuthorizationApplication.terms_of_service_urlAuthorizationApplication.privacy_policy_url
- New
GuildSystemChannelFlag.SUPPRESS_GUILD_REMINDER - A lot of new REST error codes under
errors.RESTErrorCode
Bug fixes
- Improve bot close sequence to always dispatch and wait on lifetime events
edit_permission_overwriteno longer uses the wrong method- Permissions being mishandled when de-serializing audit logs
- Incorrect keys in audit logs de-serialization
- De-serialization of
Application.public_keyto bytes - Send full heartbeat instead of ACK when receiving heartbeat
- Fix mis-usage of
PAYLOAD_ZLIB_STREAMwhereTRANSPORT_ZLIB_STREAMis being referred to - Improvement in how hikari manages unknown entities to prevent new entities from breaking entity de-serialization and stopping events from being dispatched
- Global lock is no longer acquired when not using authentication
UnicodeEmojiis now hashable
Packages bumped
- attrs 20.3.0 -> 21.2.0
- aiohttp 3.7.3 -> 3.7.4.post0
- colorlog 4.7.2 -> 6.4.1
- aiodns 2.0.0 -> 3.0.0