Skip to content

Migration to V8, message event refactoring, other slight design changes.

Pre-release
Pre-release
Compare
Choose a tag to compare
released this 27 Sep 19:16
· 1673 commits to master since this release

Breaking changes

This release has multiple breaking changes.

The first main change is the hierarchy change that can be seen in detail in this commit message.

The second main change is you will now find that the API is using the V8 REST API and V8 gateway,
rather than the V6 REST API and V6 gateway. This is discussed in this commit.

  • Private* events are now named DM* events for consistency with Discord's API.
  • GuildMessageEvent and PrivateMessageEvent no longer exist.
  • MessageBulkDeleteEvent and friends no longer exist, and have been merged into the message deletion event instead.
  • Several internal modules have moved around in hikari.utilities, classes have been renamed for internals.
  • PRIVATE* intents are now named DM* intents for consistency.
  • hikari.Bot is now replaced with hikari.BotApp.
  • hikari.REST is now replaced with hikari.RESTApp.
  • Intents are now MANDATORY again.
  • nick and role_ids are no longer on MemberPresence objects (v8 does not send these).
  • REST apps now do not require a token in the acquire call.
  • Snowflakeish types are no longer compatible with strings. You are now not allowed to use str IDs anywhere other than in the documented edge cases.
  • Failing to provide a URL with the STREAMING activity type will result in a warning.
  • Using the WATCHING activity type in a presence update will result in a PendingDeprecationWarning, as it is undocumented behaviour on Discord's API.
  • Using CUSTOM_STATUS in a presence update will result in a warning, as it is not supported.
  Event
   |-- ShardEvent
   '    |-- MessageEvent
        '    |-- MessageCreateEvent
             |    |-- GuildMessageCreateEvent
             |    '-- DMMessageCreateEvent
             |-- MessageUpdateEvent
             |    |-- GuildMessageUpdateEvent
             |    '-- DMMessageUpdateEvent
             '-- MessageDeleteEvent
                  |-- GuildMessageDeleteEvent
                  '-- DMMessageDeleteEvent

New features

  • As mentioned in 0548d6b, all message deletion types are in one event, making detecting message removal simpler for the use cases that Discord actively supports.
  • You may now query the presence of a member by doing member.presence, assuming you have the intents enabled to do so.
  • You may now do await text_channel.trigger_typing() and async with text_channel.trigger_typing():.
  • You may now optionally do await resource.read() to quickly read a file/URL/resource/bytes object from an attachment or image or avatar instead of using async with resource.stream() as rdr: data = await rdr.read() if you do not need byte inception.
  • You may now use bot.cache.get_guild(id) in addition to bot.cache.get_available_guild(id) and bot.cache.get_unavailable_guild(id) if you do not care if the guild is available or not.
  • COLORTERM environment variable is now supported for detecting ability to display ANSI color codes in the terminal. This should allow GNOME Terminal to automatically have coloured logs by default (hopefully).

Bug fixes, optimisations, documentation

  • IDTable has been renamed and rewritten to be faster: it is now known as SnowflakeSet and has fewer internal function calls for maintaining the internal datastructure. This should speed up querying of id collections in the cache internally.
  • author and guild_id attributes on message update events are now much clearer.
  • We now handle detecting a miscalculated bucket rate limit properly and simply repeat the request rather than erroring. This would only occur before if you ran two bots on the same token and simultaneously got ratelimited on the same bucket from both at the same time. This will now log that this has happened, to allow analysis of potential 429 spam bans if they occur ever for you.
  • heartbeat latency properties on Bot are now clearly documented to return a float representing the number of seconds they represent.