Struct serenity::client::bridge::gateway::GatewayIntents [−][src]
pub struct GatewayIntents {
pub bits: u64,
}
Expand description
[Gateway Intents] will limit the events your bot will receive via the gateway. By default, all intents except Privileged Intents are selected.
What are Intents
A gateway intent sets the types of gateway events (e.g. member joins, guild integrations, guild emoji updates, …) the bot shall receive. Carefully picking the needed intents greatly helps the bot to scale, as less intents will result in less events to be received via the network from Discord and less processing needed for handling the data.
Privileged Intents
The intents GatewayIntents::GUILD_PRESENCES
and GatewayIntents::GUILD_MEMBERS
are Privileged Intents. They need to be enabled in the
developer portal.
Note: Once the bot is in 100 guilds or more, the bot must be verified in order to use privileged intents.
Fields
bits: u64
The flags composing gateway intents.
Note
Do not modify this yourself; use the provided methods. Do the same when creating, unless you’re absolutely certain that you’re giving valid intents flags.
Implementations
Enables following gateway events:
- GUILD_CREATE
- GUILD_DELETE
- GUILD_ROLE_CREATE
- GUILD_ROLE_UPDATE
- GUILD_ROLE_DELETE
- CHANNEL_CREATE
- CHANNEL_UPDATE
- CHANNEL_DELETE
- CHANNEL_PINS_UPDATE
- THREAD_CREATE
- THREAD_UPDATE
- THREAD_DELETE
- THREAD_LIST_SYNC
- THREAD_MEMBER_UPDATE
- THREAD_MEMBERS_UPDATE
- STAGE_INSTANCE_CREATE
- STAGE_INSTANCE_UPDATE
- STAGE_INSTANCE_DELETE
Enables following gateway events:
- GUILD_MEMBER_ADD
- GUILD_MEMBER_UPDATE
- GUILD_MEMBER_REMOVE
- THREAD_MEMBERS_UPDATE
Info: This intent is privileged. In order to use it, you must head to your application in the Developer Portal and enable the toggle for Privileged Intents.
This intent is also necessary to even receive the events in contains.
Enables following gateway events:
- GUILD_BAN_ADD
- GUILD_BAN_REMOVE
Enables following gateway event:
- GUILD_EMOJIS_UPDATE
Enables following gateway event:
- GUILD_INTEGRATIONS_UPDATE
- INTEGRATION_CREATE
- INTEGRATION_UPDATE
- INTEGRATION_DELETE
Enables following gateway event:
- WEBHOOKS_UPDATE
Enables following gateway events:
- INVITE_CREATE
- INVITE_DELETE
Enables following gateway event:
- VOICE_STATE_UPDATE
Enables following gateway event:
- PRESENCE_UPDATE
Info: This intent is privileged. In order to use it, you must head to your application in the Developer Portal and enable the toggle for Privileged Intents.
This intent is also necessary to even receive the events in contains.
Enables following gateway events:
- MESSAGE_CREATE
- MESSAGE_UPDATE
- MESSAGE_DELETE
- MESSAGE_DELETE_BULK
Enables following gateway events:
- MESSAGE_REACTION_ADD
- MESSAGE_REACTION_REMOVE
- MESSAGE_REACTION_REMOVE_ALL
- MESSAGE_REACTION_REMOVE_EMOJI
Enable following gateway event:
- TYPING_START
Enable following gateway events:
- MESSAGE_CREATE
- MESSAGE_UPDATE
- MESSAGE_DELETE
- CHANNEL_PINS_UPDATE
Enable following gateway events:
- MESSAGE_REACTION_ADD
- MESSAGE_REACTION_REMOVE
- MESSAGE_REACTION_REMOVE_ALL
- MESSAGE_REACTION_REMOVE_EMOJI
Enable following gateway event:
- TYPING_START
Enable following gateway events:
- GUILD_SCHEDULED_EVENT_CREATE
- GUILD_SCHEDULED_EVENT_UPDATE
- GUILD_SCHEDULED_EVENT_DELETE
- GUILD_SCHEDULED_EVENT_USER_ADD
- GUILD_SCHEDULED_EVENT_USER_REMOVE
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
Safety
The caller of the bitflags!
macro can chose to allow or
disallow extra bits for their bitflags type.
The caller of from_bits_unchecked()
has to ensure that
all bits correspond to a defined flag or that extra bits
are valid for this bitflags type.
Returns true
if there are flags common to both self
and other
.
Returns true
if all of the flags in other
are contained within self
.
Inserts or removes the specified flags depending on the passed value.
Returns the intersection between the flags in self
and
other
.
Specifically, the returned set contains only the flags which are
present in both self
and other
.
This is equivalent to using the &
operator (e.g.
ops::BitAnd
), as in flags & other
.
Returns the union of between the flags in self
and other
.
Specifically, the returned set contains all flags which are
present in either self
or other
, including any which are
present in both (see Self::symmetric_difference
if that
is undesirable).
This is equivalent to using the |
operator (e.g.
ops::BitOr
), as in flags | other
.
Returns the difference between the flags in self
and other
.
Specifically, the returned set contains all flags present in
self
, except for the ones present in other
.
It is also conceptually equivalent to the “bit-clear” operation:
flags & !other
(and this syntax is also supported).
This is equivalent to using the -
operator (e.g.
ops::Sub
), as in flags - other
.
Returns the symmetric difference between the flags
in self
and other
.
Specifically, the returned set contains the flags present which
are present in self
or other
, but that are not present in
both. Equivalently, it contains the flags present in exactly
one of the sets self
and other
.
This is equivalent to using the ^
operator (e.g.
ops::BitXor
), as in flags ^ other
.
Returns the complement of this set of flags.
Specifically, the returned set contains all the flags which are
not set in self
, but which are allowed for this type.
Alternatively, it can be thought of as the set difference
between Self::all()
and self
(e.g. Self::all() - self
)
This is equivalent to using the !
operator (e.g.
ops::Not
), as in !flags
.
Gets all of the intents that don’t are considered privileged by Discord.
Gets all of the intents that are considered privileged by Discord. Use of these intents will require explicitly whitelisting the bot.
Checks if any of the included intents are privileged
Shorthand for checking that the set of intents contains the GUILDS intent.
Shorthand for checking that the set of intents contains the GUILD_MEMBERS intent.
Shorthand for checking that the set of intents contains the GUILD_BANS intent.
Shorthand for checking that the set of intents contains the GUILD_EMOJIS intent.
Shorthand for checking that the set of intents contains the GUILD_INTEGRATIONS intent.
Shorthand for checking that the set of intents contains the GUILD_WEBHOOKS intent.
Shorthand for checking that the set of intents contains the GUILD_INVITES intent.
Shorthand for checking that the set of intents contains the GUILD_VOICE_STATES intent.
Shorthand for checking that the set of intents contains the GUILD_PRESENCES intent.
Shorthand for checking that the set of intents contains the GUILD_MESSAGE_REACTIONS intent.
Shorthand for checking that the set of intents contains the GUILD_MESSAGE_TYPING intent.
Shorthand for checking that the set of intents contains the DIRECT_MESSAGES intent.
Shorthand for checking that the set of intents contains the DIRECT_MESSAGE_REACTIONS intent.
Shorthand for checking that the set of intents contains the DIRECT_MESSAGE_TYPING intent.
Trait Implementations
Disables all flags disabled in the set.
Returns the union of the two sets of flags.
type Output = Self
type Output = Self
The resulting type after applying the |
operator.
Adds the set of flags.
Toggles the set of flags.
Deserialize this value from the given Serde deserializer. Read more
Extends a collection with the contents of an iterator. Read more
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Creates a value from an iterator. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Disables all flags enabled in the set.
Auto Trait Implementations
impl RefUnwindSafe for GatewayIntents
impl Send for GatewayIntents
impl Sync for GatewayIntents
impl Unpin for GatewayIntents
impl UnwindSafe for GatewayIntents
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more