Elixir Discord Library
Welcome to nostrum 0.9.0, codenamed "T - 5".
The following functions, deprecated in nostrum 0.8, have been removed:
GuildCache.all/0
GuildCache.select_by/1
GuildCache.select/2
along with GuildCache.select!/2
.appup
file to allow upgrading it in environments
requiring hot code upgrade.
{:error, {:connection_died, reason}}
return.:sys.trace(Nostrum.Api.Ratelimiter, true)
..appup
files.use Nostrum.Consumer
manages this now.nostrum 0.9.0-alpha1
Welcome to nostrum 0.9.0, codenamed "T - 5".
The following functions, deprecated in nostrum 0.8, have bene removed:
GuildCache.all/0
GuildCache.select_by/1
GuildCache.select/2
.appup
file to allow upgrading it in environments
requiring hot code upgrade.{:error, {:connection_died, reason}}
return.:sys.trace(Nostrum.Api.Ratelimiter, true)
..appup
files.Welcome to nostrum 0.8.0, codenamed "ignition on".
This release introduces full support for distributed caching and state, and
simplifies the existing cache behaviours by using a single shared interface for
reading the cache using Erlang's QLC module. Simply put, instead of having to
implement callbacks for every combination of functions that nostrum exposes (and
will expose) to the cache, a pluggable cache only needs to implement the
c:query_handle/0
callback. To fulfill this move, a few smaller breaking
changes have been performed. It is expected that these will be the last bigger
breaking changes done before the proper 1.0 release (at which point we will
follow semantic versioning).
Note that cache distribution was not the only missing piece to allow distributing nostrum across multiple nodes (albeit the largest one). Gateway event handling must be updated to prevent duplicate gateway connections, proper distribution of shards over nodes must be implemented, and some other improvements in regards to gateway connections with many shards must be implemented, including support for persistent resume seq tokens.
MemberCache
have been
replaced.
MemberCache.get/1
-> MemberCache.fold/3-4
MemberCache.get_with_users/1
-> MemberCache.fold_with_users/3-4
MemberCache.by_user/1
-> MemberCache.fold_by_user/3-4
safe_fixtable
for safe traversal and Mnesia needs to wrap calls in :mnesia.activity
.:channel_not_found
-> :not_found
:presence_not_found
-> :not_found
:id_not_found
-> :not_found
:id_not_found_on_guild_lookup
-> :not_found
:channel_not_found
-> :not_found
ChannelCache
will no longer look up channels in the GuildCache
if they
were not found in the channel cache itself. A convenience function to fetch a
channel from a guild (they are stored together) can be introduced to
GuildCache
if needed.PresenceCache.get(user_id, guild_id)
is now PresenceCache.get(guild_id, user_id)
, the same for PresenceCache.get!/2
.
The following functions have been deprecated and will be removed in either nostrum 0.9 or 1.0:
GuildCache.all/0
GuildCache.select_by/1
GuildCache.select/2
guild_id
field:
queries involving this field are automatically optimized at compile time to
utilize the index to provide for fast lookups. As an example, the following
query is used in nosedrum as part of the member converter:
find_by(RequestedGuildId, Name, Discriminator, MemberCache, UserCache) ->
qlc:q([Member || {{GuildId, MemberId}, Member} <- MemberCache:query_handle(),
GuildId =:= RequestedGuildId,
{UserId, User} <- UserCache:query_handle(),
MemberId =:= UserId,
map_get(username, User) =:= Name,
map_get(discriminator, User) =:= Discriminator]).
{lowest, highest, total}
, where nostrum will start lowest..highest
shards and inform Discord you have total
shards in total.Nostrum.Cache
modules now have an Mnesia-based cache adapter that
allows you to replicate and distribute the data across hosts, with the full
power of Mnesia.child_spec
is sufficient.retry_after
was 0.Nostrum.Consumer
moduledoc.nostrum 0.8.0-beta1
Welcome to nostrum 0.8.0, codenamed "ignition on".
This release introduces full support for distributed caching and state, and
simplifies the existing cache behaviours by using a single shared interface for
reading the cache using Erlang's QLC module. Simply put, instead of having to
implement callbacks for every combination of functions that nostrum exposes (and
will expose) to the cache, a pluggable cache only needs to implement the
c:query_handle/0
callback. To fulfill this move, a few smaller breaking
changes have been performed. It is expected that these will be the last bigger
breaking changes done before the proper 1.0 release (at which point we will
follow semantic versioning).
Note that cache distribution was not the only missing piece to allow distributing nostrum across multiple nodes (albeit the largest one). Gateway event handling must be updated to prevent duplicate gateway connections, proper distribution of shards over nodes must be implemented, and some other improvements in regards to gateway connections with many shards must be implemented, including support for persistent resume seq tokens.
MemberCache
have been
replaced.
MemberCache.get/1
-> MemberCache.fold/3-4
MemberCache.get_with_users/1
-> MemberCache.fold_with_users/3-4
MemberCache.by_user/1
-> MemberCache.fold_by_user/3-4
safe_fixtable
for safe traversal and Mnesia needs to wrap calls in :mnesia.activity
.:channel_not_found
-> :not_found
:presence_not_found
-> :not_found
:id_not_found
-> :not_found
:id_not_found_on_guild_lookup
-> :not_found
:channel_not_found
-> :not_found
ChannelCache
will no longer look up channels in the GuildCache
if they
were not found in the channel cache itself. A convenience function to fetch a
channel from a guild (they are stored together) can be introduced to
GuildCache
if needed.PresenceCache.get(user_id, guild_id)
is now PresenceCache.get(guild_id, user_id)
, the same for PresenceCache.get!/2
.
The following functions have been deprecated and will be removed in either nostrum 0.9 or 1.0:
GuildCache.all/0
GuildCache.select_by/1
GuildCache.select/2
guild_id
field:
queries involving this field are automatically optimized at compile time to
utilize the index to provide for fast lookups. As an example, the following
query is used in nosedrum as part of the member converter:
find_by(RequestedGuildId, Name, Discriminator, MemberCache, UserCache) ->
qlc:q([Member || {{GuildId, MemberId}, Member} <- MemberCache:query_handle(),
GuildId =:= RequestedGuildId,
{UserId, User} <- UserCache:query_handle(),
MemberId =:= UserId,
map_get(username, User) =:= Name,
map_get(discriminator, User) =:= Discriminator]).
{lowest, highest, total}
, where nostrum will start lowest..highest
shards and inform Discord you have total
shards in total.Nostrum.Cache
modules now have an Mnesia-based cache adapter that
allows you to replicate and distribute the data across hosts, with the full
power of Mnesia.child_spec
is sufficient.retry_after
was 0.Nostrum.Consumer
moduledoc.nostrum 0.8.0-alpha1
Welcome to nostrum 0.8.0, codenamed "ignition on".
This release introduces full support for distributed caching and state, and
simplifies the existing cache behaviours by using a single shared interface for
reading the cache using Erlang's QLC module. Simply put, instead of having to
implement callbacks for every combination of functions that nostrum exposes (and
will expose) to the cache, a pluggable cache only needs to implement the
c:query_handle/0
callback. To fulfill this move, a few smaller breaking
changes have been performed. It is expected that these will be the last bigger
breaking changes done before the proper 1.0 release (at which point we will
follow semantic versioning).
Note that cache distribution was not the only missing piece to allow distributing nostrum across multiple nodes (albeit the largest one). Gateway event handling must be updated to prevent duplicate gateway connections, proper distribution of shards over nodes must be implemented, and some other improvements in regards to gateway connections with many shards must be implemented, including support for persistent resume seq tokens.
MemberCache
have been
replaced.
MemberCache.get/1
-> MemberCache.fold/3-4
MemberCache.get_with_users/1
-> MemberCache.fold_with_users/3-4
MemberCache.by_user/1
-> MemberCache.fold_by_user/3-4
safe_fixtable
for safe traversal and Mnesia needs to wrap calls in :mnesia.activity
.:channel_not_found
-> :not_found
:presence_not_found
-> :not_found
:id_not_found
-> :not_found
:id_not_found_on_guild_lookup
-> :not_found
:channel_not_found
-> :not_found
ChannelCache
will no longer look up channels in the GuildCache
if they
were not found in the channel cache itself. A convenience function to fetch a
channel from a guild (they are stored together) can be introduced to
GuildCache
if needed.PresenceCache.get(user_id, guild_id)
is now PresenceCache.get(guild_id, user_id)
, the same for PresenceCache.get!/2
.
The following functions have been deprecated and will be removed in either nostrum 0.9 or 1.0:
GuildCache.all/0
GuildCache.select_by/1
GuildCache.select/2
guild_id
field:
queries involving this field are automatically optimized at compile time to
utilize the index to provide for fast lookups. As an example, the following
query is used in nosedrum as part of the member converter:
find_by(RequestedGuildId, Name, Discriminator, MemberCache, UserCache) ->
qlc:q([Member || {{GuildId, MemberId}, Member} <- MemberCache:query_handle(),
GuildId =:= RequestedGuildId,
{UserId, User} <- UserCache:query_handle(),
MemberId =:= UserId,
map_get(username, User) =:= Name,
map_get(discriminator, User) =:= Discriminator]).
{lowest, highest, total}
, where nostrum will start lowest..highest
shards and inform Discord you have total
shards in total.Nostrum.Cache
modules now have an Mnesia-based cache adapter that
allows you to replicate and distribute the data across hosts, with the full
power of Mnesia.child_spec
is sufficient.retry_after
was 0.Nostrum.Consumer
moduledoc.Welcome to nostrum 0.7.0, codenamed "launch preparations".
This release brings you support for automod and forum channels, helps you with
navigating through Discord's numbering schemes with the new modules under
Nostrum.Constants
, allows you to retrieve audit log entries over the gateway,
and much more. For the full list of features and bugfixes, see below.
This release contains breaking changes in regards to member caching. If you want the short version, scroll down to the "Breaking changes" section. This part will document the changes and their reasoning.
Two main breaking changes have been performed, that are almost guaranteed to cause breakage on your bot:
Nostrum.Cache.MemberCache
handles caching guild members, and
has functions that allow you to easily retrieve members for a guild.Nostrum.Cache.MemberCache.get_with_users/1
, that will
perform a :qlc
join between the member and user cache.For the join function to work, the callback c:qlc_handle/0
has been added to
both Nostrum.Cache.MemberCache
and Nostrum.Cache.UserCache
. It is expected
that more functionality will be built on top of :qlc
in the future,
especially as nostrum approaches its 1.0 release, so it's heavily recommended
to add this callback for any custom consumers. The Erlang documentation
explains how to implement a QLC
table for
any custom caches you may have.
Why were these changes done? Nostrum previously struggled when working with
large guilds. With the ETS-based guild cache, updating a member would mean
fetching the entire guild object from the cache, for ETS, this means making a
full copy of the entire struct. While probably unproblematic for most usecases,
running Nostrum with request_guild_members: true
on large guilds would cause
memory usage to skyrocket for a brief period at the start while Nostrum
struggled to gobble all of the users into the cache. Unfortunately, fixing this
was not possible without breaking the API. The :user
field was removed as the
members change will already require changes on your side, and nostrum
previously did not update users on members properly, causing stale data. We
want the caches to work independently from each other, so this seemed the
proper solution. If you want to have some rough idea of how to change it, see
this commit on
bolt.
Due to the new separation and removal of duplicated user data, nostrum is now
lighter on memory. The "Breaking changes" section below contains a complete
listing of these changes. If you use a third-party command library such as
:nosedrum
, you will likely need to upgrade those as well.
For the breaking changes mentioned above, the following should serve as a guideline to the full list of breaking changes in the section below:
GuildCache.get(guild_id)
or friends and then looking it up from there, use
MemberCache.get(guild_id, user_id)
.Enum.find(guild.members, ...)
, use MemberCache.get(guild.id) |> Enum.find
. The new cache functions
are implemented as streams and are very light on memory.UserCache.get(member.user_id)
to retrieve it.:qlc
and MemberCache.qlc_handle()
. Note that the current ETS cache is
optimized for lookup by user and guild ID. You can also use this for the
UserCache
.If you had some previous functionality in your bot that is problematic to implement with these new changes, please open an issue.
Nostrum.Cache.MemberCache
:members
field from Nostrum.Struct.Guild
Nostrum.Cache.MemberCache
Nostrum.Cache.MemberCache.get(guild_id)
to retrieve guild membersNostrum.Cache.GuildCache
callbacks have been removed:
c:member_add/2
c:member_remove/2
c:member_update/2
c:member_chunk/2
Nostrum.Cache.GuildCache
callbacks have been added:
c:member_count_up/1
c:member_count_down/1
Nostrum.Cache.UserCache
c:qlc_handle/1
:user
field from Nostrum.Struct.Guild.Member
:user_id
field can be used to find the matching userGenStage
with :pg
use Nostrum.Consumer
can remain unchangedNostrum.Consumer
will automatically handle events in spawned processes
for parallelismNostrum.ConsumerGroup
for detailed information:joined_at
member field is now a unix timestamp instead of a raw string
t:Nostrum.Struct.Guild.Member.joined_at/0
nil
Nostrum.Cache.MemberCache
Nostrum.Api.get_guild_auto_moderation_rules/1
Nostrum.Api.get_guild_auto_moderation_rule/2
Nostrum.Api.create_guild_auto_moderation_rule/2
Nostrum.Api.modify_guild_auto_moderation_rule/3
Nostrum.Api.delete_guild_auto_moderation_rule/2
t:Nostrum.Consumer.auto_moderation_rule_create/0
t:Nostrum.Consumer.auto_moderation_rule_delete/0
t:Nostrum.Consumer.auto_moderation_rule_update/0
t:Nostrum.Consumer.auto_moderation_rule_execute/0
Nostrum.Struct.Event.AutoModerationRuleExecute
:auto_moderation_configuration
:auto_moderation_execution
Nostrum.Struct.AutoModerationRule
Nostrum.Struct.AutoModerationRule.Action
Nostrum.Struct.AutoModerationRule.ActionMetadata
Nostrum.Struct.AutoModerationRule.TriggerMetadata
Nostrum.Api.start_thread_in_forum_channel/2-3
Nostrum.Struct.Channel
:
:type
may now be 15
to represent a forum channelt:Nostrum.Struct.Channel.default_thread_rate_limit_per_user/0
t:Nostrum.Struct.Channel.forum_tag/0
t:Nostrum.Struct.Channel.applied_tags/0
t:Nostrum.Struct.Channel.default_reaction_emoji/0
:thread_metadata
field has been extended by the following fields:
:invitable
:create_timestamp
t:Nostrum.Struct.Channel.guild_forum_channel/0
has been addedNostrum.Constants.ApplicationCommandOptionType
Nostrum.Constants.ApplicationCommandPermissionType
Nostrum.Constants.ApplicationCommandType
Nostrum.Constants.ButtonStyle
Nostrum.Constants.ChannelType
Nostrum.Constants.ComponentType
Nostrum.Constants.InteractionCallbackType
Nostrum.Constants.InteractionType
Nostrum.Constants.TextInputStyle
Nostrum.Constants.WebhookType
Nostrum.Struct.Guild.AuditLogEntry
t:Nostrum.Consumer.guild_audit_log_entry_create/0
Nostrum.Api.get_webhook_message/2
t:Nostrum.Struct.Guild.Role.icon/0
t:Nostrum.Struct.ApplicationCommandInteractionDataResolved.attachments/0
Nostrum.Api.get_original_interaction_response/1
Nostrum.Api.get_reactions/3-4
t:Nostrum.Struct.Guild.Role.unicode_emoji/0
Nostrum.ConsumerGroup
for detailsREADY
event at INFO
log level as well
IDENTIFYING
was logged, which could lead to believe that
the bot is stuck in startupt:Nostrum.Api.allowed_mentions/0
Nostrum.Cache.ChannelCache
behaviour
get/1
with a message directly in the dispatcherget!/1
directly in the dispatcherc:lookup/1
and its dispatch functionlist_guild_threads/1
(Zach Daniel)youtube-dl
(aukuste)DynamicSupervisor
for voice sessions (Brandt Hill)doc
build and source file folders:gun
to the official stable 2.0 release
:remedy_gun
and :remedy_cowlib
allowing us to make releases with :gun
before.Nostrum.Cache.Mapping.ShardPidNum
moduleawait_up
logicuse Bitwise
Changes since 0.7.0-rc1:
MemberCache.get_with_user/2
Full release notes follow.
Welcome to nostrum 0.7.0, codenamed "launch preparations".
This release brings you support for automod and forum channels, helps you with
navigating through Discord's numbering schemes with the new modules under
Nostrum.Constants
, allows you to retrieve audit log entries over the gateway,
and much more. For the full list of features and bugfixes, see below.
This release contains breaking changes in regards to member caching. If you want the short version, scroll down to the "Breaking changes" section. This part will document the changes and their reasoning.
Two main breaking changes have been performed, that are almost guaranteed to cause breakage on your bot:
Nostrum.Cache.MemberCache
handles caching guild members, and
has functions that allow you to easily retrieve members for a guild.Nostrum.Cache.MemberCache.get_with_users/1
, that will
perform a :qlc
join between the member and user cache.For the join function to work, the callback c:qlc_handle/0
has been added to
both Nostrum.Cache.MemberCache
and Nostrum.Cache.UserCache
. It is expected
that more functionality will be built on top of :qlc
in the future,
especially as nostrum approaches its 1.0 release, so it's heavily recommended
to add this callback for any custom consumers. The Erlang documentation
explains how to implement a QLC
table for
any custom caches you may have.
Why were these changes done? Nostrum previously struggled when working with
large guilds. With the ETS-based guild cache, updating a member would mean
fetching the entire guild object from the cache, for ETS, this means making a
full copy of the entire struct. While probably unproblematic for most usecases,
running Nostrum with request_guild_members: true
on large guilds would cause
memory usage to skyrocket for a brief period at the start while Nostrum
struggled to gobble all of the users into the cache. Unfortunately, fixing this
was not possible without breaking the API. The :user
field was removed as the
members change will already require changes on your side, and nostrum
previously did not update users on members properly, causing stale data. We
want the caches to work independently from each other, so this seemed the
proper solution. If you want to have some rough idea of how to change it, see
this commit on
bolt.
Due to the new separation and removal of duplicated user data, nostrum is now
lighter on memory. The "Breaking changes" section below contains a complete
listing of these changes. If you use a third-party command library such as
:nosedrum
, you will likely need to upgrade those as well.
For the breaking changes mentioned above, the following should serve as a guideline to the full list of breaking changes in the section below:
GuildCache.get(guild_id)
or friends and then looking it up from there, use
MemberCache.get(guild_id, user_id)
.Enum.find(guild.members, ...)
, use MemberCache.get(guild.id) |> Enum.find
. The new cache functions
are implemented as streams and are very light on memory.UserCache.get(member.user_id)
to retrieve it.:qlc
and MemberCache.qlc_handle()
. Note that the current ETS cache is
optimized for lookup by user and guild ID. You can also use this for the
UserCache
.If you had some previous functionality in your bot that is problematic to implement with these new changes, please open an issue.
Nostrum.Cache.MemberCache
:members
field from Nostrum.Struct.Guild
Nostrum.Cache.MemberCache
Nostrum.Cache.MemberCache.get(guild_id)
to retrieve guild membersNostrum.Cache.GuildCache
callbacks have been removed:
c:member_add/2
c:member_remove/2
c:member_update/2
c:member_chunk/2
Nostrum.Cache.GuildCache
callbacks have been added:
c:member_count_up/1
c:member_count_down/1
Nostrum.Cache.UserCache
c:qlc_handle/1
:user
field from Nostrum.Struct.Guild.Member
:user_id
field can be used to find the matching userGenStage
with :pg
use Nostrum.Consumer
can remain unchangedNostrum.Consumer
will automatically handle events in spawned processes
for parallelismNostrum.ConsumerGroup
for detailed information:joined_at
member field is now a unix timestamp instead of a raw string
t:Nostrum.Struct.Guild.Member.joined_at/0
nil
Nostrum.Cache.MemberCache
Nostrum.Api.get_guild_auto_moderation_rules/1
Nostrum.Api.get_guild_auto_moderation_rule/2
Nostrum.Api.create_guild_auto_moderation_rule/2
Nostrum.Api.modify_guild_auto_moderation_rule/3
Nostrum.Api.delete_guild_auto_moderation_rule/2
t:Nostrum.Consumer.auto_moderation_rule_create/0
t:Nostrum.Consumer.auto_moderation_rule_delete/0
t:Nostrum.Consumer.auto_moderation_rule_update/0
t:Nostrum.Consumer.auto_moderation_rule_execute/0
Nostrum.Struct.Event.AutoModerationRuleExecute
:auto_moderation_configuration
:auto_moderation_execution
Nostrum.Struct.AutoModerationRule
Nostrum.Struct.AutoModerationRule.Action
Nostrum.Struct.AutoModerationRule.ActionMetadata
Nostrum.Struct.AutoModerationRule.TriggerMetadata
Nostrum.Api.start_thread_in_forum_channel/2-3
Nostrum.Struct.Channel
:
:type
may now be 15
to represent a forum channelt:Nostrum.Struct.Channel.default_thread_rate_limit_per_user/0
t:Nostrum.Struct.Channel.forum_tag/0
t:Nostrum.Struct.Channel.applied_tags/0
t:Nostrum.Struct.Channel.default_reaction_emoji/0
:thread_metadata
field has been extended by the following fields:
:invitable
:create_timestamp
t:Nostrum.Struct.Channel.guild_forum_channel/0
has been addedNostrum.Constants.ApplicationCommandOptionType
Nostrum.Constants.ApplicationCommandPermissionType
Nostrum.Constants.ApplicationCommandType
Nostrum.Constants.ButtonStyle
Nostrum.Constants.ChannelType
Nostrum.Constants.ComponentType
Nostrum.Constants.InteractionCallbackType
Nostrum.Constants.InteractionType
Nostrum.Constants.TextInputStyle
Nostrum.Constants.WebhookType
Nostrum.Struct.Guild.AuditLogEntry
t:Nostrum.Consumer.guild_audit_log_entry_create/0
Nostrum.Api.get_webhook_message/2
t:Nostrum.Struct.Guild.Role.icon/0
t:Nostrum.Struct.ApplicationCommandInteractionDataResolved.attachments/0
Nostrum.Api.get_original_interaction_response/1
Nostrum.Api.get_reactions/3-4
t:Nostrum.Struct.Guild.Role.unicode_emoji/0
Nostrum.ConsumerGroup
for detailsREADY
event at INFO
log level as well
IDENTIFYING
was logged, which could lead to believe that
the bot is stuck in startupt:Nostrum.Api.allowed_mentions/0
Nostrum.Cache.ChannelCache
behaviour
get/1
with a message directly in the dispatcherget!/1
directly in the dispatcherc:lookup/1
and its dispatch functionlist_guild_threads/1
(Zach Daniel)youtube-dl
(aukuste)DynamicSupervisor
for voice sessions (Brandt Hill)doc
build and source file folders:gun
to the official stable 2.0 release
:remedy_gun
and :remedy_cowlib
allowing us to make releases with :gun
before.Nostrum.Cache.Mapping.ShardPidNum
moduleawait_up
logicuse Bitwise
Test release for the upcoming 0.7.0 release. If possible, please test! Full release notes follow.
This release brings you support for automod and forum channels, helps you with
navigating through Discord's numbering schemes with the new modules under
Nostrum.Constants
, allows you to retrieve audit log entries over the gateway,
and much more. For the full list of features and bugfixes, see below.
This release contains breaking changes in regards to member caching. If you want the short version, scroll down to the "Breaking changes" section. This part will document the changes and their reasoning.
Two main breaking changes have been performed, that are almost guaranteed to cause breakage on your bot:
Nostrum.Cache.MemberCache
handles caching guild members, and
has functions that allow you to easily retrieve members for a guild.Nostrum.Cache.MemberCache.get_with_users/1
, that will
perform a :qlc
join between the member and user cache.For the join function to work, the callback c:qlc_handle/0
has been added to
both Nostrum.Cache.MemberCache
and Nostrum.Cache.UserCache
. It is expected
that more functionality will be built on top of :qlc
in the future,
especially as nostrum approaches its 1.0 release, so it's heavily recommended
to add this callback for any custom consumers. The Erlang documentation
explains how to implement a QLC
table for
any custom caches you may have.
Why were these changes done? Nostrum previously struggled when working with
large guilds. With the ETS-based guild cache, updating a member would mean
fetching the entire guild object from the cache, for ETS, this means making a
full copy of the entire struct. While probably unproblematic for most usecases,
running Nostrum with request_guild_members: true
on large guilds would cause
memory usage to skyrocket for a brief period at the start while Nostrum
struggled to gobble all of the users into the cache. Unfortunately, fixing this
was not possible without breaking the API. The :user
field was removed as the
members change will already require changes on your side, and nostrum
previously did not update users on members properly, causing stale data. We
want the caches to work independently from each other, so this seemed the
proper solution. If you want to have some rough idea of how to change it, see
this commit on
bolt.
Due to the new separation and removal of duplicated user data, nostrum is now
lighter on memory. The "Breaking changes" section below contains a complete
listing of these changes. If you use a third-party command library such as
:nosedrum
, you will likely need to upgrade those as well.
For the breaking changes mentioned above, the following should serve as a guideline to the full list of breaking changes in the section below:
GuildCache.get(guild_id)
or friends and then looking it up from there, use
MemberCache.get(guild_id, user_id)
.Enum.find(guild.members, ...)
, use MemberCache.get(guild.id) |> Enum.find
. The new cache functions
are implemented as streams and are very light on memory.UserCache.get(member.user_id)
to retrieve it.:qlc
and MemberCache.qlc_handle()
. Note that the current ETS cache is
optimized for lookup by user and guild ID. You can also use this for the
UserCache
.If you had some previous functionality in your bot that is problematic to implement with these new changes, please open an issue.
Nostrum.Cache.MemberCache
:members
field from Nostrum.Struct.Guild
Nostrum.Cache.MemberCache
Nostrum.Cache.MemberCache.get(guild_id)
to retrieve guild membersNostrum.Cache.GuildCache
callbacks have been removed:
c:member_add/2
c:member_remove/2
c:member_update/2
c:member_chunk/2
Nostrum.Cache.GuildCache
callbacks have been added:
c:member_count_up/1
c:member_count_down/1
Nostrum.Cache.UserCache
c:qlc_handle/1
:user
field from Nostrum.Struct.Guild.Member
:user_id
field can be used to find the matching userGenStage
with :pg
use Nostrum.Consumer
can remain unchangedNostrum.Consumer
will automatically handle events in spawned processes
for parallelismNostrum.ConsumerGroup
for detailed information:joined_at
member field is now a unix timestamp instead of a raw string
t:Nostrum.Struct.Guild.Member.joined_at/0
nil
Nostrum.Cache.MemberCache
Nostrum.Api.get_guild_auto_moderation_rules/1
Nostrum.Api.get_guild_auto_moderation_rule/2
Nostrum.Api.create_guild_auto_moderation_rule/2
Nostrum.Api.modify_guild_auto_moderation_rule/3
Nostrum.Api.delete_guild_auto_moderation_rule/2
t:Nostrum.Consumer.auto_moderation_rule_create/0
t:Nostrum.Consumer.auto_moderation_rule_delete/0
t:Nostrum.Consumer.auto_moderation_rule_update/0
t:Nostrum.Consumer.auto_moderation_rule_execute/0
Nostrum.Struct.Event.AutoModerationRuleExecute
:auto_moderation_configuration
:auto_moderation_execution
Nostrum.Struct.AutoModerationRule
Nostrum.Struct.AutoModerationRule.Action
Nostrum.Struct.AutoModerationRule.ActionMetadata
Nostrum.Struct.AutoModerationRule.TriggerMetadata
Nostrum.Api.start_thread_in_forum_channel/2-3
Nostrum.Struct.Channel
:
:type
may now be 15
to represent a forum channelt:Nostrum.Struct.Channel.default_thread_rate_limit_per_user/0
t:Nostrum.Struct.Channel.forum_tag/0
t:Nostrum.Struct.Channel.applied_tags/0
t:Nostrum.Struct.Channel.default_reaction_emoji/0
:thread_metadata
field has been extended by the following fields:
:invitable
:create_timestamp
t:Nostrum.Struct.Channel.guild_forum_channel/0
has been addedNostrum.Constants.ApplicationCommandOptionType
Nostrum.Constants.ApplicationCommandPermissionType
Nostrum.Constants.ApplicationCommandType
Nostrum.Constants.ButtonStyle
Nostrum.Constants.ChannelType
Nostrum.Constants.ComponentType
Nostrum.Constants.InteractionCallbackType
Nostrum.Constants.InteractionType
Nostrum.Constants.TextInputStyle
Nostrum.Constants.WebhookType
Nostrum.Struct.Guild.AuditLogEntry
t:Nostrum.Consumer.guild_audit_log_entry_create/0
Nostrum.Api.get_webhook_message/2
t:Nostrum.Struct.Guild.Role.icon/0
t:Nostrum.Struct.ApplicationCommandInteractionDataResolved.attachments/0
Nostrum.Api.get_original_interaction_response/1
Nostrum.Api.get_reactions/3-4
t:Nostrum.Struct.Guild.Role.unicode_emoji/0
Nostrum.ConsumerGroup
for detailsREADY
event at INFO
log level as well
IDENTIFYING
was logged, which could lead to believe that
the bot is stuck in startupt:Nostrum.Api.allowed_mentions/0
Nostrum.Cache.ChannelCache
behaviour
get/1
with a message directly in the dispatcherget!/1
directly in the dispatcherc:lookup/1
and its dispatch functionlist_guild_threads/1
(Zach Daniel)youtube-dl
(aukuste)DynamicSupervisor
for voice sessions (Brandt Hill)doc
build and source file folders:gun
to the official stable 2.0 release
:remedy_gun
and :remedy_cowlib
allowing us to make releases with :gun
before.Nostrum.Cache.Mapping.ShardPidNum
moduleawait_up
logicuse Bitwise
nostrum 0.6.1
Welcome to nostrum 0.6.1, a small bugfix release addressing issues with token validation and typespecs.
Thanks to @Th3-M4jor and @cedeno for their contributions to this release!
Welcome to nostrum 0.6.0, bringing you message content intents, API v10, voice improvements, new permissions, and more!
A huge thanks to @Th3-M4jor, @BrandtHill and @daskycodes for their contributions to this release!
:message_content
in your :gateway_intents
configuration setting.false
as
the third argument to listen/2-3
to reuse the previous behaviour.:manage_emojis
permission was renamed to :manage_emojis_and_stickers
:message_content
intent:view_guild_insights
:use_application_commands
:moderate_members
:use_external_stickers
:stream
:request_to_speak
:manage_events
:use_embedded_activities
:locale
and :guild_locale
fieldsNostrum.Voice.start_listen_async/1
t:Nostrum.Voice.VoiceWSState.ssrc_map/0
and
Nostrum.Voice.get_ssrc_map/1
for details)Nostrum.Voice.pad_opus/1
for details)Nostrum.Voice.get_current_url/1
NoOp
guild cache for effectively disabling the guild cacheNostrum.Token
for verifying Discord Bot tokensmime
version 1 and 2check_token/1
to work with newer token formatsMessage.to_url/1
breaking on numeric IDsUtil.cast
in the Integration
and
Integration.Application
structsnofin
responses in the ratelimiter. Please report these
cases
:message_content
intent if relying on content for e.g.
commandsApi
module