Releases: hikari-py/hikari
2.0.0.dev118
2.0.0.dev118 (2023-04-02)
Breaking Changes
-
Refactors to the component builder interfaces which make them flatter:
- Removed
add_to_container
fromButtonBuilder
,LinkButtonBuilder
,InteractiveButtonBuilder
,SelectMenuBuilder
,ChannelSelectMenuBuilder
, andTextInputBuilder
; these classes are no-longer generic and no-longer takecontainer
in their inits. - Replaced
TextSelectMenuBuilder.add_to_container
with theTextSelectMenuBuilder.parent
property.
This new property doesn't "finalise" the addition but rather just returns the parent object, or raises if the select menu is an orphan. This change also involves replacing thecontainer
parameter inTextSelectMenuBuilder.__init__
with an optionalparent
parameter. - Removed
SelectOptionBuilder.add_to_menu
; this class isn't generic anymore. TextSelectMenuBuilder.add_option
now takes all the option's configuration as parameters and returnsSelf
.- Split
MessageActionRowBuilder.add_button
into.add_interactive_button
and.add_link_button
.
These both now take all the button's configuration as parameters and returnSelf
. MessageActionRowBuilder.add_select_menu
now takes all the menu's configuration as parameters and returnsSelf
.
The new.add_channel_menu
and.add_text_menu
methods should be used for adding text and channel menus. Where.add_channel_menu
returnsSelf
and.add_text_menu
returns a text menu builder with aparent
property for getting back to the action row builder.ModalActionRowBuilder.add_text_input
now takes all the text input's configuration as parameters and returnsSelf
.min_length
andmax_length
can no-longer behikari.undefined.UNDEFINED
for the text input builder, and default to0
and4000
respectively. This change effects both the types accepted byModalActionRowBuilder.__init__
and the return types of the relevant properties.- Removed the
emoji_id
andemoji_name
parameters fromLinkButtonBuilder.__init__
, andInteractiveButtonBuilder.__init__
. - Removed the
style
andcustom_id
parameters fromLinkButtonBuilder.__init__
. - Removed the
url
parameter fromInteractiveButtonBuilder.__init__
. (#1533)
- Removed
-
Remove previously deprecated functionality:
Intents.GUILD_BANS
(deprecated alias forIntents.GUILD_MODERATION
)ComponentType.SELECT_MENU
(deprecated alias forIntents.TEXT_SELECT_MENU
)- Not passing type through
type
argument explicitly toMessageActionRowBuilder.add_select_menu
(#1535)
-
Renamed
StickerPack.banner_hash
toStickerPack.banner_asset_id
. (#1572)
Deprecation
- Renamed
TextInputBuilder.required
property toTextInputBuilder.is_required
. (#1533) - Passing
CommandChoice
s instead ofAutocompleteChoiceBuilder
s when making autocomplete responses. (#1539) hikari.impl.bot
moved tohikari.impl.gateway_bot
. (#1576)
Features
-
Role.mention
now returns"@everyone"
for the@everyone
role. (#1528) -
Refactors to the component builder interfaces which make them flatter:
hikari.undefined.UNDEFINED
can now be passed toTextInputBuilder.set_placeholder
andTextInputBuilder.set_value
.- The standard implementation of a select option builder is now exposed at
hikari.impl.special_endpoints.SelectOptionBuilder
. (#1533)
-
CommandChoice.name_localizations
field and separateAutocompleteChoiceBuilder
for use when making autocomplete responses. (#1539) -
Implement guild role subscriptions. (#1550)
-
Add
Role.is_guild_linked_role
. (#1551) -
hikari.iterators.LazyIterator.flatten
method for flattening a lazy iterator of synchronous iterables. (#1562) -
Support sending stickers when creating a message. (#1571)
-
Added several set methods for required values to the builders:
CommandBuilder.set_name
SlashCommandBuilder.set_description
InteractiveButtonBuilder.set_custom_id
SelectOptionBuilder.set_label
SelectOptionBuilder.set_value
SelectMenuBuilder.set_custom_id
(#1574)
Bugfixes
-
emoji=
can now be passed toLinkButtonBuilder.__init__
andInteractiveButtonBuilder.__init__
alone without causing serialization issues (and Pyright will now let you pass it). (#1533) -
Open
banner.txt
s withutf-8
encoding explicitly. (#1545) -
Pyright will now let you pass
role_mentions
anduser_mentions
toInteractionMessageBuilder.__init__
. (#1560) -
Fixed forum channel applied tags not being a sequence of snowflakes. (#1564)
-
Switch to using https://github.com/discord/twemoji for emoji images. (#1568)
-
Fixed sticker pack handling and typing:
- Fixed deserialization raising when
"banner_asset_id"
or"cover_sticker_id"
weren't included in the payload. StickerPack.banner_asset_id
is now correctly typed asOptional[Snowflake]
.StickerPack.banner_url
andStickerPack.make_banner_url
both now correctly returnNone
whenStickerPack.banner_asset_id
isNone
. (#1572)
- Fixed deserialization raising when
Bugfixes and QOL changes
2.0.0.dev117 (2023-03-06)
Breaking Changes
- Remove previously deprecated functionality:
delete_message_days
parameter forban
methods. (#1496)
type
can no-longer be specified while initialisehikari.impl.special_endpoints.TextSelectMenuBuilder
andhikari.impl.special_endpoints.ChannelSelectMenuBuilder
.
hikari.api.special_endpoints.SelectOptionBuilder
no-longer inherits fromhikari.api.special_endpoints.ComponentBuilder
(but it still has abuild
method). (#1509)
Features
- Pre-maturely fetch the public key if not present when starting an interaction server. (#1423)
- Add and document the new
SUPPRESS_NOTIFICATIONS
message flag. (#1504) hikari.impl.special_endpoints.ChannelSelectMenuBuilder
andhikari.impl.special_endpoints.TextSelectMenuBuilder
are now both exported directly onhikari.impl
. (#1508)type
property to the component builders. (#1509)- Traits now use
abc.abstractmethod
. This gives better type errors. (#1516) token_type
now defaults to"Bot"
when initialisingRESTBot
with a string token. (#1527)
Bugfixes
Selects V2, linked roles, guild audit log create event support and massive speedups!
2.0.0.dev116 (2023-02-06)
Breaking Changes
- Remove
RateLimitedError
in favour of always waiting on ratelimits. (#1441) - (#1455)
- Default logging to
sys.stdout
stream to bring more in-line with banner output. (#1485)
Deprecation
- Deprecate selects v1 functionality:
ComponentType.SELECT_MENU
->ComponentType.TEXT_SELECT_MENU
- Not passing
MessageActionRowBuilder.add_select_menu
'stype
argument explicitly. InteractionChannel
andResolvedOptionData
moved fromhikari.interactions.command_interactions
tohikari.interactions.base_interactions
. (#1455)
- Renamed
Intents.GUILD_BANS
toIntents.GUILD_MODERATION
. (#1471)
Features
- Add linked roles support (models + endpoints). (#1422)
- Add selects v2 components. (#1455)
- Added
fetch_self
,edit
,delete
,sync
, andcreate_guild
methods tohikari.templates.Template
. (#1457) - Add ability to suppress optimization warnings through
suppress_optimization_warning=True
to theGatewayBot
orRESTBot
constructors. (#1459) - Support GIF sticker image format (#1464)
- Add support for guild audit log entry create events. (#1471)
- Update
RESTClient.edit_channnel
to support settingapplied_tags
on forum threads. (#1474) - Implement
reply_must_exist
in create message methods (#1475) - Support loading files through
logging.config.fileConfig
ininit_logging
. (#1485) - Add
orjson
as an optional speedup and allow to pass customjson.dumps
andjson.loads
functions to all components. (#1486)
Bugfixes
- The global ratelimit now abides by
max_rate_limit
. (#1441) - Move
description_localizations
fromPartialCommand
toSlashCommand
(removing it fromContextMenuCommand
). (#1470) - Add missing fields to
GuildChannel.edit
. (#1474) - Fix
hikari.webhooks.ChannelFollowWebhook
not including source in all cases.source_channel
andsource_guild
will beNone
instead. (#1480)
- Fix colour logging not occurring on specific terminals (ie, Pycharm). (#1485)
Hotfix when deserializing old forum channels on `GUILD_CREATE`
Forum channels, rest client optimizations and memory improvements!
2.0.0.dev114 (2023-01-01)
Breaking Changes
BulkDeleteError
:- No longer contains a
messages_skipped
attribute. messages_deleted
renamed todeleted_messages
. (#1134)
- No longer contains a
RESTApp
andRESTBucketManager
now need to be started and stopped by using.start
and.close
. (#1230)- Remove long deprecated
async with
support forEventStream
. (#1426)
Deprecation
- Deprecate the
delete_message_days
parameter for PartialGuild.ban and Member.ban. (#1378)
Features
- Allow async iterators in
RESTClient.delete_messages
. (#1134) RESTClientImpl
improvements:- You can now share client sessions and bucket managers across these objects or have them created for you.
- Speedup of request lifetime
- No-ratelimit routes no longer attempt to acquire rate limits
- Just for safety, a check is in place to treat the route as a rate limited route if a bucket is ever received for it and a error log is emitted. If you spot it around, please inform us! (#1230)
- Add
save()
method toResource
. (#1272) - Allow specifying the
delete_message_seconds
parameter for PartialGuild.ban and Member.ban.- This parameter can be specified as either an int, a float, or a datetime.timedelta object. (#1378)
- Support yielding in interaction listeners. (#1383)
- Add Indonesian locale as
hikari.Locale.ID
. (#1404) - Improve pyright support (#1412)
- Improve error raised when attempting to use an asynchronous iterator synchronously. (#1419)
- Add missing
Application
fields:Application.custom_install_url
Application.tags
Application.install_parameters
(#1420)
- Add support for guild forum channels. (#1430)
- Add a warning when not running in (at least) level 1 optimization mode. (#1431)
Bugfixes
- Buckets across different authentications are not shared any more, which would lead to incorrect rate limiting. (#1230)
- Suppress incorrect deprecation warning regarding event loops. (#1425)
- Properly close unclosed file descriptor when reading banner.
- This only affects versions of Python >= 3.9. (#1434)
- Start GC of bucket manager when creating a rest client. (#1435)
- Fix incorrect value in
CommandBuilder.is_nsfw
. (#1436)
Modals, thread cache, new docs and bugfixes!
2.0.0.dev113 (2022-12-04)
Breaking Changes
-
Remove previously deprecated functionality.
This includes:
Message.mentions
nick
argument in rest methodsedit_permission_overwrites
,edit_my_nick
andcommand_builder
rest methodsCacheView.iterator
(#1347)
Deprecation
- Deprecate
RESTClientImpl.build_action_row
in favour ofRESTClientImpl.build_message_action_row
. (#1002)
Features
- Implement modal interactions.
- Additionally, it is now guaranteed (typing-wise) that top level components will be an action row (#1002)
- Add new
UserFlag.ACTIVE_DEVELOPER
. (#1355) - Allow specifying a filename to
hikari.files.URL
. (#1368) - Only subscribe to voice events when needed in the voice manager. (#1369)
- Add functionality to create and deserialize age-restricted (NSFW) commands. (#1382)
- Threads cache. (#1384)
Bugfixes
- Allow re-uploading attachments when creating messages (#1367)
- Fix error caused when disconnecting the bot and having active voice connections. (#1369)
- Remove incorrect
is_nsfw
field from threads.- The "NSFW" status is inherited from the parent object and not sent for threads.
- This also involved moving the base attribute from
GuildChannel
toPermissibleGuildChannel
. (#1386)
Documentation Improvements
- Documentation overhaul and move to docs.hikari-py.dev domain. (#1118)
Threads and V10!
Hikari 2.0.0.dev112 (2022-11-06)
Breaking Changes
-
Moved permission overwrite mapping and permission related methods from
GuildChannel
toPermissibleGuildChannel
. (#811) -
Support v10 attachments edits
This includes breaking changes, features and things to look out for when editing messages:
- Modifying attachments in messages that contain embeds with any image attached to them now requires the images of that embed
image to be re-passed in the edit or they will be lost. attachment
andattachments
in message edits now support passing anAttachment
object to keep existing attachments.replace_attachments
has been removed, as it is now the default.attachment
andattachments
now supportsNone
to replicate the behaviour of fully removing all attachments.
InteractionMessageBuilder.clear_attachments
has been implemented to remove existing attachments from messages. (#1260)
- Modifying attachments in messages that contain embeds with any image attached to them now requires the images of that embed
Features
- Thread support for REST requests and gateway events. (#811)
- Startup and shutdown callbacks for the RESTBot interface/impl. (#999)
- Support specifying
with_counts
andwith_expiration
inRESTClient.fetch_invite
(#1330) - Support for including the
SUPPRESS_EMBEDS
flag while creating a message. (#1331) - Add
MANAGE_EVENTS
permission tohikari.Permissions
(#1334)
Bugfixes
- Wrong typehint for
InviteGuild.features
. (#1307) - Fix aiohttp error "charset must not be in content type" when using
InteractionServer
(#1320) - The REST list methods (e.g.
fetch_channels
) no-longer raisehikari.errors.UnrecognisedEntityError
when they encounter an unknown type. (#1337) - Fix deprecation warnings in CPython3.11 in
hikari.internal.ux
. (#1344)
Python 3.11, localization and new lifetime
Hikari 2.0.0.dev111 (2022-09-26)
Breaking Changes
- Lifetime improvements breaking changes:
GatewayBot.join
'suntil_close
argument removed.GatewayShardImpl.get_user_id
is no longer async and will now always be available.GatewayBotAware
no longer defines the default parameters forjoin
,start
andrun
. It is left to implementation detail. (#1204)
- Remove support for ProcessPoolExecutor executor when reading files
- It is much more efficient to use a threadpool executor for I/O actions like this one
- Due to the nature of process pool, we were also not able to perform proper chunking when reading off the file (#1273)
- It is much more efficient to use a threadpool executor for I/O actions like this one
Deprecation
- Deprecate
CacheView.iterator
in favour of using theitertools
module. (#1289)
Features
- Add python 3.11-dev support. (#847)
- Support for Application Command Localizations. (#1141)
- Improve components lifetimes:
GatewayBot
:- General speedups.
- Fix a lot of edge cases of hard crashes if the application shuts unexpectedly.
- More consistent signal handling.
run
'sshard_ids
argument can now be atyping.Sequence
.- Improved logging.
RESTBot
:- Consistent signal handling inline with
GatewayBot
. - Improved logging.
- Improved loop closing.
- Consistent signal handling inline with
GatewayShardImpl
:- New
is_connected
property to determine whether the shard is connected to the gateway. - Faster websocket pulling and heartbeating.
- Improved error handling.
- Rate limiting changes:
- Chunking no longer has its own special ratelimit. Now it is shared with the rest of
"non-priority" packages sent, which is of 117/60s (3 less than the hard limit).- "priority" packages currently only include heartbeating. (#1204)
- Chunking no longer has its own special ratelimit. Now it is shared with the rest of
- New
- Implement slash option min/max length fields (#1216)
- Add
mention
property toPartialChannel
. (#1221) - Implement new Gateway reconnect logic enforced by Discord. (#1245)
Bugfixes
- Lifetime improvements bugfixes:
GatewayShardImpl
can now be instantiated out of an async environment for consistency with other components.- Correct signal handling in
RESTBot
. (#1204)
- Improve
BadRequestError
's error string. (#1213) - Fix
hikari.impl.VoiceImpl.connect_to
silently failing if the guild or voice channel do not exist by providing a timeout. (#1242) dm_permission
now correctly defaults toTrue
instead ofFalse
when parsing command objects from Discord. (#1243)- Fix float precision issues when creating a snowflake from a datetime object. (#1247)
- Fix
reposition_channels
to use the correct route. (#1259) - Allow for
replace_attachments
kwarg to be used inRESTClient.create_initial_response
. (#1266) - Ignore guild create events which contain unavailable guilds (#1284)
Bugfixing!
Hikari 2.0.0.dev110 (2022-08-08)
Breaking Changes
- Removed case of
Member.mention
returning bang (!
) mention, as it is deprecated by Discord. (#1207)
Deprecation
RESTClient.edit_permission_overwrites
renamed toRESTClient.edit_permission_overwrite
(#1195)
Features
- Add
hikari.events.StickersUpdateEvent
and relevant cache internals.
Add sticker related public methods ontohikari.impl.CacheImpl
andhikari.guilds.Guild
. (#1126) GuildVoiceChannel
now inherits fromTextableGuildChannel
instead ofGuildChannel
. (#1189)- Add the
app_permissions
field to command and component interactions. (#1201) - Add application command badge (#1225)
Bugfixes
- Fix how CommandBuilder handles
default_member_permissions
to 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
resolved
attribute fromAutocompleteInteraction
as autocomplete interactions never have resolved objects. (#1152) build
methods are now typed as returningMutableMapping[str, typing.Any]
. (#1164)
Deprecation
messages.Mentions
object deprecated- Alternatives can be found in the base message object (#1149)
Features
- Add
create
method toCommandBuilder
. (#1016) - Support for attachments in REST-based interaction responses. (#1048)
- Add option to disable automatic member chunking.
Added theauto_chunk_members
kwarg toGatewayBot
andEventManagerImpl
, which whenFalse
will 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_permissions
andis_dm_enabled
related fields. - Added
hikari.events.application_events.ApplicationCommandPermissionsUpdate
. - Added
APPLICATION_COMMAND_PERMISSION_UPDATE
audit log entry (#1148)
- New
Bugfixes
- Improved pyright support. (#1108)
RESTClientImpl.fetch_bans
now return aLazyIterator
to allow pagination of values. (#1119)- Fix unicode decode error caused by
latin-1
encoding 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.status
may now be of typehttp.HTTPStatus
orint
. (#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_message
as a partial message (#1192)
- Properly deserialize