Releases: hikari-py/hikari
Releases · hikari-py/hikari
Uvloop fixes for Python3.9
Bug fixes
Uvloop no longer crashes the application on shut down.
New features
None
Breaking changes
None
Emoji parsing, tidyups
Breaking changes
- DM Channel events do not have the
channel
property anymore. This differs from the previous build where this would always be None due to the deprecation of DMChannelCreate events occurring on v8. - The former also means that a standard Channel event no longer has the
channel
property, only achannel_id
, as there is no guarantee we can have a given channel cached. Guild-related subclasses will still have this attribute. USE_VAD
permission has been renamed toUSE_VOICE_ACTIVITY
role_ids
now includes the ID of the@everyone
role.User.default_avatar
is now calledUser.default_avatar_url
to matchUser.avatar_url
.UnicodeEmoji.from_*
methods are now namedUnicodeEmoji.parse_*
.UnicodeEmoji.from_emoji
is now namedUnicodeEmoji.parse
without the_emoji
suffix.CustomEmoji
no longer has anapp
attribute, as it is now user-creatable. This attribute is still defined onKnownCustomEmoji
however, as this is API generated only.
New Features
- New JSON error codes are available to reference.
- Member
role_ids
now contain the@everyone
role (role with the same ID as the guild). Emoji
now has aparse
method which will parse theCustomEmoji
orUnicodeEmoji
from the given string.UnicodeEmoji.parse
implemented.CustomEmoji.parse
implemented to parse snowflakes or valid emoji mentions.
Other changes
- Voice event documentation is now 50% less sarcastic than before about the broken voice endpoint attribute, as it has now been fixed to use the correct port.
- ...as a result, the port is now no longer hard-coded in Hikari.
Event streamer is part of public API now
Event streamer has been made part of the public API.
Tidy ups and bug fixes.
Looks like people have been busy tonight.
- DM channel cache methods are now gone, as v8 does not give events pertaining to DM creation or deletion. Sending a DM to a new recipient will now require a create DM API call and a create message API call per the new layout.
- Fixed bug where you'd get KeyErrors on reconnects in the GUILD_CREATE_EVENT (thanks @FasterSpeeding for fixing that so quickly tonight).
hikari.utilities.date
->hikari.utilities.time
- Fixed incorrect conversions from timedelta types to JSON compatible types.
- Removed delete_integration REST endpoint, as it now just kicks the bot from the guild, which is what leave_guild already does anyway.
Migration to V8, message event refactoring, other slight design changes.
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()
andasync 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 usingasync 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 tobot.cache.get_available_guild(id)
andbot.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.
Documentation, consistency, bugfixes.
Breaking Changes
- Rename
Cache.get_dm
toCache.get_dm_channel
. - Blocked off integrations endpoints removal (
create_integration
,edit_integration
andsync_integration
).
Bug fixes
- Proper detection and outputting of new versions available on PyPI.
- Not being able to compare
applications.TeamMember
withusers.User
- Proper typehints in the
x_emoji
functions inREST
.
Enhancements
REST
is now fully documented.- Faster enum implementation which will also allow bots not to break if Discord implements new values in those enums.
- Improve
HTTPResponseError
to includemessage
andcode
(errors.RESTErrorCode
) if available for futher information on the error.
Lots of shard stability fixes.
Stuff should work a bit better now if you use Windows or have weird network drivers that send unexpected stuff when the adapter reconnects.
New features, defaults.
API changes
Member.top_role
property (requested by @Forbidden-A a while back, sorry it took so long!)- Files and Bytes can now be flagged as being spoilers when created and uploaded, which
allows it to be hidden on the Discord official clients for PC, Android, and iOS. - Flag fields on models are now not eagerly decoded. Flags are internally stored as integers
and are cast to the expected flag type only when needed. This reduced the time needed to
fully cache a GUILD_CREATE with 2,000 member entries from 1.1s to 1.0s, (9-10% faster) - Added new
COMPETING
activity type. - Accessing
Bot.shards
will now use a preemptively initialized MappingProxyType, which is a
little more efficient. - You can now disable the update checker on startup if you do not wish to see the
"updates available" message. - You can now pass a tuple-like string of 3 int or float values to
Color.of
and have it parsed to
a color type. This allows you to pass user input such as"(255, 255, 100)"
or"1.0 0.5 .2"
and a few dozen other similar formats directly tohikari.Color
and get the colour to use in
roles and embeds immediately without having to validate and process it yourself. - Error messages for Color parsing failures have been made more friendly, and are mostly
able to be output directly to a user without being changed now. - GuildChunker.fetch_members_for_guild is now unlimited if you do not provide the
limit
kwarg explicitly (as opposed to previously where you had to explicitly specify it).
QA
- Flake8 nox pipeline will now work on Android.
- Flaky test cases for
aio
have been fixed. - Pytest has been bumped from 6.0.1 to 6.0.2
- Coverage has been bumped from 5.2.1 to 5.3
- Re-implemented over 250 test cases for colour parsing.
premium_since bugfix on-start
2.0.0.dev80 Fixed bug with premium_since field not always being present.
General bugfixes
Merge pull request #165 from nekokatt/task/162-author-message-events Added message author attributes to events and fixed typing.