Skip to content

Releases: hikari-py/hikari

Scheduled events and huge event dispatching optimization

27 Mar 18:11
6dbab9a
Compare
Choose a tag to compare

Breaking Changes

  • hikari.config has now been split up to hikari.api.config and hikari.impl.config to avoid leaking impl detail.
    This also means that config types are no-longer accessible at the top level (directly on hikari). (#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_vip due to Discord no longer sending it. (#1086)
  • Remove store sku related application fields and store channels. (#1092)

Deprecation

  • Renamed nick argument to nickname for edit member and add user to guild REST methods. (#1095)

Features

  • Scheduled event support. (#1056)
  • get_guild() is now available on hikari.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.Locale to help with Discord locale strings. (#1090)

Bugfixes

  • fetch_my_guilds no-longer returns duplicate guilds nor makes unnecessary (duplicated) requests when newest_first is set to True. (#1059)
  • Add InviteEvent to hikari.events.channel_events.__all__, hikari.events.__all__ and hikari.__all__. (#1065)
  • Fix incorrect type for ATTACHMENT option values. (#1066)
  • EventManager.get_listeners now 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

04 Mar 16:09
8ef27c2
Compare
Choose a tag to compare
Pre-release

Features

  • Added a total_length function to hikari.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 on hikari.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.snowflakes and hikari.undefined are now all explicitly exported by hikari.__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_handlers now only defaults to True when 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 AutocompleteInteractionOption instead of CommandInteractionOption. (#1012)

  • Attempt to reconnect on a gateway TimeoutError. (#1014)

  • Properly close GatewayBot when not fully started. (#1023)

  • The async context manager returned by File.stream now 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

03 Feb 17:39
09910d6
Compare
Choose a tag to compare

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_builder and RESTClient.create_application_command.

    You should switch to RESTClient.slash_command_builderand RESTClient.create_slash_command respectively. (#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_REPLIES system channel flag. (#957)

  • Add new message content intent related application flags. (#958)

  • Add the BOT_HTTP_INTERACTIONS user flag. (#959)

  • Add new presence activity flags. (#960)

  • Add URL methods and properties for rich presence assets. (#961)

  • Add locale and guild_locale properties to interactions. (#962)

  • Add ability to send attachments in an interaction initial response. (#971)

  • Add display_avatar_url property to hikari.Member and hikari.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.gather outside of an active event loop in GatewayBot.run. (#954)
  • UTF-8 characters are now properly handled for audit-log reasons in REST requests. (#963)
  • Fix magic methods for UserImpl and its subclasses. (#982)

Member timeout and bugfixes

01 Jan 11:02
a382578
Compare
Choose a tag to compare
Pre-release

Features

  • Add min_value and max_value to CommandOption (#920)
  • Add flags attribute to Application (#939)
  • Implement member timeouts
    • Add raw_communication_disabled_until and communication_disabled_until to Member
    • Add MODERATE_MEMBERS to Permission
    • Add communication_disabled_until attribute to edit_member (#940)

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_url not 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 member and reference_message to undefined.Undefined in full message deserialization
    • Don't set message.member to undefined.UNDEFINED on partial message deserialization if message was sent by a webhook (#933)

Event type changes and various rest and other methods improvements

22 Nov 16:46
7954898
Compare
Choose a tag to compare

Breaking Changes

  • Remove the redundant ChannelCreateEvent, ChannelUpdateEvent and ChannelDeleteEvent base classes.
    GuildChannelCreateEvent, GuildChannelUpdateEvent and GuildChannelDeleteEvent should now be used. (#862)
  • Split bulk message delete from normal delete
    • The new event is now hikari.events.message_events.GuildBulkMessageDeleteEvent (#897)

Deprecation

  • edit_my_nick rest method. (#827)
  • EventStream is now a sync context manager, not async. (#864)

Features

  • User banners and accent colors to user models. (#811)
  • Add attachment "is_ephemeral" field (#824)
  • Guild member avatars (#825)
  • RESTClient edit_my_member method which currently only takes "nick". (#827)
  • Add role icons (#838)
  • RESTClient.entity_factory property (#848)
  • Added component support to InteractionMessageBuilder. (#851)
  • EventStream.filter now always returns EventStream. (#864)
  • Allow for passing a URL for avatar_url on execute_webhook. (#889)
  • Add old_message attribute to hikari.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

06 Oct 17:24
dc0f905
Compare
Choose a tag to compare
Pre-release

Breaking Changes

  • USE_PUBLIC_THREADS and USE_PRIVATE_THREADS permissions have been removed in favour of new threads permission
    • New permissions are split into CREATE_PUBLIC_THREADS, CREATE_PRIVATE_THREADS and SEND_MESSAGES_IN_THREADS (#799)
  • GuildAvailableEvent will no longer fire when the bot joins new guilds
    • Some guild_create-ish methods were renamed to guild_available (#809)
  • Remove hikari.errors.RESTErrorCode enum
    • 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_ACTIVITIES permission (#798)
  • Support new channel_types field in CommandOption (#800)
  • Add the add_component method to hikari.api.special_endpoints.ActionRowBuilder (#804)
  • Add old_guild attribute to GuildLeaveEvent. (#806)
  • Add GuildJoinEvent that 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 BulkDeleteError returning incorrect values for messages_skipped
    • This affected the __str__ and percentage_completion, which also returned incorrect values (#817)

Documentation Improvements

  • Add docstrings to the remaining undocumented GatewayBot methods (#804)

Components and stickers

19 Sep 21:07
3bdf1e4
Compare
Choose a tag to compare
Pre-release

Deprecations and Removals

  • MessageType.APPLICATION_COMMAND renamed to MessageType.CHAT_INPUT (#775)
  • Removal of deprecated hikari.impl.bot.BotApp and hikari.traits.BotAware
    • Use hikari.impl.bot.GatewayBot and hikari.traits.GatewayBotAware respectively instead (#778)

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_retries argument (#763)
  • New is_for_emoji methods to relevant reaction events (#770)
  • Add USE_EXTERNAL_STICKERS permission (#774)
  • Add MessageType.CONTEXT_MENU_COMMAND message type (#775)
  • Add ApplicationCommand.version (#776)

Bugfixes

  • Handling of interaction models passed to the webhook message endpoints as the "webhook" field (#759)
  • Fix passing embeds arguments in create_interaction_response and edit_initial_response endpoints
    • Fix deserialization of embeds in create_interaction_response
    • Fix TypeErrors raised in edit_initial_response when passing a list of embeds (#779)
  • Improve typing for message objects and message update methods
    • Fix the use of typing.Optional where undefined.UndefinedOr should 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_webhook will now return undefined.UNDEFINED if the information is not available
    • Fix logic in is_human to account for the changes in the typing
    • Set PartialMessage.member to undefined.UNDEFINED when Discord edit the message to display an embed/attachment (#783)
  • CommandInteractionOption.value will now be cast to a Snowflake for types 6-9 (#785)

Improved Documentation

  • Fix typo in Colorish docstring (#755)
  • Remove duplicate raise type in REST and guilds docstrings (#768)
  • Fix various spelling mistakes (#773)

Base interactions, slash commands support and a lot of bugfixes

28 Aug 08:51
9a93c10
Compare
Choose a tag to compare

Breaking changes.

  • New sticker objects with their respective routes
    • PartialSticker, GuildSticker and StandardSticker.
  • Message.content now defaults to None on an empty string
    • This was typed and expected but never enforced
  • Application command events have been removed due to Discord no longer sending them
  • subscribe no longer returns the function that it is subscribing
  • member and author are now separate attributes in GuildMessage* events to cause less confusion
  • Guild.is_nsfw has been replaced with Guild.nsfw_level
  • Switch cache configurations to flag based configurations
  • Application.verify_key renamed to Application.public_key
  • Emoji.parse validation 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_names as it is not guaranteed to not error
      These will be re-enabled or replaced in the future
  • region arguments have been moved from x_guild to x_channel
    • This includes moving the attribute in the objects too
  • format_x methods have been renamed to make_x_url
  • Message.link has been changed to Message.make_link
    • This is due to Message.link relying on cache and giving bad results when information was not available
  • Member.nickname can no longer be Undefined. It will default to None if unset
  • Remove preview_asset_hash from Sticker as it has been fully removed from the API
  • debug argument removed from VoiceConnection ABC

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 (-O or -OO)
  • RESTApp is no longer bound to the loop after the first acquire (#619)
  • New ComponentStateConflictError to better handle state in objects
  • You can now set the permissions argument to create_role to undefined.Undefined to 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_view method has been added to the cache
  • Ability to replace attachments when PATCHing messages
    • See edit_message and edit_webhook_message for usage
  • New ShardPayloadEvent event
    • This event will trigger when a shard receives a payload
  • Improved interface around delete_messages to allow a sequence of messages
  • New applications.ApplicationFlags
  • ShardReadyEvent now provides the application_id and application_flags
  • New USE_APPLICATION_COMMANDS permission
  • New Attachment.content attribute
  • New Team.name attribute
  • New Invite.expires_at attribute and new InviteWithMetadata.uses_left property
  • Fetch authorization endpoint + models
    • #rest.fetch_authorization
    • applications.AuthorizationApplication
    • applications.AuthorizationInformation
  • Stage channels + methods
  • New message flags
    • MessageFlag.EPHEMERAL
    • MessageFlag.LOADING
  • New message types
    • MessageType.GUILD_DISCOVERY_DISQUALIFIED
    • MessageType.GUILD_DISCOVERY_REQUALIFIED
    • MessageType.APPLICATION_COMMAND
    • MessageType.GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING
    • MessageType.GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING
    • MessageType.GUILD_INVITE_REMINDER
  • Slash commands OAuth2 scopes (slash command support will come in a future update)
    • OAuth2Scope.APPLICATIONS_COMMANDS
    • OAuth2Scope.APPLICATIONS_COMMANDS_UPDATE
  • Application TOS and privacy policy urls
    • Application.terms_of_service_url
    • Application.privacy_policy_url
    • AuthorizationApplication.terms_of_service_url
    • AuthorizationApplication.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_overwrite no 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_key to bytes
  • Send full heartbeat instead of ACK when receiving heartbeat
  • Fix mis-usage of PAYLOAD_ZLIB_STREAM where TRANSPORT_ZLIB_STREAM is 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
  • UnicodeEmoji is 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

Traits checking optimization and more models

25 Jan 11:28
9b6657c
Compare
Choose a tag to compare

Breaking Changes

  • EventDispatcher renamed to EventManager

Features

  • Traits checking optimization (10x faster and failfast)
  • EventManager optimizations
  • Documentation search rewrite and speedup
  • rest.edit_member now returns the edited member
  • Sticker models
  • Welcome screen models and endpoints

Bugfixes

  • Generated nonce too large in guild chunking
  • hikari.api.event_factory.EventFactory is now an abstract class
  • Ignore redundant ON_GUILD_INTEGRATION_UPDATE gateway event
  • EventManager now accepts cache to be None
  • Fix setting provisional coroutine tracking depth
  • Add proxy resource to EmbedVideo and fix handling of None in embed resources.
  • Fix handling of "cover_image" in message application deserialization

General bugfixes

16 Jan 10:02
f1337fe
Compare
Choose a tag to compare
General bugfixes Pre-release
Pre-release

Breaking changes

  • Rename GuildAvailableEvent.guild_chunk_nocne to GuildAvailableEvent.chunk_nonce
  • Documentation moved back to /hikari

Bugfixes

  • Fix outputing sha1 and version in cli
  • Fix outputing version in pypi version detection