Struct discord_flows::model::GatewayIntents
source · pub struct GatewayIntents { /* private fields */ }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, GatewayIntents::GUILD_MEMBERS
and GatewayIntents::MESSAGE_CONTENT 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.
Implementations§
source§impl GatewayIntents
impl GatewayIntents
sourcepub const GUILDS: GatewayIntents = _
pub const GUILDS: GatewayIntents = _
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
sourcepub const GUILD_MEMBERS: GatewayIntents = _
pub const GUILD_MEMBERS: GatewayIntents = _
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.
sourcepub const GUILD_BANS: GatewayIntents = _
pub const GUILD_BANS: GatewayIntents = _
Enables following gateway events:
- GUILD_BAN_ADD
- GUILD_BAN_REMOVE
sourcepub const GUILD_EMOJIS_AND_STICKERS: GatewayIntents = _
pub const GUILD_EMOJIS_AND_STICKERS: GatewayIntents = _
Enables following gateway event:
- GUILD_EMOJIS_UPDATE
- GUILD_STICKERS_UPDATE
sourcepub const GUILD_INTEGRATIONS: GatewayIntents = _
pub const GUILD_INTEGRATIONS: GatewayIntents = _
Enables following gateway event:
- GUILD_INTEGRATIONS_UPDATE
- INTEGRATION_CREATE
- INTEGRATION_UPDATE
- INTEGRATION_DELETE
sourcepub const GUILD_WEBHOOKS: GatewayIntents = _
pub const GUILD_WEBHOOKS: GatewayIntents = _
Enables following gateway event:
- WEBHOOKS_UPDATE
sourcepub const GUILD_INVITES: GatewayIntents = _
pub const GUILD_INVITES: GatewayIntents = _
Enables following gateway events:
- INVITE_CREATE
- INVITE_DELETE
sourcepub const GUILD_VOICE_STATES: GatewayIntents = _
pub const GUILD_VOICE_STATES: GatewayIntents = _
Enables following gateway event:
- VOICE_STATE_UPDATE
sourcepub const GUILD_PRESENCES: GatewayIntents = _
pub const GUILD_PRESENCES: GatewayIntents = _
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.
sourcepub const GUILD_MESSAGES: GatewayIntents = _
pub const GUILD_MESSAGES: GatewayIntents = _
Enables following gateway events:
- MESSAGE_CREATE
- MESSAGE_UPDATE
- MESSAGE_DELETE
- MESSAGE_DELETE_BULK
sourcepub const GUILD_MESSAGE_REACTIONS: GatewayIntents = _
pub const GUILD_MESSAGE_REACTIONS: GatewayIntents = _
Enables following gateway events:
- MESSAGE_REACTION_ADD
- MESSAGE_REACTION_REMOVE
- MESSAGE_REACTION_REMOVE_ALL
- MESSAGE_REACTION_REMOVE_EMOJI
sourcepub const GUILD_MESSAGE_TYPING: GatewayIntents = _
pub const GUILD_MESSAGE_TYPING: GatewayIntents = _
Enable following gateway event:
- TYPING_START
sourcepub const DIRECT_MESSAGES: GatewayIntents = _
pub const DIRECT_MESSAGES: GatewayIntents = _
Enable following gateway events:
- MESSAGE_CREATE
- MESSAGE_UPDATE
- MESSAGE_DELETE
- CHANNEL_PINS_UPDATE
sourcepub const DIRECT_MESSAGE_REACTIONS: GatewayIntents = _
pub const DIRECT_MESSAGE_REACTIONS: GatewayIntents = _
Enable following gateway events:
- MESSAGE_REACTION_ADD
- MESSAGE_REACTION_REMOVE
- MESSAGE_REACTION_REMOVE_ALL
- MESSAGE_REACTION_REMOVE_EMOJI
sourcepub const DIRECT_MESSAGE_TYPING: GatewayIntents = _
pub const DIRECT_MESSAGE_TYPING: GatewayIntents = _
Enable following gateway event:
- TYPING_START
sourcepub const MESSAGE_CONTENT: GatewayIntents = _
pub const MESSAGE_CONTENT: GatewayIntents = _
Enable message content in following gateway events:
- MESSAGE_CREATE
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.
sourcepub const GUILD_SCHEDULED_EVENTS: GatewayIntents = _
pub const GUILD_SCHEDULED_EVENTS: GatewayIntents = _
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
sourcepub const AUTO_MODERATION_CONFIGURATION: GatewayIntents = _
pub const AUTO_MODERATION_CONFIGURATION: GatewayIntents = _
Enable following gateway events:
- AUTO_MODERATION_RULE_CREATE
- AUTO_MODERATION_RULE_UPDATE
- AUTO_MODERATION_RULE_DELETE
sourcepub const AUTO_MODERATION_EXECUTION: GatewayIntents = _
pub const AUTO_MODERATION_EXECUTION: GatewayIntents = _
Enable following gateway events:
- AUTO_MODERATION_ACTION_EXECUTION
sourcepub const fn empty() -> GatewayIntents
pub const fn empty() -> GatewayIntents
Returns an empty set of flags.
sourcepub const fn all() -> GatewayIntents
pub const fn all() -> GatewayIntents
Returns the set containing all flags.
sourcepub const fn from_bits(bits: u64) -> Option<GatewayIntents>
pub const fn from_bits(bits: u64) -> Option<GatewayIntents>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
sourcepub const fn from_bits_truncate(bits: u64) -> GatewayIntents
pub const fn from_bits_truncate(bits: u64) -> GatewayIntents
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
sourcepub const unsafe fn from_bits_unchecked(bits: u64) -> GatewayIntents
pub const unsafe fn from_bits_unchecked(bits: u64) -> GatewayIntents
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.
sourcepub const fn intersects(&self, other: GatewayIntents) -> bool
pub const fn intersects(&self, other: GatewayIntents) -> bool
Returns true if there are flags common to both self and other.
sourcepub const fn contains(&self, other: GatewayIntents) -> bool
pub const fn contains(&self, other: GatewayIntents) -> bool
Returns true if all of the flags in other are contained within self.
sourcepub fn insert(&mut self, other: GatewayIntents)
pub fn insert(&mut self, other: GatewayIntents)
Inserts the specified flags in-place.
sourcepub fn remove(&mut self, other: GatewayIntents)
pub fn remove(&mut self, other: GatewayIntents)
Removes the specified flags in-place.
sourcepub fn toggle(&mut self, other: GatewayIntents)
pub fn toggle(&mut self, other: GatewayIntents)
Toggles the specified flags in-place.
sourcepub fn set(&mut self, other: GatewayIntents, value: bool)
pub fn set(&mut self, other: GatewayIntents, value: bool)
Inserts or removes the specified flags depending on the passed value.
sourcepub const fn intersection(self, other: GatewayIntents) -> GatewayIntents
pub const fn intersection(self, other: GatewayIntents) -> GatewayIntents
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.
sourcepub const fn union(self, other: GatewayIntents) -> GatewayIntents
pub const fn union(self, other: GatewayIntents) -> GatewayIntents
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.
sourcepub const fn difference(self, other: GatewayIntents) -> GatewayIntents
pub const fn difference(self, other: GatewayIntents) -> GatewayIntents
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.
sourcepub const fn symmetric_difference(self, other: GatewayIntents) -> GatewayIntents
pub const fn symmetric_difference(self, other: GatewayIntents) -> GatewayIntents
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.
sourcepub const fn complement(self) -> GatewayIntents
pub const fn complement(self) -> GatewayIntents
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.
source§impl GatewayIntents
impl GatewayIntents
sourcepub const fn non_privileged() -> GatewayIntents
pub const fn non_privileged() -> GatewayIntents
Gets all of the intents that aren’t considered privileged by Discord.
sourcepub const fn privileged() -> GatewayIntents
pub const fn privileged() -> GatewayIntents
Gets all of the intents that are considered privileged by Discord. Use of these intents will require explicitly whitelisting the bot.
Trait Implementations§
source§impl Binary for GatewayIntents
impl Binary for GatewayIntents
source§impl BitAnd<GatewayIntents> for GatewayIntents
impl BitAnd<GatewayIntents> for GatewayIntents
source§fn bitand(self, other: GatewayIntents) -> GatewayIntents
fn bitand(self, other: GatewayIntents) -> GatewayIntents
Returns the intersection between the two sets of flags.
§type Output = GatewayIntents
type Output = GatewayIntents
& operator.source§impl BitAndAssign<GatewayIntents> for GatewayIntents
impl BitAndAssign<GatewayIntents> for GatewayIntents
source§fn bitand_assign(&mut self, other: GatewayIntents)
fn bitand_assign(&mut self, other: GatewayIntents)
Disables all flags disabled in the set.
source§impl BitOr<GatewayIntents> for GatewayIntents
impl BitOr<GatewayIntents> for GatewayIntents
source§fn bitor(self, other: GatewayIntents) -> GatewayIntents
fn bitor(self, other: GatewayIntents) -> GatewayIntents
Returns the union of the two sets of flags.
§type Output = GatewayIntents
type Output = GatewayIntents
| operator.source§impl BitOrAssign<GatewayIntents> for GatewayIntents
impl BitOrAssign<GatewayIntents> for GatewayIntents
source§fn bitor_assign(&mut self, other: GatewayIntents)
fn bitor_assign(&mut self, other: GatewayIntents)
Adds the set of flags.
source§impl BitXor<GatewayIntents> for GatewayIntents
impl BitXor<GatewayIntents> for GatewayIntents
source§fn bitxor(self, other: GatewayIntents) -> GatewayIntents
fn bitxor(self, other: GatewayIntents) -> GatewayIntents
Returns the left flags, but with all the right flags toggled.
§type Output = GatewayIntents
type Output = GatewayIntents
^ operator.source§impl BitXorAssign<GatewayIntents> for GatewayIntents
impl BitXorAssign<GatewayIntents> for GatewayIntents
source§fn bitxor_assign(&mut self, other: GatewayIntents)
fn bitxor_assign(&mut self, other: GatewayIntents)
Toggles the set of flags.
source§impl Clone for GatewayIntents
impl Clone for GatewayIntents
source§fn clone(&self) -> GatewayIntents
fn clone(&self) -> GatewayIntents
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for GatewayIntents
impl Debug for GatewayIntents
source§impl Default for GatewayIntents
impl Default for GatewayIntents
source§fn default() -> GatewayIntents
fn default() -> GatewayIntents
source§impl<'de> Deserialize<'de> for GatewayIntents
impl<'de> Deserialize<'de> for GatewayIntents
source§fn deserialize<D>(
deserializer: D
) -> Result<GatewayIntents, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>( deserializer: D ) -> Result<GatewayIntents, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,
source§impl Extend<GatewayIntents> for GatewayIntents
impl Extend<GatewayIntents> for GatewayIntents
source§fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = GatewayIntents>,
fn extend<T>(&mut self, iterator: T)where T: IntoIterator<Item = GatewayIntents>,
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)source§impl FromIterator<GatewayIntents> for GatewayIntents
impl FromIterator<GatewayIntents> for GatewayIntents
source§fn from_iter<T>(iterator: T) -> GatewayIntentswhere
T: IntoIterator<Item = GatewayIntents>,
fn from_iter<T>(iterator: T) -> GatewayIntentswhere T: IntoIterator<Item = GatewayIntents>,
source§impl Hash for GatewayIntents
impl Hash for GatewayIntents
source§impl LowerHex for GatewayIntents
impl LowerHex for GatewayIntents
source§impl Not for GatewayIntents
impl Not for GatewayIntents
source§fn not(self) -> GatewayIntents
fn not(self) -> GatewayIntents
Returns the complement of this set of flags.
§type Output = GatewayIntents
type Output = GatewayIntents
! operator.source§impl Octal for GatewayIntents
impl Octal for GatewayIntents
source§impl Ord for GatewayIntents
impl Ord for GatewayIntents
source§fn cmp(&self, other: &GatewayIntents) -> Ordering
fn cmp(&self, other: &GatewayIntents) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<GatewayIntents> for GatewayIntents
impl PartialEq<GatewayIntents> for GatewayIntents
source§fn eq(&self, other: &GatewayIntents) -> bool
fn eq(&self, other: &GatewayIntents) -> bool
self and other values to be equal, and is used
by ==.source§impl PartialOrd<GatewayIntents> for GatewayIntents
impl PartialOrd<GatewayIntents> for GatewayIntents
source§fn partial_cmp(&self, other: &GatewayIntents) -> Option<Ordering>
fn partial_cmp(&self, other: &GatewayIntents) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl Serialize for GatewayIntents
impl Serialize for GatewayIntents
source§fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>( &self, serializer: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,
source§impl Sub<GatewayIntents> for GatewayIntents
impl Sub<GatewayIntents> for GatewayIntents
source§fn sub(self, other: GatewayIntents) -> GatewayIntents
fn sub(self, other: GatewayIntents) -> GatewayIntents
Returns the set difference of the two sets of flags.
§type Output = GatewayIntents
type Output = GatewayIntents
- operator.source§impl SubAssign<GatewayIntents> for GatewayIntents
impl SubAssign<GatewayIntents> for GatewayIntents
source§fn sub_assign(&mut self, other: GatewayIntents)
fn sub_assign(&mut self, other: GatewayIntents)
Disables all flags enabled in the set.