Skip to content

hikari.users#

Application and entities that are used to describe Users on Discord.

OwnUser #

Bases: UserImpl

Represents a user with extended OAuth2 information.

accent_color class-attribute instance-attribute #

accent_color: Optional[Color] = field(eq=False, hash=False, repr=False)

The custom banner color for the user, if set.

The official client will decide the default color if not set.

accent_colour property #

accent_colour: Optional[Color]

Alias for the hikari.users.User.accent_color field.

app class-attribute instance-attribute #

app: RESTAware = field(
    repr=False, eq=False, hash=False, metadata={SKIP_DEEP_COPY: True}
)

Client application that models may use for procedures.

avatar_hash class-attribute instance-attribute #

avatar_hash: Optional[str] = field(eq=False, hash=False, repr=False)

The user's avatar hash, if they have one, otherwise None.

avatar_url property #

avatar_url: Optional[URL]

Avatar URL for the user, if they have one set.

May be None if no custom avatar is set. In this case, you should use hikari.User.default_avatar_url instead.

banner_hash class-attribute instance-attribute #

banner_hash: Optional[str] = field(eq=False, hash=False, repr=False)

Banner hash of the user, if they have one, otherwise None

banner_url property #

banner_url: Optional[URL]

Banner URL for the user, if they have one set.

May be None if no custom banner is set.

created_at property #

created_at: datetime

When the object was created.

default_avatar_url property #

default_avatar_url: URL

Default avatar URL for this user.

discriminator class-attribute instance-attribute #

discriminator: str = field(eq=False, hash=False, repr=True)

The user's discriminator.

!!! deprecated 2.0.0.dev120 Discriminators are deprecated and being replaced with "0" by Discord during username migration. This field will be removed after migration is complete. Learn more here: https://dis.gd/usernames

display_avatar_url property #

display_avatar_url: URL

Display avatar URL for this user.

email class-attribute instance-attribute #

email: Optional[str] = field(eq=False, hash=False, repr=False)

The user's set email.

Will be None if retrieved through OAuth2 flow without the email scope. Will always be None for bot users.

flags class-attribute instance-attribute #

flags: UserFlag = field(eq=False, hash=False, repr=True)

The public flags for this user.

global_name class-attribute instance-attribute #

global_name: Optional[str] = field(eq=False, hash=False, repr=True)

The user's global name.

id class-attribute instance-attribute #

id: Snowflake = field(hash=True, repr=True)

The ID of this user.

is_bot class-attribute instance-attribute #

is_bot: bool = field(eq=False, hash=False, repr=True)

True if this user is a bot account, False otherwise.

is_mfa_enabled class-attribute instance-attribute #

is_mfa_enabled: bool = field(eq=False, hash=False, repr=False)

Whether the user's account has multi-factor authentication enabled.

is_system class-attribute instance-attribute #

is_system: bool = field(eq=False, hash=False, repr=True)

True if this user is a system account, False otherwise.

is_verified class-attribute instance-attribute #

is_verified: Optional[bool] = field(eq=False, hash=False, repr=False)

Whether the email for this user's account has been verified.

Will be None if retrieved through the OAuth2 flow without the email scope.

locale class-attribute instance-attribute #

locale: Optional[Union[str, Locale]] = field(eq=False, hash=False, repr=False)

The user's set locale.

This is not provided in the READY event.

mention property #

mention: str

Return a raw mention string for the given user.

Examples:

    >>> some_user.mention
    '<@123456789123456789>'

premium_type class-attribute instance-attribute #

premium_type: Union[PremiumType, int, None] = field(
    eq=False, hash=False, repr=False
)

The type of Nitro Subscription this user account had.

This will always be None for bots.

username class-attribute instance-attribute #

username: str = field(eq=False, hash=False, repr=True)

The user's username.

fetch_dm_channel async #

fetch_dm_channel() -> NoReturn

Fetch the DM channel for this user.

RETURNS DESCRIPTION
DMChannel

The requested channel.

RAISES DESCRIPTION
UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

NotFoundError

If the user is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_self async #

fetch_self() -> OwnUser

Get this user's up-to-date object.

RETURNS DESCRIPTION
OwnUser

The requested user object.

RAISES DESCRIPTION
UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

make_avatar_url #

make_avatar_url(
    *, ext: Optional[str] = None, size: int = 4096
) -> Optional[URL]

Generate the avatar URL for this user, if set.

If no custom avatar is set, this returns None. You can then use the hikari.User.default_avatar_url attribute instead to fetch the displayed URL.

PARAMETER DESCRIPTION
ext

The ext to use for this URL. Supports png, jpeg, jpg, webp and gif (when animated). Will be ignored for default avatars which can only be png.

If None, then the correct default extension is determined based on whether the icon is animated or not.

TYPE: Optional[str] DEFAULT: None

size

The size to set for the URL. Can be any power of two between 16 and 4096. Will be ignored for default avatars.

TYPE: int DEFAULT: 4096

RETURNS DESCRIPTION
Optional[URL]

The URL to the avatar, or None if not present.

RAISES DESCRIPTION
ValueError

If size is not a power of two or not between 16 and 4096.

make_banner_url #

make_banner_url(
    *, ext: Optional[str] = None, size: int = 4096
) -> Optional[URL]

Generate the banner URL for this user, if set.

If no custom banner is set, this returns None.

PARAMETER DESCRIPTION
ext

The ext to use for this URL. Supports png, jpeg, jpg, webp and gif (when animated).

If None, then the correct default extension is determined based on whether the banner is animated or not.

TYPE: Optional[str] DEFAULT: None

size

The size to set for the URL. Can be any power of two between 16 and 4096.

TYPE: int DEFAULT: 4096

RETURNS DESCRIPTION
Optional[URL]

The URL to the banner, or None if not present.

RAISES DESCRIPTION
ValueError

If size is not a power of two or not between 16 and 4096.

send async #

send(
    content: UndefinedOr[Any] = undefined.UNDEFINED,
    *,
    attachment: UndefinedOr[Resourceish] = undefined.UNDEFINED,
    attachments: UndefinedOr[Sequence[Resourceish]] = undefined.UNDEFINED,
    component: UndefinedOr[ComponentBuilder] = undefined.UNDEFINED,
    components: UndefinedOr[Sequence[ComponentBuilder]] = undefined.UNDEFINED,
    embed: UndefinedOr[Embed] = undefined.UNDEFINED,
    embeds: UndefinedOr[Sequence[Embed]] = undefined.UNDEFINED,
    nonce: UndefinedOr[str] = undefined.UNDEFINED,
    tts: UndefinedOr[bool] = undefined.UNDEFINED,
    reply: UndefinedOr[SnowflakeishOr[PartialMessage]] = undefined.UNDEFINED,
    reply_must_exist: UndefinedOr[bool] = undefined.UNDEFINED,
    mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
    mentions_reply: UndefinedOr[bool] = undefined.UNDEFINED,
    user_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialUser], bool]
    ] = undefined.UNDEFINED,
    role_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialRole], bool]
    ] = undefined.UNDEFINED,
    flags: Union[UndefinedType, int, MessageFlag] = undefined.UNDEFINED
) -> NoReturn

Send a message to this user in DM's.

PARAMETER DESCRIPTION
content

If provided, the message contents. If hikari.undefined.UNDEFINED, then nothing will be sent in the content. Any other value here will be cast to a str.

If this is a hikari.embeds.Embed and no embed nor embeds kwarg is provided, then this will instead update the embed. This allows for simpler syntax when sending an embed alone.

Likewise, if this is a hikari.files.Resource, then the content is instead treated as an attachment if no attachment and no attachments kwargs are provided.

TYPE: UndefinedOr[Any] DEFAULT: UNDEFINED

PARAMETER DESCRIPTION
attachment

If provided, the message attachment. This can be a resource, or string of a path on your computer or a URL.

Attachments can be passed as many different things, to aid in convenience.

TYPE: UndefinedOr[Resourceish]

attachments

If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.

TYPE: UndefinedOr[Sequence[Resourceish]]

component

If provided, builder object of the component to include in this message.

TYPE: UndefinedOr[ComponentBuilder]

components

If provided, a sequence of the component builder objects to include in this message.

TYPE: UndefinedOr[Sequence[ComponentBuilder]]

embed

If provided, the message embed.

TYPE: UndefinedOr[Embed]

embeds

If provided, the message embeds.

TYPE: UndefinedOr[Sequence[Embed]]

tts

If provided, whether the message will be read out by a screen reader using Discord's TTS (text-to-speech) system.

TYPE: UndefinedOr[bool]

reply

If provided, the message to reply to.

TYPE: UndefinedOr[SnowflakeishOr[PartialMessage]]

reply_must_exist

If provided, whether to error if the message being replied to does not exist instead of sending as a normal (non-reply) message.

This will not do anything if not being used with reply.

TYPE: UndefinedOr[bool]

mentions_everyone

If provided, whether the message should parse @everyone/@here mentions.

TYPE: UndefinedOr[bool]

mentions_reply

If provided, whether to mention the author of the message that is being replied to.

This will not do anything if not being used with reply.

TYPE: UndefinedOr[bool]

user_mentions

If provided, and True, all user mentions will be detected. If provided, and False, all user mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.users.PartialUser derivatives to enforce mentioning specific users.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialUser], bool]]

role_mentions

If provided, and True, all role mentions will be detected. If provided, and False, all role mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.guilds.PartialRole derivatives to enforce mentioning specific roles.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialRole], bool]]

flags

If provided, optional flags to set on the message. If hikari.undefined.UNDEFINED, then nothing is changed.

Note that some flags may not be able to be set. Currently the only flags that can be set are hikari.messages.MessageFlag.NONE and hikari.messages.MessageFlag.SUPPRESS_EMBEDS.

TYPE: UndefinedOr[MessageFlag]

RETURNS DESCRIPTION
Message

The created message.

RAISES DESCRIPTION
ValueError

If more than 100 unique objects/entities are passed for role_mentions or user_mentions.

TypeError

If both attachment and attachments are specified.

BadRequestError

This may be raised in several discrete situations, such as messages being empty with no attachments or embeds; messages with more than 2000 characters in them, embeds that exceed one of the many embed limits; too many attachments; attachments that are too large; invalid image URLs in embeds; reply not found or not in the same channel; too many components.

UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

ForbiddenError

If you are missing the hikari.permissions.Permissions.SEND_MESSAGES in the channel or the person you are trying to message has the DM's disabled.

NotFoundError

If the user is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

PartialUser #

Bases: Unique, ABC

A partial interface for a user.

Fields may or may not be present, and should be explicitly checked before using them to ensure they are not hikari.undefined.UNDEFINED.

This is used for endpoints and events that only expose partial user information.

For full user info, consider calling the hikari.users.PartialUser.fetch_self method to perform an API call.

accent_color abstractmethod property #

accent_color: UndefinedNoneOr[Color]

Custom banner color for the user if set, else None.

The official client will decide the default color if not set.

accent_colour property #

accent_colour: UndefinedNoneOr[Color]

app abstractmethod property #

app: RESTAware

Client application that models may use for procedures.

avatar_hash abstractmethod property #

avatar_hash: UndefinedNoneOr[str]

Avatar hash for the user, if they have one, otherwise None.

banner_hash abstractmethod property #

banner_hash: UndefinedNoneOr[str]

Banner hash for the user, if they have one, otherwise None.

created_at property #

created_at: datetime

When the object was created.

discriminator abstractmethod property #

discriminator: UndefinedOr[str]

Discriminator for the user.

!!! deprecated 2.0.0.dev120 Discriminators are deprecated and being replaced with "0" by Discord during username migration. This field will be removed after migration is complete. Learn more here: https://dis.gd/usernames

flags abstractmethod property #

Flag bits that are set for the user.

global_name abstractmethod property #

global_name: UndefinedNoneOr[str]

Global name for the user, if they have one, otherwise None.

id abstractmethod property #

ID of this entity.

is_bot abstractmethod property #

is_bot: UndefinedOr[bool]

Whether this user is a bot account.

is_system abstractmethod property #

is_system: UndefinedOr[bool]

Whether this user is a system account.

mention abstractmethod property #

mention: str

Return a raw mention string for the given user.

Examples:

    >>> some_user.mention
    '<@123456789123456789>'

username abstractmethod property #

username: UndefinedOr[str]

Username for the user.

fetch_dm_channel async #

fetch_dm_channel() -> DMChannel

Fetch the DM channel for this user.

RETURNS DESCRIPTION
DMChannel

The requested channel.

RAISES DESCRIPTION
UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

NotFoundError

If the user is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_self async #

fetch_self() -> User

Get this user's up-to-date object by performing an API call.

RETURNS DESCRIPTION
User

The requested user object.

RAISES DESCRIPTION
NotFoundError

If the user is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

send async #

send(
    content: UndefinedOr[Any] = undefined.UNDEFINED,
    *,
    attachment: UndefinedOr[Resourceish] = undefined.UNDEFINED,
    attachments: UndefinedOr[Sequence[Resourceish]] = undefined.UNDEFINED,
    component: UndefinedOr[ComponentBuilder] = undefined.UNDEFINED,
    components: UndefinedOr[Sequence[ComponentBuilder]] = undefined.UNDEFINED,
    embed: UndefinedOr[Embed] = undefined.UNDEFINED,
    embeds: UndefinedOr[Sequence[Embed]] = undefined.UNDEFINED,
    tts: UndefinedOr[bool] = undefined.UNDEFINED,
    reply: UndefinedOr[SnowflakeishOr[PartialMessage]] = undefined.UNDEFINED,
    reply_must_exist: UndefinedOr[bool] = undefined.UNDEFINED,
    mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
    mentions_reply: UndefinedOr[bool] = undefined.UNDEFINED,
    user_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialUser], bool]
    ] = undefined.UNDEFINED,
    role_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialRole], bool]
    ] = undefined.UNDEFINED,
    flags: Union[UndefinedType, int, MessageFlag] = undefined.UNDEFINED
) -> Message

Send a message to this user in DM's.

PARAMETER DESCRIPTION
content

If provided, the message contents. If hikari.undefined.UNDEFINED, then nothing will be sent in the content. Any other value here will be cast to a str.

If this is a hikari.embeds.Embed and no embed nor embeds kwarg is provided, then this will instead update the embed. This allows for simpler syntax when sending an embed alone.

Likewise, if this is a hikari.files.Resource, then the content is instead treated as an attachment if no attachment and no attachments kwargs are provided.

TYPE: UndefinedOr[Any] DEFAULT: UNDEFINED

PARAMETER DESCRIPTION
attachment

If provided, the message attachment. This can be a resource, or string of a path on your computer or a URL.

Attachments can be passed as many different things, to aid in convenience.

TYPE: UndefinedOr[Resourceish]

attachments

If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.

TYPE: UndefinedOr[Sequence[Resourceish]]

component

If provided, builder object of the component to include in this message.

TYPE: UndefinedOr[ComponentBuilder]

components

If provided, a sequence of the component builder objects to include in this message.

TYPE: UndefinedOr[Sequence[ComponentBuilder]]

embed

If provided, the message embed.

TYPE: UndefinedOr[Embed]

embeds

If provided, the message embeds.

TYPE: UndefinedOr[Sequence[Embed]]

tts

If provided, whether the message will be read out by a screen reader using Discord's TTS (text-to-speech) system.

TYPE: UndefinedOr[bool]

reply

If provided, the message to reply to.

TYPE: UndefinedOr[SnowflakeishOr[PartialMessage]]

reply_must_exist

If provided, whether to error if the message being replied to does not exist instead of sending as a normal (non-reply) message.

This will not do anything if not being used with reply.

TYPE: UndefinedOr[bool]

mentions_everyone

If provided, whether the message should parse @everyone/@here mentions.

TYPE: UndefinedOr[bool]

mentions_reply

If provided, whether to mention the author of the message that is being replied to.

This will not do anything if not being used with reply.

TYPE: UndefinedOr[bool]

user_mentions

If provided, and True, all user mentions will be detected. If provided, and False, all user mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.users.PartialUser derivatives to enforce mentioning specific users.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialUser], bool]]

role_mentions

If provided, and True, all role mentions will be detected. If provided, and False, all role mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.guilds.PartialRole derivatives to enforce mentioning specific roles.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialRole], bool]]

flags

If provided, optional flags to set on the message. If hikari.undefined.UNDEFINED, then nothing is changed.

Note that some flags may not be able to be set. Currently the only flags that can be set are hikari.messages.MessageFlag.NONE and hikari.messages.MessageFlag.SUPPRESS_EMBEDS.

TYPE: UndefinedOr[MessageFlag]

RETURNS DESCRIPTION
Message

The created message.

RAISES DESCRIPTION
ValueError

If more than 100 unique objects/entities are passed for role_mentions or user_mentions.

TypeError

If both attachment and attachments are specified.

BadRequestError

This may be raised in several discrete situations, such as messages being empty with no attachments or embeds; messages with more than 2000 characters in them, embeds that exceed one of the many embed limits; too many attachments; attachments that are too large; invalid image URLs in embeds; reply not found or not in the same channel; too many components.

UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

ForbiddenError

If you are missing the hikari.permissions.Permissions.SEND_MESSAGES in the channel or the person you are trying to message has the DM's disabled.

NotFoundError

If the user is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

PartialUserImpl #

Bases: PartialUser

Implementation for partial information about a user.

This is pretty much the same as a normal user, but information may not be present, which will be denoted by hikari.undefined.UNDEFINED.

accent_color class-attribute instance-attribute #

accent_color: UndefinedNoneOr[Color] = field(eq=False, hash=False, repr=False)

The custom banner color for the user, if set.

The official client will decide the default color if not set.

accent_colour property #

accent_colour: UndefinedNoneOr[Color]

app class-attribute instance-attribute #

app: RESTAware = field(
    repr=False, eq=False, hash=False, metadata={SKIP_DEEP_COPY: True}
)

Client application that models may use for procedures.

avatar_hash class-attribute instance-attribute #

avatar_hash: UndefinedNoneOr[str] = field(eq=False, hash=False, repr=False)

Avatar hash of the user, if a custom avatar is set.

banner_hash class-attribute instance-attribute #

banner_hash: UndefinedNoneOr[str] = field(eq=False, hash=False, repr=False)

Banner hash of the user, if a custom banner is set.

created_at property #

created_at: datetime

When the object was created.

discriminator class-attribute instance-attribute #

discriminator: UndefinedOr[str] = field(eq=False, hash=False, repr=True)

Four-digit discriminator for the user if unmigrated.

!!! deprecated 2.0.0.dev120 Discriminators are deprecated and being replaced with "0" by Discord during username migration. This field will be removed after migration is complete. Learn more here: https://dis.gd/usernames

flags class-attribute instance-attribute #

flags: UndefinedOr[UserFlag] = field(eq=False, hash=False, repr=True)

Public flags for this user.

global_name class-attribute instance-attribute #

global_name: UndefinedNoneOr[str] = field(eq=False, hash=False, repr=True)

Global name of the user.

id class-attribute instance-attribute #

id: Snowflake = field(hash=True, repr=True)

The ID of this user.

is_bot class-attribute instance-attribute #

is_bot: UndefinedOr[bool] = field(eq=False, hash=False, repr=True)

Whether this user is a bot account.

is_system class-attribute instance-attribute #

is_system: UndefinedOr[bool] = field(eq=False, hash=False, repr=True)

Whether this user is a system account.

mention property #

mention: str

Return a raw mention string for the given user.

Examples:

    >>> some_user.mention
    '<@123456789123456789>'

username class-attribute instance-attribute #

username: UndefinedOr[str] = field(eq=False, hash=False, repr=True)

Username of the user.

fetch_dm_channel async #

fetch_dm_channel() -> DMChannel

Fetch the DM channel for this user.

RETURNS DESCRIPTION
DMChannel

The requested channel.

RAISES DESCRIPTION
UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

NotFoundError

If the user is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_self async #

fetch_self() -> User

Get this user's up-to-date object by performing an API call.

RETURNS DESCRIPTION
User

The requested user object.

RAISES DESCRIPTION
NotFoundError

If the user is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

send async #

send(
    content: UndefinedOr[Any] = undefined.UNDEFINED,
    *,
    attachment: UndefinedOr[Resourceish] = undefined.UNDEFINED,
    attachments: UndefinedOr[Sequence[Resourceish]] = undefined.UNDEFINED,
    component: UndefinedOr[ComponentBuilder] = undefined.UNDEFINED,
    components: UndefinedOr[Sequence[ComponentBuilder]] = undefined.UNDEFINED,
    embed: UndefinedOr[Embed] = undefined.UNDEFINED,
    embeds: UndefinedOr[Sequence[Embed]] = undefined.UNDEFINED,
    tts: UndefinedOr[bool] = undefined.UNDEFINED,
    reply: UndefinedOr[SnowflakeishOr[PartialMessage]] = undefined.UNDEFINED,
    reply_must_exist: UndefinedOr[bool] = undefined.UNDEFINED,
    mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
    mentions_reply: UndefinedOr[bool] = undefined.UNDEFINED,
    user_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialUser], bool]
    ] = undefined.UNDEFINED,
    role_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialRole], bool]
    ] = undefined.UNDEFINED,
    flags: Union[UndefinedType, int, MessageFlag] = undefined.UNDEFINED
) -> Message

Send a message to this user in DM's.

PARAMETER DESCRIPTION
content

If provided, the message contents. If hikari.undefined.UNDEFINED, then nothing will be sent in the content. Any other value here will be cast to a str.

If this is a hikari.embeds.Embed and no embed nor embeds kwarg is provided, then this will instead update the embed. This allows for simpler syntax when sending an embed alone.

Likewise, if this is a hikari.files.Resource, then the content is instead treated as an attachment if no attachment and no attachments kwargs are provided.

TYPE: UndefinedOr[Any] DEFAULT: UNDEFINED

PARAMETER DESCRIPTION
attachment

If provided, the message attachment. This can be a resource, or string of a path on your computer or a URL.

Attachments can be passed as many different things, to aid in convenience.

TYPE: UndefinedOr[Resourceish]

attachments

If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.

TYPE: UndefinedOr[Sequence[Resourceish]]

component

If provided, builder object of the component to include in this message.

TYPE: UndefinedOr[ComponentBuilder]

components

If provided, a sequence of the component builder objects to include in this message.

TYPE: UndefinedOr[Sequence[ComponentBuilder]]

embed

If provided, the message embed.

TYPE: UndefinedOr[Embed]

embeds

If provided, the message embeds.

TYPE: UndefinedOr[Sequence[Embed]]

tts

If provided, whether the message will be read out by a screen reader using Discord's TTS (text-to-speech) system.

TYPE: UndefinedOr[bool]

reply

If provided, the message to reply to.

TYPE: UndefinedOr[SnowflakeishOr[PartialMessage]]

reply_must_exist

If provided, whether to error if the message being replied to does not exist instead of sending as a normal (non-reply) message.

This will not do anything if not being used with reply.

TYPE: UndefinedOr[bool]

mentions_everyone

If provided, whether the message should parse @everyone/@here mentions.

TYPE: UndefinedOr[bool]

mentions_reply

If provided, whether to mention the author of the message that is being replied to.

This will not do anything if not being used with reply.

TYPE: UndefinedOr[bool]

user_mentions

If provided, and True, all user mentions will be detected. If provided, and False, all user mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.users.PartialUser derivatives to enforce mentioning specific users.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialUser], bool]]

role_mentions

If provided, and True, all role mentions will be detected. If provided, and False, all role mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.guilds.PartialRole derivatives to enforce mentioning specific roles.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialRole], bool]]

flags

If provided, optional flags to set on the message. If hikari.undefined.UNDEFINED, then nothing is changed.

Note that some flags may not be able to be set. Currently the only flags that can be set are hikari.messages.MessageFlag.NONE and hikari.messages.MessageFlag.SUPPRESS_EMBEDS.

TYPE: UndefinedOr[MessageFlag]

RETURNS DESCRIPTION
Message

The created message.

RAISES DESCRIPTION
ValueError

If more than 100 unique objects/entities are passed for role_mentions or user_mentions.

TypeError

If both attachment and attachments are specified.

BadRequestError

This may be raised in several discrete situations, such as messages being empty with no attachments or embeds; messages with more than 2000 characters in them, embeds that exceed one of the many embed limits; too many attachments; attachments that are too large; invalid image URLs in embeds; reply not found or not in the same channel; too many components.

UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

ForbiddenError

If you are missing the hikari.permissions.Permissions.SEND_MESSAGES in the channel or the person you are trying to message has the DM's disabled.

NotFoundError

If the user is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

PremiumType #

Bases: int, Enum

The types of Nitro.

NITRO class-attribute instance-attribute #

NITRO = 2

Premium including all perks (e.g. 2 server boosts).

NITRO_CLASSIC class-attribute instance-attribute #

NITRO_CLASSIC = 1

Premium including basic perks like animated emojis and avatars.

NONE class-attribute instance-attribute #

NONE = 0

No premium.

name property #

name: str

Return the name of the enum member as a str.

value property #

value

Return the value of the enum member.

User #

Bases: PartialUser, ABC

Interface for any user-like object.

This does not include partial users, as they may not be fully formed.

accent_color abstractmethod property #

accent_color: Optional[Color]

The custom banner color for the user, if set else None.

The official client will decide the default color if not set.

accent_colour property #

accent_colour: Optional[Color]

Alias for the hikari.users.User.accent_color field.

app abstractmethod property #

app: RESTAware

Client application that models may use for procedures.

avatar_hash abstractmethod property #

avatar_hash: Optional[str]

Avatar hash for the user, if they have one, otherwise None.

avatar_url property #

avatar_url: Optional[URL]

Avatar URL for the user, if they have one set.

May be None if no custom avatar is set. In this case, you should use hikari.User.default_avatar_url instead.

banner_hash abstractmethod property #

banner_hash: Optional[str]

Banner hash for the user, if they have one, otherwise None.

banner_url property #

banner_url: Optional[URL]

Banner URL for the user, if they have one set.

May be None if no custom banner is set.

created_at property #

created_at: datetime

When the object was created.

default_avatar_url property #

default_avatar_url: URL

Default avatar URL for this user.

discriminator abstractmethod property #

discriminator: str

Discriminator for the user.

!!! deprecated 2.0.0.dev120 Discriminators are deprecated and being replaced with "0" by Discord during username migration. This field will be removed after migration is complete. Learn more here: https://dis.gd/usernames

display_avatar_url property #

display_avatar_url: URL

Display avatar URL for this user.

flags abstractmethod property #

flags: UserFlag

Flag bits that are set for the user.

global_name abstractmethod property #

global_name: Optional[str]

Global name for the user, if they have one, otherwise None.

id abstractmethod property #

ID of this entity.

is_bot abstractmethod property #

is_bot: bool

Whether this user is a bot account.

is_system abstractmethod property #

is_system: bool

Whether this user is a system account.

mention abstractmethod property #

mention: str

Return a raw mention string for the given user.

Examples:

    >>> some_user.mention
    '<@123456789123456789>'

username abstractmethod property #

username: str

Username for the user.

fetch_dm_channel async #

fetch_dm_channel() -> DMChannel

Fetch the DM channel for this user.

RETURNS DESCRIPTION
DMChannel

The requested channel.

RAISES DESCRIPTION
UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

NotFoundError

If the user is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_self async #

fetch_self() -> User

Get this user's up-to-date object by performing an API call.

RETURNS DESCRIPTION
User

The requested user object.

RAISES DESCRIPTION
NotFoundError

If the user is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

make_avatar_url #

make_avatar_url(
    *, ext: Optional[str] = None, size: int = 4096
) -> Optional[URL]

Generate the avatar URL for this user, if set.

If no custom avatar is set, this returns None. You can then use the hikari.User.default_avatar_url attribute instead to fetch the displayed URL.

PARAMETER DESCRIPTION
ext

The ext to use for this URL. Supports png, jpeg, jpg, webp and gif (when animated). Will be ignored for default avatars which can only be png.

If None, then the correct default extension is determined based on whether the icon is animated or not.

TYPE: Optional[str] DEFAULT: None

size

The size to set for the URL. Can be any power of two between 16 and 4096. Will be ignored for default avatars.

TYPE: int DEFAULT: 4096

RETURNS DESCRIPTION
Optional[URL]

The URL to the avatar, or None if not present.

RAISES DESCRIPTION
ValueError

If size is not a power of two or not between 16 and 4096.

make_banner_url #

make_banner_url(
    *, ext: Optional[str] = None, size: int = 4096
) -> Optional[URL]

Generate the banner URL for this user, if set.

If no custom banner is set, this returns None.

PARAMETER DESCRIPTION
ext

The ext to use for this URL. Supports png, jpeg, jpg, webp and gif (when animated).

If None, then the correct default extension is determined based on whether the banner is animated or not.

TYPE: Optional[str] DEFAULT: None

size

The size to set for the URL. Can be any power of two between 16 and 4096.

TYPE: int DEFAULT: 4096

RETURNS DESCRIPTION
Optional[URL]

The URL to the banner, or None if not present.

RAISES DESCRIPTION
ValueError

If size is not a power of two or not between 16 and 4096.

send async #

send(
    content: UndefinedOr[Any] = undefined.UNDEFINED,
    *,
    attachment: UndefinedOr[Resourceish] = undefined.UNDEFINED,
    attachments: UndefinedOr[Sequence[Resourceish]] = undefined.UNDEFINED,
    component: UndefinedOr[ComponentBuilder] = undefined.UNDEFINED,
    components: UndefinedOr[Sequence[ComponentBuilder]] = undefined.UNDEFINED,
    embed: UndefinedOr[Embed] = undefined.UNDEFINED,
    embeds: UndefinedOr[Sequence[Embed]] = undefined.UNDEFINED,
    tts: UndefinedOr[bool] = undefined.UNDEFINED,
    reply: UndefinedOr[SnowflakeishOr[PartialMessage]] = undefined.UNDEFINED,
    reply_must_exist: UndefinedOr[bool] = undefined.UNDEFINED,
    mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
    mentions_reply: UndefinedOr[bool] = undefined.UNDEFINED,
    user_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialUser], bool]
    ] = undefined.UNDEFINED,
    role_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialRole], bool]
    ] = undefined.UNDEFINED,
    flags: Union[UndefinedType, int, MessageFlag] = undefined.UNDEFINED
) -> Message

Send a message to this user in DM's.

PARAMETER DESCRIPTION
content

If provided, the message contents. If hikari.undefined.UNDEFINED, then nothing will be sent in the content. Any other value here will be cast to a str.

If this is a hikari.embeds.Embed and no embed nor embeds kwarg is provided, then this will instead update the embed. This allows for simpler syntax when sending an embed alone.

Likewise, if this is a hikari.files.Resource, then the content is instead treated as an attachment if no attachment and no attachments kwargs are provided.

TYPE: UndefinedOr[Any] DEFAULT: UNDEFINED

PARAMETER DESCRIPTION
attachment

If provided, the message attachment. This can be a resource, or string of a path on your computer or a URL.

Attachments can be passed as many different things, to aid in convenience.

TYPE: UndefinedOr[Resourceish]

attachments

If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.

TYPE: UndefinedOr[Sequence[Resourceish]]

component

If provided, builder object of the component to include in this message.

TYPE: UndefinedOr[ComponentBuilder]

components

If provided, a sequence of the component builder objects to include in this message.

TYPE: UndefinedOr[Sequence[ComponentBuilder]]

embed

If provided, the message embed.

TYPE: UndefinedOr[Embed]

embeds

If provided, the message embeds.

TYPE: UndefinedOr[Sequence[Embed]]

tts

If provided, whether the message will be read out by a screen reader using Discord's TTS (text-to-speech) system.

TYPE: UndefinedOr[bool]

reply

If provided, the message to reply to.

TYPE: UndefinedOr[SnowflakeishOr[PartialMessage]]

reply_must_exist

If provided, whether to error if the message being replied to does not exist instead of sending as a normal (non-reply) message.

This will not do anything if not being used with reply.

TYPE: UndefinedOr[bool]

mentions_everyone

If provided, whether the message should parse @everyone/@here mentions.

TYPE: UndefinedOr[bool]

mentions_reply

If provided, whether to mention the author of the message that is being replied to.

This will not do anything if not being used with reply.

TYPE: UndefinedOr[bool]

user_mentions

If provided, and True, all user mentions will be detected. If provided, and False, all user mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.users.PartialUser derivatives to enforce mentioning specific users.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialUser], bool]]

role_mentions

If provided, and True, all role mentions will be detected. If provided, and False, all role mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.guilds.PartialRole derivatives to enforce mentioning specific roles.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialRole], bool]]

flags

If provided, optional flags to set on the message. If hikari.undefined.UNDEFINED, then nothing is changed.

Note that some flags may not be able to be set. Currently the only flags that can be set are hikari.messages.MessageFlag.NONE and hikari.messages.MessageFlag.SUPPRESS_EMBEDS.

TYPE: UndefinedOr[MessageFlag]

RETURNS DESCRIPTION
Message

The created message.

RAISES DESCRIPTION
ValueError

If more than 100 unique objects/entities are passed for role_mentions or user_mentions.

TypeError

If both attachment and attachments are specified.

BadRequestError

This may be raised in several discrete situations, such as messages being empty with no attachments or embeds; messages with more than 2000 characters in them, embeds that exceed one of the many embed limits; too many attachments; attachments that are too large; invalid image URLs in embeds; reply not found or not in the same channel; too many components.

UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

ForbiddenError

If you are missing the hikari.permissions.Permissions.SEND_MESSAGES in the channel or the person you are trying to message has the DM's disabled.

NotFoundError

If the user is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

UserFlag #

Bases: Flag

The known user flags that represent account badges.

ACTIVE_DEVELOPER class-attribute instance-attribute #

ACTIVE_DEVELOPER = 1 << 22

User is an active bot developer.

BOT_HTTP_INTERACTIONS class-attribute instance-attribute #

BOT_HTTP_INTERACTIONS = 1 << 19

Bot uses only HTTP interactions and is shown in the active member list.

BUG_HUNTER_LEVEL_1 class-attribute instance-attribute #

BUG_HUNTER_LEVEL_1 = 1 << 3

Bug Hunter Level 1.

BUG_HUNTER_LEVEL_2 class-attribute instance-attribute #

BUG_HUNTER_LEVEL_2 = 1 << 14

Bug Hunter Level 2.

DISCORD_CERTIFIED_MODERATOR class-attribute instance-attribute #

DISCORD_CERTIFIED_MODERATOR = 1 << 18

Discord Certified Moderator.

DISCORD_EMPLOYEE class-attribute instance-attribute #

DISCORD_EMPLOYEE = 1 << 0

Discord Employee.

EARLY_SUPPORTER class-attribute instance-attribute #

EARLY_SUPPORTER = 1 << 9

Early Supporter.

EARLY_VERIFIED_DEVELOPER class-attribute instance-attribute #

EARLY_VERIFIED_DEVELOPER = 1 << 17

Early verified Bot Developer.

Only applies to users that verified their account before 20th August 2019.

HYPESQUAD_BALANCE class-attribute instance-attribute #

HYPESQUAD_BALANCE = 1 << 8

House of Balance.

HYPESQUAD_BRAVERY class-attribute instance-attribute #

HYPESQUAD_BRAVERY = 1 << 6

House of Bravery.

HYPESQUAD_BRILLIANCE class-attribute instance-attribute #

HYPESQUAD_BRILLIANCE = 1 << 7

House of Brilliance.

HYPESQUAD_EVENTS class-attribute instance-attribute #

HYPESQUAD_EVENTS = 1 << 2

HypeSquad Events.

NONE class-attribute instance-attribute #

NONE = 0

None.

PARTNERED_SERVER_OWNER class-attribute instance-attribute #

PARTNERED_SERVER_OWNER = 1 << 1

Owner of a partnered Discord server.

TEAM_USER class-attribute instance-attribute #

TEAM_USER = 1 << 10

Team user.

VERIFIED_BOT class-attribute instance-attribute #

VERIFIED_BOT = 1 << 16

Verified Bot.

name property #

name: str

Return the name of the flag combination as a str.

value property #

value: int

Return the int value of the flag.

all #

all(*flags: Self) -> bool

Check if all of the given flags are part of this value.

RETURNS DESCRIPTION
bool

True if any of the given flags are part of this value. Otherwise, return False.

any #

any(*flags: Self) -> bool

Check if any of the given flags are part of this value.

RETURNS DESCRIPTION
bool

True if any of the given flags are part of this value. Otherwise, return False.

difference #

difference(other: Union[int, Self]) -> Self

Perform a set difference with the other set.

This will return all flags in this set that are not in the other value.

Equivalent to using the subtraction - operator.

intersection #

intersection(other: Union[int, Self]) -> Self

Return a combination of flags that are set for both given values.

Equivalent to using the "AND" & operator.

invert #

invert() -> Self

Return a set of all flags not in the current set.

is_disjoint #

is_disjoint(other: Union[int, Self]) -> bool

Return whether two sets have a intersection or not.

If the two sets have an intersection, then this returns False. If no common flag values exist between them, then this returns True.

is_subset #

is_subset(other: Union[int, Self]) -> bool

Return whether another set contains this set or not.

Equivalent to using the "in" operator.

is_superset #

is_superset(other: Union[int, Self]) -> bool

Return whether this set contains another set or not.

none #

none(*flags: Self) -> bool

Check if none of the given flags are part of this value.

Note

This is essentially the opposite of hikari.internal.enums.Flag.any.

RETURNS DESCRIPTION
bool

True if none of the given flags are part of this value. Otherwise, return False.

split #

split() -> Sequence[Self]

Return a list of all defined atomic values for this flag.

Any unrecognised bits will be omitted for brevity.

The result will be a name-sorted typing.Sequence of each member

symmetric_difference #

symmetric_difference(other: Union[int, Self]) -> Self

Return a set with the symmetric differences of two flag sets.

Equivalent to using the "XOR" ^ operator.

For a ^ b, this can be considered the same as (a - b) | (b - a).

union #

union(other: Union[int, Self]) -> Self

Return a combination of all flags in this set and the other set.

Equivalent to using the "OR" ~ operator.

UserImpl #

Bases: PartialUserImpl, User

Concrete implementation of user information.

accent_color class-attribute instance-attribute #

accent_color: Optional[Color] = field(eq=False, hash=False, repr=False)

The custom banner color for the user, if set.

The official client will decide the default color if not set.

accent_colour property #

accent_colour: Optional[Color]

Alias for the hikari.users.User.accent_color field.

app class-attribute instance-attribute #

app: RESTAware = field(
    repr=False, eq=False, hash=False, metadata={SKIP_DEEP_COPY: True}
)

Client application that models may use for procedures.

avatar_hash class-attribute instance-attribute #

avatar_hash: Optional[str] = field(eq=False, hash=False, repr=False)

The user's avatar hash, if they have one, otherwise None.

avatar_url property #

avatar_url: Optional[URL]

Avatar URL for the user, if they have one set.

May be None if no custom avatar is set. In this case, you should use hikari.User.default_avatar_url instead.

banner_hash class-attribute instance-attribute #

banner_hash: Optional[str] = field(eq=False, hash=False, repr=False)

Banner hash of the user, if they have one, otherwise None

banner_url property #

banner_url: Optional[URL]

Banner URL for the user, if they have one set.

May be None if no custom banner is set.

created_at property #

created_at: datetime

When the object was created.

default_avatar_url property #

default_avatar_url: URL

Default avatar URL for this user.

discriminator class-attribute instance-attribute #

discriminator: str = field(eq=False, hash=False, repr=True)

The user's discriminator.

!!! deprecated 2.0.0.dev120 Discriminators are deprecated and being replaced with "0" by Discord during username migration. This field will be removed after migration is complete. Learn more here: https://dis.gd/usernames

display_avatar_url property #

display_avatar_url: URL

Display avatar URL for this user.

flags class-attribute instance-attribute #

flags: UserFlag = field(eq=False, hash=False, repr=True)

The public flags for this user.

global_name class-attribute instance-attribute #

global_name: Optional[str] = field(eq=False, hash=False, repr=True)

The user's global name.

id class-attribute instance-attribute #

id: Snowflake = field(hash=True, repr=True)

The ID of this user.

is_bot class-attribute instance-attribute #

is_bot: bool = field(eq=False, hash=False, repr=True)

True if this user is a bot account, False otherwise.

is_system class-attribute instance-attribute #

is_system: bool = field(eq=False, hash=False, repr=True)

True if this user is a system account, False otherwise.

mention property #

mention: str

Return a raw mention string for the given user.

Examples:

    >>> some_user.mention
    '<@123456789123456789>'

username class-attribute instance-attribute #

username: str = field(eq=False, hash=False, repr=True)

The user's username.

fetch_dm_channel async #

fetch_dm_channel() -> DMChannel

Fetch the DM channel for this user.

RETURNS DESCRIPTION
DMChannel

The requested channel.

RAISES DESCRIPTION
UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

NotFoundError

If the user is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_self async #

fetch_self() -> User

Get this user's up-to-date object by performing an API call.

RETURNS DESCRIPTION
User

The requested user object.

RAISES DESCRIPTION
NotFoundError

If the user is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

make_avatar_url #

make_avatar_url(
    *, ext: Optional[str] = None, size: int = 4096
) -> Optional[URL]

Generate the avatar URL for this user, if set.

If no custom avatar is set, this returns None. You can then use the hikari.User.default_avatar_url attribute instead to fetch the displayed URL.

PARAMETER DESCRIPTION
ext

The ext to use for this URL. Supports png, jpeg, jpg, webp and gif (when animated). Will be ignored for default avatars which can only be png.

If None, then the correct default extension is determined based on whether the icon is animated or not.

TYPE: Optional[str] DEFAULT: None

size

The size to set for the URL. Can be any power of two between 16 and 4096. Will be ignored for default avatars.

TYPE: int DEFAULT: 4096

RETURNS DESCRIPTION
Optional[URL]

The URL to the avatar, or None if not present.

RAISES DESCRIPTION
ValueError

If size is not a power of two or not between 16 and 4096.

make_banner_url #

make_banner_url(
    *, ext: Optional[str] = None, size: int = 4096
) -> Optional[URL]

Generate the banner URL for this user, if set.

If no custom banner is set, this returns None.

PARAMETER DESCRIPTION
ext

The ext to use for this URL. Supports png, jpeg, jpg, webp and gif (when animated).

If None, then the correct default extension is determined based on whether the banner is animated or not.

TYPE: Optional[str] DEFAULT: None

size

The size to set for the URL. Can be any power of two between 16 and 4096.

TYPE: int DEFAULT: 4096

RETURNS DESCRIPTION
Optional[URL]

The URL to the banner, or None if not present.

RAISES DESCRIPTION
ValueError

If size is not a power of two or not between 16 and 4096.

send async #

send(
    content: UndefinedOr[Any] = undefined.UNDEFINED,
    *,
    attachment: UndefinedOr[Resourceish] = undefined.UNDEFINED,
    attachments: UndefinedOr[Sequence[Resourceish]] = undefined.UNDEFINED,
    component: UndefinedOr[ComponentBuilder] = undefined.UNDEFINED,
    components: UndefinedOr[Sequence[ComponentBuilder]] = undefined.UNDEFINED,
    embed: UndefinedOr[Embed] = undefined.UNDEFINED,
    embeds: UndefinedOr[Sequence[Embed]] = undefined.UNDEFINED,
    tts: UndefinedOr[bool] = undefined.UNDEFINED,
    reply: UndefinedOr[SnowflakeishOr[PartialMessage]] = undefined.UNDEFINED,
    reply_must_exist: UndefinedOr[bool] = undefined.UNDEFINED,
    mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
    mentions_reply: UndefinedOr[bool] = undefined.UNDEFINED,
    user_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialUser], bool]
    ] = undefined.UNDEFINED,
    role_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialRole], bool]
    ] = undefined.UNDEFINED,
    flags: Union[UndefinedType, int, MessageFlag] = undefined.UNDEFINED
) -> Message

Send a message to this user in DM's.

PARAMETER DESCRIPTION
content

If provided, the message contents. If hikari.undefined.UNDEFINED, then nothing will be sent in the content. Any other value here will be cast to a str.

If this is a hikari.embeds.Embed and no embed nor embeds kwarg is provided, then this will instead update the embed. This allows for simpler syntax when sending an embed alone.

Likewise, if this is a hikari.files.Resource, then the content is instead treated as an attachment if no attachment and no attachments kwargs are provided.

TYPE: UndefinedOr[Any] DEFAULT: UNDEFINED

PARAMETER DESCRIPTION
attachment

If provided, the message attachment. This can be a resource, or string of a path on your computer or a URL.

Attachments can be passed as many different things, to aid in convenience.

TYPE: UndefinedOr[Resourceish]

attachments

If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.

TYPE: UndefinedOr[Sequence[Resourceish]]

component

If provided, builder object of the component to include in this message.

TYPE: UndefinedOr[ComponentBuilder]

components

If provided, a sequence of the component builder objects to include in this message.

TYPE: UndefinedOr[Sequence[ComponentBuilder]]

embed

If provided, the message embed.

TYPE: UndefinedOr[Embed]

embeds

If provided, the message embeds.

TYPE: UndefinedOr[Sequence[Embed]]

tts

If provided, whether the message will be read out by a screen reader using Discord's TTS (text-to-speech) system.

TYPE: UndefinedOr[bool]

reply

If provided, the message to reply to.

TYPE: UndefinedOr[SnowflakeishOr[PartialMessage]]

reply_must_exist

If provided, whether to error if the message being replied to does not exist instead of sending as a normal (non-reply) message.

This will not do anything if not being used with reply.

TYPE: UndefinedOr[bool]

mentions_everyone

If provided, whether the message should parse @everyone/@here mentions.

TYPE: UndefinedOr[bool]

mentions_reply

If provided, whether to mention the author of the message that is being replied to.

This will not do anything if not being used with reply.

TYPE: UndefinedOr[bool]

user_mentions

If provided, and True, all user mentions will be detected. If provided, and False, all user mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.users.PartialUser derivatives to enforce mentioning specific users.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialUser], bool]]

role_mentions

If provided, and True, all role mentions will be detected. If provided, and False, all role mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.guilds.PartialRole derivatives to enforce mentioning specific roles.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialRole], bool]]

flags

If provided, optional flags to set on the message. If hikari.undefined.UNDEFINED, then nothing is changed.

Note that some flags may not be able to be set. Currently the only flags that can be set are hikari.messages.MessageFlag.NONE and hikari.messages.MessageFlag.SUPPRESS_EMBEDS.

TYPE: UndefinedOr[MessageFlag]

RETURNS DESCRIPTION
Message

The created message.

RAISES DESCRIPTION
ValueError

If more than 100 unique objects/entities are passed for role_mentions or user_mentions.

TypeError

If both attachment and attachments are specified.

BadRequestError

This may be raised in several discrete situations, such as messages being empty with no attachments or embeds; messages with more than 2000 characters in them, embeds that exceed one of the many embed limits; too many attachments; attachments that are too large; invalid image URLs in embeds; reply not found or not in the same channel; too many components.

UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

ForbiddenError

If you are missing the hikari.permissions.Permissions.SEND_MESSAGES in the channel or the person you are trying to message has the DM's disabled.

NotFoundError

If the user is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.