Flag

discord_http.flags module

class discord_http.flags.ApplicationFlags(value=0)

Bases: BaseFlag

Represents the flags of a Discord application.

Parameters:

value (int)

Return type:

Self

application_auto_moderation_rule_create_badge = <ApplicationFlags.application_auto_moderation_rule_create_badge: 64>
gateway_presence = <ApplicationFlags.gateway_presence: 4096>
gateway_presence_limited = <ApplicationFlags.gateway_presence_limited: 8192>
gateway_guild_members = <ApplicationFlags.gateway_guild_members: 16384>
gateway_guild_members_limited = <ApplicationFlags.gateway_guild_members_limited: 32768>
verification_pending_guild_limit = <ApplicationFlags.verification_pending_guild_limit: 65536>
embedded = <ApplicationFlags.embedded: 131072>
gateway_message_content = <ApplicationFlags.gateway_message_content: 262144>
gateway_message_content_limited = <ApplicationFlags.gateway_message_content_limited: 524288>
application_command_badge = <ApplicationFlags.application_command_badge: 8388608>
add_flags(*flag_name) → Self

Add a flag by name.

Parameters:

*flag_name (Union[Self, str]) – The flag to add

Return type:

Self

Returns:

The flag with the added flag

Raises:

ValueError – The flag name is not a valid flag

classmethod all() → Self

Returns a flag with all the flags.

Return type:

Self

copy() → Self

Returns a copy of the flag.

Return type:

Self

classmethod from_names(*args) → Self

Create a flag from names.

Parameters:

*args (str) – The names of the flags to create

Return type:

Self

Returns:

The flag with the added flags

Raises:

ValueError – The flag name is not a valid flag

property list_names: list[str]

A list of all the names of the flag.

property name: str | None

The name of the flag, or the |-joined names if it’s a combination.

classmethod none() → Self

Returns a flag with no flags.

Return type:

Self

property pretty_name: str

A pretty name for the flag.

remove_flags(*flag_name) → Self

Remove a flag by name.

Parameters:

flag_name (Union[Self, str]) – The flag to remove

Return type:

Self

Returns:

The flag with the removed flag

Raises:

ValueError – The flag name is not a valid flag

to_names() → list[str]

Returns the current names of the flag.

Return type:

list[str]

value
class discord_http.flags.AttachmentFlags(value=0)

Bases: BaseFlag

Represents the flags of a message attachment.

Parameters:

value (int)

Return type:

Self

is_clip = <AttachmentFlags.is_clip: 1>
is_thumbnail = <AttachmentFlags.is_thumbnail: 2>
is_remix = <AttachmentFlags.is_remix: 4>
is_spoiler = <AttachmentFlags.is_spoiler: 8>
is_animated = <AttachmentFlags.is_animated: 32>
add_flags(*flag_name) → Self

Add a flag by name.

Parameters:

*flag_name (Union[Self, str]) – The flag to add

Return type:

Self

Returns:

The flag with the added flag

Raises:

ValueError – The flag name is not a valid flag

classmethod all() → Self

Returns a flag with all the flags.

Return type:

Self

copy() → Self

Returns a copy of the flag.

Return type:

Self

classmethod from_names(*args) → Self

Create a flag from names.

Parameters:

*args (str) – The names of the flags to create

Return type:

Self

Returns:

The flag with the added flags

Raises:

ValueError – The flag name is not a valid flag

property list_names: list[str]

A list of all the names of the flag.

property name: str | None

The name of the flag, or the |-joined names if it’s a combination.

classmethod none() → Self

Returns a flag with no flags.

Return type:

Self

property pretty_name: str

A pretty name for the flag.

remove_flags(*flag_name) → Self

Remove a flag by name.

Parameters:

flag_name (Union[Self, str]) – The flag to remove

Return type:

Self

Returns:

The flag with the removed flag

Raises:

ValueError – The flag name is not a valid flag

to_names() → list[str]

Returns the current names of the flag.

Return type:

list[str]

value
class discord_http.flags.BaseFlag(value=0)

Bases: object

Base class for all flags inside discord.http library.

This is a hand-rolled bitfield, not enum.Flag. Every value passed to a subclass is a plain combination of power-of-two members, and stdlib’s Flag has to fall back to an O(members) linear scan to decompose those combinations on every single construction (_missing_/_iter_member_by_value_), which shows up hot: every interaction and every member/role touches a Permissions bitmask at least once. This class does the same masking with a single & against a precomputed “all known bits” value instead.

Comparisons still work with values or names directly, example:

Permissions.administrator == 1 << 3  # True
Permissions.administrator > 0  # True
Parameters:

value (int)

Return type:

Self

property name: str | None

The name of the flag, or the |-joined names if it’s a combination.

property pretty_name: str

A pretty name for the flag.

property list_names: list[str]

A list of all the names of the flag.

to_names() → list[str]

Returns the current names of the flag.

Return type:

list[str]

add_flags(*flag_name) → Self

Add a flag by name.

Parameters:

*flag_name (Union[Self, str]) – The flag to add

Return type:

Self

Returns:

The flag with the added flag

Raises:

ValueError – The flag name is not a valid flag

remove_flags(*flag_name) → Self

Remove a flag by name.

Parameters:

flag_name (Union[Self, str]) – The flag to remove

Return type:

Self

Returns:

The flag with the removed flag

Raises:

ValueError – The flag name is not a valid flag

copy() → Self

Returns a copy of the flag.

Return type:

Self

classmethod all() → Self

Returns a flag with all the flags.

Return type:

Self

classmethod none() → Self

Returns a flag with no flags.

Return type:

Self

classmethod from_names(*args) → Self

Create a flag from names.

Parameters:

*args (str) – The names of the flags to create

Return type:

Self

Returns:

The flag with the added flags

Raises:

ValueError – The flag name is not a valid flag

value
class discord_http.flags.ChannelFlags(value=0)

Bases: BaseFlag

Represents the flags of a Discord channel.

Parameters:

value (int)

Return type:

Self

pinned = <ChannelFlags.pinned: 2>
require_tag = <ChannelFlags.require_tag: 16>
hide_media_download_options = <ChannelFlags.hide_media_download_options: 32768>
obfuscated = <ChannelFlags.obfuscated: 131072>
is_spoiler_channel = <ChannelFlags.is_spoiler_channel: 2097152>
add_flags(*flag_name) → Self

Add a flag by name.

Parameters:

*flag_name (Union[Self, str]) – The flag to add

Return type:

Self

Returns:

The flag with the added flag

Raises:

ValueError – The flag name is not a valid flag

classmethod all() → Self

Returns a flag with all the flags.

Return type:

Self

copy() → Self

Returns a copy of the flag.

Return type:

Self

classmethod from_names(*args) → Self

Create a flag from names.

Parameters:

*args (str) – The names of the flags to create

Return type:

Self

Returns:

The flag with the added flags

Raises:

ValueError – The flag name is not a valid flag

property list_names: list[str]

A list of all the names of the flag.

property name: str | None

The name of the flag, or the |-joined names if it’s a combination.

classmethod none() → Self

Returns a flag with no flags.

Return type:

Self

property pretty_name: str

A pretty name for the flag.

remove_flags(*flag_name) → Self

Remove a flag by name.

Parameters:

flag_name (Union[Self, str]) – The flag to remove

Return type:

Self

Returns:

The flag with the removed flag

Raises:

ValueError – The flag name is not a valid flag

to_names() → list[str]

Returns the current names of the flag.

Return type:

list[str]

value
class discord_http.flags.GuildInviteFlags(value=0)

Bases: BaseFlag

Represents the flags of a guild invite.

Parameters:

value (int)

Return type:

Self

is_guest_invite = <GuildInviteFlags.is_guest_invite: 1>
add_flags(*flag_name) → Self

Add a flag by name.

Parameters:

*flag_name (Union[Self, str]) – The flag to add

Return type:

Self

Returns:

The flag with the added flag

Raises:

ValueError – The flag name is not a valid flag

classmethod all() → Self

Returns a flag with all the flags.

Return type:

Self

copy() → Self

Returns a copy of the flag.

Return type:

Self

classmethod from_names(*args) → Self

Create a flag from names.

Parameters:

*args (str) – The names of the flags to create

Return type:

Self

Returns:

The flag with the added flags

Raises:

ValueError – The flag name is not a valid flag

property list_names: list[str]

A list of all the names of the flag.

property name: str | None

The name of the flag, or the |-joined names if it’s a combination.

classmethod none() → Self

Returns a flag with no flags.

Return type:

Self

property pretty_name: str

A pretty name for the flag.

remove_flags(*flag_name) → Self

Remove a flag by name.

Parameters:

flag_name (Union[Self, str]) – The flag to remove

Return type:

Self

Returns:

The flag with the removed flag

Raises:

ValueError – The flag name is not a valid flag

to_names() → list[str]

Returns the current names of the flag.

Return type:

list[str]

value
class discord_http.flags.GuildMemberFlags(value=0)

Bases: BaseFlag

Represents the flags of a guild member.

Parameters:

value (int)

Return type:

Self

did_rejoin = <GuildMemberFlags.did_rejoin: 1>
completed_onboarding = <GuildMemberFlags.completed_onboarding: 2>
bypasses_verification = <GuildMemberFlags.bypasses_verification: 4>
started_onboarding = <GuildMemberFlags.started_onboarding: 8>
is_guest = <GuildMemberFlags.is_guest: 16>
started_home_actions = <GuildMemberFlags.started_home_actions: 32>
completed_home_actions = <GuildMemberFlags.completed_home_actions: 64>
automod_quarantined_username = <GuildMemberFlags.automod_quarantined_username: 128>
dm_settings_upsell_acknowledged = <GuildMemberFlags.dm_settings_upsell_acknowledged: 512>
automod_quarantined_guild_tag = <GuildMemberFlags.automod_quarantined_guild_tag: 1024>
add_flags(*flag_name) → Self

Add a flag by name.

Parameters:

*flag_name (Union[Self, str]) – The flag to add

Return type:

Self

Returns:

The flag with the added flag

Raises:

ValueError – The flag name is not a valid flag

classmethod all() → Self

Returns a flag with all the flags.

Return type:

Self

copy() → Self

Returns a copy of the flag.

Return type:

Self

classmethod from_names(*args) → Self

Create a flag from names.

Parameters:

*args (str) – The names of the flags to create

Return type:

Self

Returns:

The flag with the added flags

Raises:

ValueError – The flag name is not a valid flag

property list_names: list[str]

A list of all the names of the flag.

property name: str | None

The name of the flag, or the |-joined names if it’s a combination.

classmethod none() → Self

Returns a flag with no flags.

Return type:

Self

property pretty_name: str

A pretty name for the flag.

remove_flags(*flag_name) → Self

Remove a flag by name.

Parameters:

flag_name (Union[Self, str]) – The flag to remove

Return type:

Self

Returns:

The flag with the removed flag

Raises:

ValueError – The flag name is not a valid flag

to_names() → list[str]

Returns the current names of the flag.

Return type:

list[str]

value
class discord_http.flags.MessageFlags(value=0)

Bases: BaseFlag

Represents the flags of a Discord message.

Parameters:

value (int)

Return type:

Self

crossposted = <MessageFlags.crossposted: 1>
is_crosspost = <MessageFlags.is_crosspost: 2>
suppress_embeds = <MessageFlags.suppress_embeds: 4>
source_message_deleted = <MessageFlags.source_message_deleted: 8>
urgent = <MessageFlags.urgent: 16>
has_thread = <MessageFlags.has_thread: 32>
ephemeral = <MessageFlags.ephemeral: 64>
loading = <MessageFlags.loading: 128>
failed_to_mention_some_roles_in_thread = <MessageFlags.failed_to_mention_some_roles_in_thread: 256>
suppress_notifications = <MessageFlags.suppress_notifications: 4096>
is_voice_message = <MessageFlags.is_voice_message: 8192>
has_snapshot = <MessageFlags.has_snapshot: 16384>
is_components_v2 = <MessageFlags.is_components_v2: 32768>
add_flags(*flag_name) → Self

Add a flag by name.

Parameters:

*flag_name (Union[Self, str]) – The flag to add

Return type:

Self

Returns:

The flag with the added flag

Raises:

ValueError – The flag name is not a valid flag

classmethod all() → Self

Returns a flag with all the flags.

Return type:

Self

copy() → Self

Returns a copy of the flag.

Return type:

Self

classmethod from_names(*args) → Self

Create a flag from names.

Parameters:

*args (str) – The names of the flags to create

Return type:

Self

Returns:

The flag with the added flags

Raises:

ValueError – The flag name is not a valid flag

property list_names: list[str]

A list of all the names of the flag.

property name: str | None

The name of the flag, or the |-joined names if it’s a combination.

classmethod none() → Self

Returns a flag with no flags.

Return type:

Self

property pretty_name: str

A pretty name for the flag.

remove_flags(*flag_name) → Self

Remove a flag by name.

Parameters:

flag_name (Union[Self, str]) – The flag to remove

Return type:

Self

Returns:

The flag with the removed flag

Raises:

ValueError – The flag name is not a valid flag

to_names() → list[str]

Returns the current names of the flag.

Return type:

list[str]

value
class discord_http.flags.PermissionOverwrite(target, *, allow=None, deny=None, target_type=None)

Bases: object

Represents a permission overwrite for a channel target (member or role).

Parameters:
allow: Permissions

The permissions that are explicitly allowed for the target.

deny: Permissions

The permissions that are explicitly denied for the target.

target: Snowflake

The target of the permission overwrite (member or role).

target_type: PermissionType

The type of the overwrite target, either member or role.

is_role() → bool

Returns whether the overwrite is a role overwrite.

Return type:

bool

is_member() → bool

Returns whether the overwrite is a member overwrite.

Return type:

bool

classmethod from_dict(data) → Self

Create a permission overwrite from a dictionary.

Parameters:

data (dict) – The dictionary to create the permission overwrite from

Return type:

Self

Returns:

The permission overwrite

to_dict() → dict

Returns the permission overwrite as a dictionary.

Return type:

dict

copy() → Self

Returns a copy of the flag.

Return type:

Self

class discord_http.flags.Permissions(value=0)

Bases: BaseFlag

Represents the permission flags for a guild member or role.

Parameters:

value (int)

Return type:

Self

create_instant_invite = <Permissions.create_instant_invite: 1>
kick_members = <Permissions.kick_members: 2>
ban_members = <Permissions.ban_members: 4>
administrator = <Permissions.administrator: 8>
manage_channels = <Permissions.manage_channels: 16>
manage_guild = <Permissions.manage_guild: 32>
add_reactions = <Permissions.add_reactions: 64>
view_audit_log = <Permissions.view_audit_log: 128>
priority_speaker = <Permissions.priority_speaker: 256>
stream = <Permissions.stream: 512>
view_channel = <Permissions.view_channel: 1024>
send_messages = <Permissions.send_messages: 2048>
send_tts_messages = <Permissions.send_tts_messages: 4096>
manage_messages = <Permissions.manage_messages: 8192>
attach_files = <Permissions.attach_files: 32768>
read_message_history = <Permissions.read_message_history: 65536>
mention_everyone = <Permissions.mention_everyone: 131072>
use_external_emojis = <Permissions.use_external_emojis: 262144>
view_guild_insights = <Permissions.view_guild_insights: 524288>
connect = <Permissions.connect: 1048576>
speak = <Permissions.speak: 2097152>
mute_members = <Permissions.mute_members: 4194304>
deafen_members = <Permissions.deafen_members: 8388608>
move_members = <Permissions.move_members: 16777216>
use_vad = <Permissions.use_vad: 33554432>
change_nickname = <Permissions.change_nickname: 67108864>
manage_nicknames = <Permissions.manage_nicknames: 134217728>
manage_roles = <Permissions.manage_roles: 268435456>
manage_webhooks = <Permissions.manage_webhooks: 536870912>
manage_guild_expressions = <Permissions.manage_guild_expressions: 1073741824>
use_application_commands = <Permissions.use_application_commands: 2147483648>
request_to_speak = <Permissions.request_to_speak: 4294967296>
manage_events = <Permissions.manage_events: 8589934592>
manage_threads = <Permissions.manage_threads: 17179869184>
create_public_threads = <Permissions.create_public_threads: 34359738368>
create_private_threads = <Permissions.create_private_threads: 68719476736>
use_external_stickers = <Permissions.use_external_stickers: 137438953472>
send_messages_in_threads = <Permissions.send_messages_in_threads: 274877906944>
use_embedded_activities = <Permissions.use_embedded_activities: 549755813888>
moderate_members = <Permissions.moderate_members: 1099511627776>
view_creator_monetization_analytics = <Permissions.view_creator_monetization_analytics: 2199023255552>
use_soundboard = <Permissions.use_soundboard: 4398046511104>
create_guild_expressions = <Permissions.create_guild_expressions: 8796093022208>
create_events = <Permissions.create_events: 17592186044416>
use_external_sounds = <Permissions.use_external_sounds: 35184372088832>
send_voice_messages = <Permissions.send_voice_messages: 70368744177664>
set_voice_channel_status = <Permissions.set_voice_channel_status: 281474976710656>
send_polls = <Permissions.send_polls: 562949953421312>
use_external_apps = <Permissions.use_external_apps: 1125899906842624>
pin_messages = <Permissions.pin_messages: 2251799813685248>
bypass_slowmode = <Permissions.bypass_slowmode: 4503599627370496>
handle_overwrite(allow, deny) → Permissions

Handles the overwrite of permissions.

Parameters:
  • allow (int) – The permission flag integer to allow

  • deny (int) – The permission flag integer to deny

Return type:

Permissions

Returns:

The permissions with the overwrite applied

add_flags(*flag_name) → Self

Add a flag by name.

Parameters:

*flag_name (Union[Self, str]) – The flag to add

Return type:

Self

Returns:

The flag with the added flag

Raises:

ValueError – The flag name is not a valid flag

classmethod all() → Self

Returns a flag with all the flags.

Return type:

Self

copy() → Self

Returns a copy of the flag.

Return type:

Self

classmethod from_names(*args) → Self

Create a flag from names.

Parameters:

*args (str) – The names of the flags to create

Return type:

Self

Returns:

The flag with the added flags

Raises:

ValueError – The flag name is not a valid flag

property list_names: list[str]

A list of all the names of the flag.

property name: str | None

The name of the flag, or the |-joined names if it’s a combination.

classmethod none() → Self

Returns a flag with no flags.

Return type:

Self

property pretty_name: str

A pretty name for the flag.

remove_flags(*flag_name) → Self

Remove a flag by name.

Parameters:

flag_name (Union[Self, str]) – The flag to remove

Return type:

Self

Returns:

The flag with the removed flag

Raises:

ValueError – The flag name is not a valid flag

to_names() → list[str]

Returns the current names of the flag.

Return type:

list[str]

value
class discord_http.flags.SKUFlags(value=0)

Bases: BaseFlag

Represents the flags of an application SKU.

Parameters:

value (int)

Return type:

Self

available = <SKUFlags.available: 4>
guild_subscription = <SKUFlags.guild_subscription: 128>
user_subscription = <SKUFlags.user_subscription: 256>
add_flags(*flag_name) → Self

Add a flag by name.

Parameters:

*flag_name (Union[Self, str]) – The flag to add

Return type:

Self

Returns:

The flag with the added flag

Raises:

ValueError – The flag name is not a valid flag

classmethod all() → Self

Returns a flag with all the flags.

Return type:

Self

copy() → Self

Returns a copy of the flag.

Return type:

Self

classmethod from_names(*args) → Self

Create a flag from names.

Parameters:

*args (str) – The names of the flags to create

Return type:

Self

Returns:

The flag with the added flags

Raises:

ValueError – The flag name is not a valid flag

property list_names: list[str]

A list of all the names of the flag.

property name: str | None

The name of the flag, or the |-joined names if it’s a combination.

classmethod none() → Self

Returns a flag with no flags.

Return type:

Self

property pretty_name: str

A pretty name for the flag.

remove_flags(*flag_name) → Self

Remove a flag by name.

Parameters:

flag_name (Union[Self, str]) – The flag to remove

Return type:

Self

Returns:

The flag with the removed flag

Raises:

ValueError – The flag name is not a valid flag

to_names() → list[str]

Returns the current names of the flag.

Return type:

list[str]

value
class discord_http.flags.SystemChannelFlags(value=0)

Bases: BaseFlag

Represents the system channel flags for a guild.

Parameters:

value (int)

Return type:

Self

suppress_join_notifications = <SystemChannelFlags.suppress_join_notifications: 1>
suppress_premium_subscriptions = <SystemChannelFlags.suppress_premium_subscriptions: 2>
suppress_guild_reminder_notifications = <SystemChannelFlags.suppress_guild_reminder_notifications: 4>
suppress_join_notification_replies = <SystemChannelFlags.suppress_join_notification_replies: 8>
suppress_role_subscription_purchase_notifications = <SystemChannelFlags.suppress_role_subscription_purchase_notifications: 16>
suppress_role_subscription_purchase_notifications_replies = <SystemChannelFlags.suppress_role_subscription_purchase_notifications_replies: 32>
add_flags(*flag_name) → Self

Add a flag by name.

Parameters:

*flag_name (Union[Self, str]) – The flag to add

Return type:

Self

Returns:

The flag with the added flag

Raises:

ValueError – The flag name is not a valid flag

classmethod all() → Self

Returns a flag with all the flags.

Return type:

Self

copy() → Self

Returns a copy of the flag.

Return type:

Self

classmethod from_names(*args) → Self

Create a flag from names.

Parameters:

*args (str) – The names of the flags to create

Return type:

Self

Returns:

The flag with the added flags

Raises:

ValueError – The flag name is not a valid flag

property list_names: list[str]

A list of all the names of the flag.

property name: str | None

The name of the flag, or the |-joined names if it’s a combination.

classmethod none() → Self

Returns a flag with no flags.

Return type:

Self

property pretty_name: str

A pretty name for the flag.

remove_flags(*flag_name) → Self

Remove a flag by name.

Parameters:

flag_name (Union[Self, str]) – The flag to remove

Return type:

Self

Returns:

The flag with the removed flag

Raises:

ValueError – The flag name is not a valid flag

to_names() → list[str]

Returns the current names of the flag.

Return type:

list[str]

value
class discord_http.flags.UserFlags(value=0)

Bases: BaseFlag

Represents the public flags on a user’s account.

Parameters:

value (int)

Return type:

Self

staff = <UserFlags.staff: 1>
partner = <UserFlags.partner: 2>
hypesquad = <UserFlags.hypesquad: 4>
bug_hunter_level_1 = <UserFlags.bug_hunter_level_1: 8>
hypesquad_online_house_1 = <UserFlags.hypesquad_online_house_1: 64>
hypesquad_online_house_2 = <UserFlags.hypesquad_online_house_2: 128>
hypesquad_online_house_3 = <UserFlags.hypesquad_online_house_3: 256>
premium_early_supporter = <UserFlags.premium_early_supporter: 512>
team_pseudo_user = <UserFlags.team_pseudo_user: 1024>
bug_hunter_level_2 = <UserFlags.bug_hunter_level_2: 16384>
verified_bot = <UserFlags.verified_bot: 65536>
verified_developer = <UserFlags.verified_developer: 131072>
certified_moderator = <UserFlags.certified_moderator: 262144>
bot_http_interactions = <UserFlags.bot_http_interactions: 524288>
spammer = <UserFlags.spammer: 1048576>
active_developer = <UserFlags.active_developer: 4194304>
provisional_account = <UserFlags.provisional_account: 8388608>
add_flags(*flag_name) → Self

Add a flag by name.

Parameters:

*flag_name (Union[Self, str]) – The flag to add

Return type:

Self

Returns:

The flag with the added flag

Raises:

ValueError – The flag name is not a valid flag

classmethod all() → Self

Returns a flag with all the flags.

Return type:

Self

copy() → Self

Returns a copy of the flag.

Return type:

Self

classmethod from_names(*args) → Self

Create a flag from names.

Parameters:

*args (str) – The names of the flags to create

Return type:

Self

Returns:

The flag with the added flags

Raises:

ValueError – The flag name is not a valid flag

property list_names: list[str]

A list of all the names of the flag.

property name: str | None

The name of the flag, or the |-joined names if it’s a combination.

classmethod none() → Self

Returns a flag with no flags.

Return type:

Self

property pretty_name: str

A pretty name for the flag.

remove_flags(*flag_name) → Self

Remove a flag by name.

Parameters:

flag_name (Union[Self, str]) – The flag to remove

Return type:

Self

Returns:

The flag with the removed flag

Raises:

ValueError – The flag name is not a valid flag

to_names() → list[str]

Returns the current names of the flag.

Return type:

list[str]

value