hikari.channels
#
Application and entities that are used to describe both DMs and guild channels on Discord.
WebhookChannelT module-attribute
#
WebhookChannelT = Union[GuildTextChannel, GuildNewsChannel]
Union of the channel types which incoming and follower webhooks can be attached to.
The following types are in this:
WebhookChannelTypes module-attribute
#
WebhookChannelTypes: tuple[type[GuildTextChannel], type[GuildNewsChannel]] = (GuildTextChannel, GuildNewsChannel)
Tuple of the channel types which are valid for hikari.channels.WebhookChannelT
.
This includes:
ChannelFlag #
Bases: Flag
The flags for a channel.
PINNED class-attribute
instance-attribute
#
PINNED = 1 << 1
The thread is pinned in a forum channel.
Note
As of writing, this can only be set for threads belonging to a forum channel.
REQUIRE_TAG class-attribute
instance-attribute
#
REQUIRE_TAG = 1 << 4
Whether a tag is required to be specified when creating a thread in a forum channel
Note
As of writing, this can only be set for forum channels.
ChannelFollow #
Relationship between a news channel and a subscriber channel.
The subscriber channel will receive crosspost messages that correspond to any "broadcast" announcements that the news channel creates.
app class-attribute
instance-attribute
#
Client application that models may use for procedures.
channel_id class-attribute
instance-attribute
#
Return the channel ID of the channel being followed.
webhook_id class-attribute
instance-attribute
#
Return the ID of the webhook for this follow.
fetch_channel async
#
fetch_channel() -> Union[GuildNewsChannel, GuildTextChannel]
Fetch the object of the guild channel being followed.
RETURNS | DESCRIPTION |
---|---|
Union[GuildNewsChannel, GuildTextChannel] | The channel being followed. While this will usually be |
RAISES | DESCRIPTION |
---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the |
NotFoundError | If the channel is not found. |
RateLimitTooLongError | Raised in the event that a rate limit occurs that is longer than |
InternalServerError | If an internal error occurs on Discord while handling the request. |
fetch_webhook async
#
fetch_webhook() -> ChannelFollowerWebhook
Fetch the webhook attached to this follow.
RETURNS | DESCRIPTION |
---|---|
ChannelFollowerWebhook | The webhook attached to this follow. |
RAISES | DESCRIPTION |
---|---|
ForbiddenError | If you are missing the |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the webhook is not found. |
RateLimitTooLongError | Raised in the event that a rate limit occurs that is longer than |
InternalServerError | If an internal error occurs on Discord while handling the request. |
get_channel #
get_channel() -> Union[GuildNewsChannel, GuildTextChannel, None]
Get the channel being followed from the cache.
Warning
This will always be None
if you are not in the guild that this channel exists in.
RETURNS | DESCRIPTION |
---|---|
Union[GuildNewsChannel, GuildTextChannel, None] | The object of the guild channel that was found in the cache or |
ChannelType #
Bases: int
, Enum
The known channel types that are exposed to us by the API.
GUILD_CATEGORY class-attribute
instance-attribute
#
GUILD_CATEGORY = 4
An category used for organizing channels in a guild.
GUILD_FORUM class-attribute
instance-attribute
#
GUILD_FORUM = 15
A channel consisting of a collection of public guild threads.
GUILD_NEWS class-attribute
instance-attribute
#
GUILD_NEWS = 5
A channel that can be followed and can crosspost.
GUILD_NEWS_THREAD class-attribute
instance-attribute
#
GUILD_NEWS_THREAD = 10
A temporary sub-channel within a hikari.channels.ChannelType.GUILD_NEWS
channel.
GUILD_PRIVATE_THREAD class-attribute
instance-attribute
#
GUILD_PRIVATE_THREAD = 12
A temporary sub-channel with restricted access.
Like hikari.channels.ChannelType.GUILD_PUBLIC_THREAD
, these exist within hikari.channels.ChannelType.GUILD_TEXT
channels but can only be accessed by members who are invited to them or have hikari.permissions.Permissions.MANAGE_THREADS
permission.
GUILD_PUBLIC_THREAD class-attribute
instance-attribute
#
GUILD_PUBLIC_THREAD = 11
A temporary sub-channel within a hikari.channels.ChannelType.GUILD_TEXT
channel.
GUILD_STAGE class-attribute
instance-attribute
#
GUILD_STAGE = 13
A few to many voice channel for hosting events.
DMChannel #
Bases: PrivateChannel
, TextableChannel
Represents a direct message text channel that is between you and another user.
ForumLayoutType #
ForumSortOrderType #
ForumTag #
Bases: Unique
Represents a forum tag.
id class-attribute
instance-attribute
#
The ID of the tag.
When creating tags, this will be 0
.
moderated class-attribute
instance-attribute
#
The whether this flag can only be applied by moderators.
Moderators are those with hikari.permissions.Permissions.MANAGE_CHANNELS
or hikari.permissions.Permissions.ADMINISTRATOR
permissions.
name class-attribute
instance-attribute
#
The name of the tag.
GroupDMChannel #
Bases: PrivateChannel
Represents a group direct message channel.
Note
This doesn't have the methods found on hikari.channels.TextableChannel
as bots cannot interact with a group DM that they own by sending or seeing messages in it.
application_id class-attribute
instance-attribute
#
The ID of the application that created the group DM.
If the group DM was not created by a bot, this will be None
.
icon_hash class-attribute
instance-attribute
#
The CDN hash of the icon of the group, if an icon is set.
nicknames class-attribute
instance-attribute
#
nicknames: MutableMapping[Snowflake, str] = field(eq=False, hash=False, repr=False)
A mapping of set nicknames within this group DMs to user IDs.
owner_id class-attribute
instance-attribute
#
The ID of the owner of the group.
recipients class-attribute
instance-attribute
#
The recipients of the group DM.
make_icon_url #
Generate the icon for this group, if set.
PARAMETER | DESCRIPTION |
---|---|
ext | The extension to use for this URL. Supports TYPE: |
size | The size to set for the URL. Can be any power of two between TYPE: |
RETURNS | DESCRIPTION |
---|---|
Optional[URL] | The URL, or |
RAISES | DESCRIPTION |
---|---|
ValueError | If |
GuildCategory #
Bases: PermissibleGuildChannel
Represents a guild category channel.
These can contain other channels inside, and act as a method for organisation.
GuildChannel #
Bases: PartialChannel
The base for anything that is a guild channel.
guild_id class-attribute
instance-attribute
#
The ID of the guild the channel belongs to.
parent_id class-attribute
instance-attribute
#
The ID of the parent channel the channel belongs to.
For thread channels this will refer to the parent textable guild channel. For other guild channel types this will refer to the parent category and if no parent category is set for the channel, this will be None
. For guild categories this will always be None
.
shard_id property
#
Return the shard ID for the shard.
This may be None
if the shard count is not known.
edit async
#
edit(*, name: UndefinedOr[str] = undefined.UNDEFINED, position: UndefinedOr[int] = undefined.UNDEFINED, topic: UndefinedOr[str] = undefined.UNDEFINED, nsfw: UndefinedOr[bool] = undefined.UNDEFINED, bitrate: UndefinedOr[int] = undefined.UNDEFINED, video_quality_mode: UndefinedOr[Union[VideoQualityMode, int]] = undefined.UNDEFINED, user_limit: UndefinedOr[int] = undefined.UNDEFINED, rate_limit_per_user: UndefinedOr[Intervalish] = undefined.UNDEFINED, region: UndefinedOr[Union[VoiceRegion, str]] = undefined.UNDEFINED, permission_overwrites: UndefinedOr[Sequence[PermissionOverwrite]] = undefined.UNDEFINED, parent_category: UndefinedOr[SnowflakeishOr[GuildCategory]] = undefined.UNDEFINED, default_auto_archive_duration: UndefinedOr[Intervalish] = undefined.UNDEFINED, flags: UndefinedOr[ChannelFlag] = undefined.UNDEFINED, archived: UndefinedOr[bool] = undefined.UNDEFINED, auto_archive_duration: UndefinedOr[Intervalish] = undefined.UNDEFINED, locked: UndefinedOr[bool] = undefined.UNDEFINED, invitable: UndefinedOr[bool] = undefined.UNDEFINED, applied_tags: UndefinedOr[SnowflakeishSequence[ForumTag]] = undefined.UNDEFINED, reason: UndefinedOr[str] = undefined.UNDEFINED) -> PartialChannel
Edit the text channel.
PARAMETER | DESCRIPTION |
---|---|
name | If provided, the new name for the channel. TYPE: |
position | If provided, the new position for the channel. TYPE: |
topic | If provided, the new topic for the channel. TYPE: |
nsfw | If provided, whether the channel should be marked as NSFW or not. TYPE: |
bitrate | If provided, the new bitrate for the channel. TYPE: |
video_quality_mode | If provided, the new video quality mode for the channel. TYPE: |
user_limit | If provided, the new user limit in the channel. TYPE: |
rate_limit_per_user | If provided, the new rate limit per user in the channel. TYPE: |
region | If provided, the voice region to set for this channel. Passing TYPE: |
permission_overwrites | If provided, the new permission overwrites for the channel. TYPE: |
parent_category | If provided, the new guild category for the channel. TYPE: |
default_auto_archive_duration | If provided, the auto archive duration Discord's end user client should default to when creating threads in this channel. This should be either 60, 1440, 4320 or 10080 minutes, as of writing. TYPE: |
flags | If provided, the new channel flags to use for the channel. This can only be used on a forum channel to apply ChannelFlag.REQUIRE_TAG, or on a forum thread to apply ChannelFlag.PINNED. TYPE: |
archived | If provided, the new archived state for the thread. This only applies to threads. TYPE: |
auto_archive_duration | If provided, the new auto archive duration for this thread. This only applies to threads. This should be either 60, 1440, 4320 or 10080 minutes, as of writing. TYPE: |
locked | If provided, the new locked state for the thread. This only applies to threads. If it's locked then only people with TYPE: |
invitable | If provided, the new setting for whether non-moderators can invite new members to a private thread. This only applies to threads. TYPE: |
applied_tags | If provided, the new tags to apply to the thread. This only applies to threads in a forum channel. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
RETURNS | DESCRIPTION |
---|---|
PartialChannel | The edited channel. |
RAISES | DESCRIPTION |
---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing permissions to edit the channel. |
NotFoundError | If the channel is not found. |
RateLimitTooLongError | Raised in the event that a rate limit occurs that is longer than |
InternalServerError | If an internal error occurs on Discord while handling the request. |
fetch_guild async
#
fetch_guild() -> PartialGuild
Fetch the guild linked to this channel.
RETURNS | DESCRIPTION |
---|---|
RESTGuild | The requested guild. |
RAISES | DESCRIPTION |
---|---|
ForbiddenError | If you are not part of the guild. |
NotFoundError | If the guild is not found. |
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 |
InternalServerError | If an internal error occurs on Discord while handling the request. |
GuildForumChannel #
Bases: PermissibleGuildChannel
Represents a guild forum channel.
available_tags class-attribute
instance-attribute
#
The available tags to select from when creating a thread.
default_auto_archive_duration class-attribute
instance-attribute
#
The auto archive duration Discord's client defaults to for threads in this channel.
This may be be either 1 hour, 1 day, 3 days or 1 week.
default_layout class-attribute
instance-attribute
#
default_layout: ForumLayoutType = field(eq=False, hash=False, repr=False)
The default layout for the forum.
default_reaction_emoji_id class-attribute
instance-attribute
#
The ID of the default reaction emoji.
default_reaction_emoji_name class-attribute
instance-attribute
#
default_reaction_emoji_name: Union[str, UnicodeEmoji, None] = field(eq=False, hash=False, repr=False)
Name of the default reaction emoji.
Either the string name of the custom emoji, the object of the hikari.emojis.UnicodeEmoji
or None
when the relevant custom emoji's data is not available (e.g. the emoji has been deleted).
default_sort_order class-attribute
instance-attribute
#
default_sort_order: ForumSortOrderType = field(eq=False, hash=False, repr=False)
The default sort order for the forum.
default_thread_rate_limit_per_user class-attribute
instance-attribute
#
The default delay (in seconds) between a user can send a message in created threads.
If there is no rate limit, this will be 0 seconds.
Note
Any user that has permissions allowing hikari.permissions.Permissions.MANAGE_MESSAGES
, hikari.permissions.Permissions.MANAGE_CHANNELS
, hikari.permissions.Permissions.ADMINISTRATOR
will not be limited. Likewise, bots will not be affected by this rate limit.
flags class-attribute
instance-attribute
#
flags: ChannelFlag = field(eq=False, hash=False, repr=False)
The channel flags for this channel.
Note
As of writing, the only flag that can be set is hikari.channels.ChannelFlag.REQUIRE_TAG
.
last_thread_id class-attribute
instance-attribute
#
The ID of the last thread created in this channel.
Warning
This might point to an invalid or deleted message. Do not assume that this will always be valid.
rate_limit_per_user class-attribute
instance-attribute
#
The delay (in seconds) between a user can create threads in this channel.
If there is no rate limit, this will be 0 seconds.
Note
Any user that has permissions allowing hikari.permissions.Permissions.MANAGE_MESSAGES
, hikari.permissions.Permissions.MANAGE_CHANNELS
, hikari.permissions.Permissions.ADMINISTRATOR
will not be limited. Likewise, bots will not be affected by this rate limit.
GuildNewsChannel #
Bases: PermissibleGuildChannel
, TextableGuildChannel
Represents an news channel.
default_auto_archive_duration class-attribute
instance-attribute
#
The auto archive duration Discord's client defaults to for threads in this channel.
This may be be either 1 hour, 1 day, 3 days or 1 week.
last_message_id class-attribute
instance-attribute
#
The ID of the last message sent in this channel.
Warning
This might point to an invalid or deleted message. Do not assume that this will always be valid.
GuildNewsThread #
GuildPrivateThread #
Bases: GuildThreadChannel
Represents a guild private thread.
GuildPublicThread #
Bases: GuildThreadChannel
Represents a non-news guild channel public thread.
applied_tag_ids class-attribute
instance-attribute
#
The IDs of the applied tags on this thread.
This will only apply to threads created inside a forum channel.
flags class-attribute
instance-attribute
#
flags: ChannelFlag = field(eq=False, hash=False, repr=False)
The channel flags for this thread.
This will only apply to threads created inside a forum channel.
Note
As of writing, the only flag that can be set is hikari.channels.ChannelFlag.PINNED
.
GuildStageChannel #
Bases: PermissibleGuildChannel
, TextableGuildChannel
Represents a stage channel.
bitrate class-attribute
instance-attribute
#
The bitrate for the stage channel (in bits per second).
last_message_id class-attribute
instance-attribute
#
The ID of the last message sent in this channel.
Warning
This might point to an invalid or deleted message. Do not assume that this will always be valid.
region class-attribute
instance-attribute
#
ID of the voice region for this stage channel.
If set to None
then this is set to "auto" mode where the used region will be decided based on the first person who connects to it when it's empty.
user_limit class-attribute
instance-attribute
#
The user limit for the stage channel.
If this is 0
, then assume no limit.
video_quality_mode class-attribute
instance-attribute
#
video_quality_mode: Union[VideoQualityMode, int] = field(eq=False, hash=False, repr=False)
The video quality mode for this channel.
GuildTextChannel #
Bases: PermissibleGuildChannel
, TextableGuildChannel
Represents a guild text channel.
default_auto_archive_duration class-attribute
instance-attribute
#
The auto archive duration Discord's client defaults to for threads in this channel.
This may be be either 1 hour, 1 day, 3 days or 1 week.
last_message_id class-attribute
instance-attribute
#
The ID of the last message sent in this channel.
Warning
This might point to an invalid or deleted message. Do not assume that this will always be valid.
last_pin_timestamp class-attribute
instance-attribute
#
The timestamp of the last-pinned message.
Note
This may be None
in several cases; Discord does not document what these cases are. Trust no one!
rate_limit_per_user class-attribute
instance-attribute
#
The delay (in seconds) between a user can send a message to this channel.
If there is no rate limit, this will be 0 seconds.
Note
Any user that has permissions allowing hikari.permissions.Permissions.MANAGE_MESSAGES
, hikari.permissions.Permissions.MANAGE_CHANNELS
, hikari.permissions.Permissions.ADMINISTRATOR
will not be limited. Likewise, bots will not be affected by this rate limit.
GuildThreadChannel #
Bases: TextableGuildChannel
Base class for all guild thread channels.
approximate_member_count class-attribute
instance-attribute
#
Approximate count of members in the thread channel.
Warning
This stop counting at 50.
approximate_message_count class-attribute
instance-attribute
#
Approximate number of messages in the thread channel.
Warning
This stops counting at 50 for threads created before 2022/06/01.
archive_timestamp class-attribute
instance-attribute
#
When the thread's archived state was last changed.
Note
If the thread has never been archived then this will be the thread's creation date and this will be changed when a thread is unarchived.
auto_archive_duration class-attribute
instance-attribute
#
How long the thread will be left inactive before being automatically archived.
As of writing this may either 1 hour, 1 day, 3 days or 1 week.
is_archived class-attribute
instance-attribute
#
Whether the thread is archived.
is_locked class-attribute
instance-attribute
#
Whether the thread is locked.
When a thread is locked, only users with hikari.permissions.Permissions.MANAGE_THREADS
permission can un-archive it.
last_message_id class-attribute
instance-attribute
#
The ID of the last message sent in this channel.
Warning
This might point to an invalid or deleted message. Do not assume that this will always be valid.
last_pin_timestamp class-attribute
instance-attribute
#
The timestamp of the last-pinned message.
Note
This may be None
in several cases; Discord does not document what these cases are. Trust no one!
member class-attribute
instance-attribute
#
member: Optional[ThreadMember] = field(eq=False, hash=False, repr=True)
Thread member object for the current user, if they are in the thread.
Note
This is only returned by some endpoints and on private thread access events.
owner_id class-attribute
instance-attribute
#
ID of the user who created this thread.
parent_id class-attribute
instance-attribute
#
Id of this thread's textable parent channel.
rate_limit_per_user class-attribute
instance-attribute
#
The delay (in seconds) between a user can send a message to this channel.
If there is no rate limit, this will be 0 seconds.
Note
Any user that has permissions allowing hikari.permissions.Permissions.MANAGE_MESSAGES
, hikari.permissions.Permissions.MANAGE_CHANNELS
, hikari.permissions.Permissions.ADMINISTRATOR
will not be limited. Likewise, bots will not be affected by this rate limit.
GuildVoiceChannel #
Bases: PermissibleGuildChannel
, TextableGuildChannel
Represents a voice channel.
bitrate class-attribute
instance-attribute
#
The bitrate for the voice channel (in bits per second).
last_message_id class-attribute
instance-attribute
#
The ID of the last message sent in this channel.
Warning
This might point to an invalid or deleted message. Do not assume that this will always be valid.
region class-attribute
instance-attribute
#
ID of the voice region for this voice channel.
If set to None
then this is set to "auto" mode where the used region will be decided based on the first person who connects to it when it's empty.
user_limit class-attribute
instance-attribute
#
The user limit for the voice channel.
If this is 0
, then assume no limit.
video_quality_mode class-attribute
instance-attribute
#
video_quality_mode: Union[VideoQualityMode, int] = field(eq=False, hash=False, repr=False)
The video quality mode for this channel.
PartialChannel #
Bases: Unique
Channel representation for cases where further detail is not provided.
This is commonly received in HTTP API responses where full information is not available from Discord.
app class-attribute
instance-attribute
#
Client application that models may use for procedures.
id class-attribute
instance-attribute
#
The ID of this entity.
mention property
#
mention: str
Return a raw mention string for the channel.
Note
There are platform specific inconsistencies with mentions of GuildCategories, GroupDMChannels and DMChannels showing the correct name but not being interactable.
RETURNS | DESCRIPTION |
---|---|
str | The mention string to use. |
name class-attribute
instance-attribute
#
The channel's name. This will be missing for DM channels.
type class-attribute
instance-attribute
#
type: Union[ChannelType, int] = field(eq=False, hash=False, repr=True)
The channel's type.
delete async
#
delete() -> PartialChannel
Delete a channel in a guild, or close a DM.
Note
For Public servers, the set 'Rules' or 'Guidelines' channels and the 'Public Server Updates' channel cannot be deleted.
RETURNS | DESCRIPTION |
---|---|
PartialChannel | Object of the channel that was deleted. |
RAISES | DESCRIPTION |
---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the |
NotFoundError | If the channel is not found. |
RateLimitTooLongError | Raised in the event that a rate limit occurs that is longer than |
InternalServerError | If an internal error occurs on Discord while handling the request. |
PermissibleGuildChannel #
Bases: GuildChannel
Base class for all guild channels which have permission overwrites.
Note
This doesn't apply to thread channels as they implicitly inherit permissions from their parent channel.
is_nsfw class-attribute
instance-attribute
#
Whether the channel is marked as NSFW.
permission_overwrites class-attribute
instance-attribute
#
permission_overwrites: Mapping[Snowflake, PermissionOverwrite] = field(eq=False, hash=False, repr=False)
The permission overwrites for the channel.
This maps the ID of the entity in the overwrite to the overwrite data.
position class-attribute
instance-attribute
#
The sorting position of the channel.
Higher numbers appear further down the channel list.
edit_overwrite async
#
edit_overwrite(target: Union[Snowflakeish, PartialUser, PartialRole, PermissionOverwrite], *, target_type: UndefinedOr[Union[PermissionOverwriteType, int]] = undefined.UNDEFINED, allow: UndefinedOr[Permissions] = undefined.UNDEFINED, deny: UndefinedOr[Permissions] = undefined.UNDEFINED, reason: UndefinedOr[str] = undefined.UNDEFINED) -> None
Edit permissions for a specific entity in the given guild channel.
This creates new overwrite for the channel, if there no other overwrites present.
PARAMETER | DESCRIPTION |
---|---|
target | The channel overwrite to edit. This may be the object or the ID of an existing overwrite. TYPE: |
target_type | If provided, the type of the target to update. If unset, will attempt to get the type from TYPE: |
allow | If provided, the new value of all allowed permissions. TYPE: |
deny | If provided, the new value of all disallowed permissions. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
RAISES | DESCRIPTION |
---|---|
TypeError | If |
BadRequestError | If any of the fields that are passed have an invalid value. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the |
NotFoundError | If the channel is not found or the target is not found if it is a role. |
RateLimitTooLongError | Raised in the event that a rate limit occurs that is longer than |
InternalServerError | If an internal error occurs on Discord while handling the request. |
remove_overwrite async
#
remove_overwrite(target: Union[PermissionOverwrite, PartialRole, PartialUser, Snowflakeish]) -> None
Delete a custom permission for an entity in a given guild channel.
PARAMETER | DESCRIPTION |
---|---|
target | The channel overwrite to delete. TYPE: |
RAISES | DESCRIPTION |
---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the |
NotFoundError | If the channel is not found or the target is not found. |
RateLimitTooLongError | Raised in the event that a rate limit occurs that is longer than |
InternalServerError | If an internal error occurs on Discord while handling the request. |
PermissionOverwrite #
Represents permission overwrites for a channel or role in a channel.
You may sometimes need to make instances of this object to add/edit permission overwrites on channels.
Examples:
Creating a permission overwrite.
overwrite = PermissionOverwrite(
id=163979124820541440,
type=PermissionOverwriteType.MEMBER,
allow=(
Permissions.VIEW_CHANNEL
| Permissions.READ_MESSAGE_HISTORY
| Permissions.SEND_MESSAGES
),
deny=(Permissions.MANAGE_MESSAGES | Permissions.SPEAK),
)
allow class-attribute
instance-attribute
#
allow: Permissions = field(converter=Permissions, default=NONE, repr=True)
The permissions this overwrite allows.
deny class-attribute
instance-attribute
#
deny: Permissions = field(converter=Permissions, default=NONE, repr=True)
The permissions this overwrite denies.
id class-attribute
instance-attribute
#
The ID of this entity.
type class-attribute
instance-attribute
#
type: Union[PermissionOverwriteType, int] = field(converter=PermissionOverwriteType, repr=True)
The type of entity this overwrite targets.
unset property
#
unset: Permissions
Bitfield of all permissions not explicitly allowed or denied by this overwrite.
PrivateChannel #
Bases: PartialChannel
The base for anything that is a private (non-guild bound) channel.
TextableChannel #
Bases: PartialChannel
Mixin class for a channel which can have text messages in it.
delete_messages async
#
delete_messages(messages: Union[SnowflakeishOr[PartialMessage], Iterable[SnowflakeishOr[PartialMessage]], AsyncIterable[SnowflakeishOr[PartialMessage]]], /, *other_messages: SnowflakeishOr[PartialMessage]) -> None
Bulk-delete messages from the channel.
Note
This API endpoint will only be able to delete 100 messages at a time. For anything more than this, multiple requests will be executed one-after-the-other, since the rate limits for this endpoint do not favour more than one request per bucket.
If one message is left over from chunking per 100 messages, or only one message is passed to this coroutine function, then the logic is expected to defer to delete_message
. The implication of this is that the delete_message
endpoint is ratelimited by a different bucket with different usage rates.
Warning
This endpoint is not atomic. If an error occurs midway through a bulk delete, you will not be able to revert any changes made up to this point.
Warning
Specifying any messages more than 14 days old will cause the call to fail, potentially with partial completion.
PARAMETER | DESCRIPTION |
---|---|
messages | Either the object/ID of an existing message to delete or an iterable (sync or async) of the objects and/or IDs of existing messages to delete. TYPE: |
*other_messages | The objects and/or IDs of other existing messages to delete. TYPE: |
RAISES | DESCRIPTION |
---|---|
BulkDeleteError | An error containing the messages successfully deleted, and the messages that were not removed. The |
fetch_history #
fetch_history(*, before: UndefinedOr[SearchableSnowflakeishOr[Unique]] = undefined.UNDEFINED, after: UndefinedOr[SearchableSnowflakeishOr[Unique]] = undefined.UNDEFINED, around: UndefinedOr[SearchableSnowflakeishOr[Unique]] = undefined.UNDEFINED) -> LazyIterator[Message]
Browse the message history for a given text channel.
Note
This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it, thus any errors documented below will happen then. See hikari.iterators
for the full API for this iterator type.
PARAMETER | DESCRIPTION |
---|---|
before | If provided, fetch messages before this snowflakes. If you provide a datetime object, it will be transformed into a snowflakes. This may be any other Discord entity that has an ID. In this case, the date the object was first created will be used. TYPE: |
after | If provided, fetch messages after this snowflakes. If you provide a datetime object, it will be transformed into a snowflakes. This may be any other Discord entity that has an ID. In this case, the date the object was first created will be used. TYPE: |
around | If provided, fetch messages around this snowflakes. If you provide a datetime object, it will be transformed into a snowflakes. This may be any other Discord entity that has an ID. In this case, the date the object was first created will be used. TYPE: |
RETURNS | DESCRIPTION |
---|---|
LazyIterator[Message] | A iterator to fetch the messages. |
RAISES | DESCRIPTION |
---|---|
TypeError | If you specify more than one of |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you lack permissions to read message history in the given channel. |
NotFoundError | If the channel is not found. |
InternalServerError | If an internal error occurs on Discord while handling the request. |
fetch_message async
#
fetch_message(message: SnowflakeishOr[PartialMessage]) -> Message
Fetch a specific message in the given text channel.
PARAMETER | DESCRIPTION |
---|---|
message | The message to fetch. This may be the object or the ID of an existing channel. TYPE: |
RETURNS | DESCRIPTION |
---|---|
Message | The requested message. |
RAISES | DESCRIPTION |
---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the |
NotFoundError | If the channel is not found or the message is not found in the given text channel. |
RateLimitTooLongError | Raised in the event that a rate limit occurs that is longer than |
InternalServerError | If an internal error occurs on Discord while handling the request. |
fetch_pins async
#
Fetch the pinned messages in this text channel.
RETURNS | DESCRIPTION |
---|---|
Sequence[Message] | The pinned messages in this text channel. |
RAISES | DESCRIPTION |
---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the [hikari.permissions.Permissions.VIEW_CHANNEL] permission in the channel. |
NotFoundError | If the channel is not found. |
RateLimitTooLongError | Raised in the event that a rate limit occurs that is longer than |
InternalServerError | If an internal error occurs on Discord while handling the request. |
pin_message async
#
pin_message(message: SnowflakeishOr[PartialMessage]) -> None
Pin an existing message in the text channel.
PARAMETER | DESCRIPTION |
---|---|
message | The message to pin. This may be the object or the ID of an existing message. TYPE: |
RAISES | DESCRIPTION |
---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the |
NotFoundError | If the channel is not found, or if the message does not exist in the given channel. |
RateLimitTooLongError | Raised in the event that a rate limit occurs that is longer than |
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, sticker: UndefinedOr[SnowflakeishOr[PartialSticker]] = undefined.UNDEFINED, stickers: UndefinedOr[SnowflakeishSequence[PartialSticker]] = 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
Create a message in this channel.
PARAMETER | DESCRIPTION |
---|---|
content | If provided, the message contents. If If this is a Likewise, if this is a TYPE: |
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: |
attachments | If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs. TYPE: |
component | If provided, builder object of the component to include in this message. TYPE: |
components | If provided, a sequence of the component builder objects to include in this message. TYPE: |
embed | If provided, the message embed. TYPE: |
embeds | If provided, the message embeds. TYPE: |
sticker | If provided, the object or ID of a sticker to send on the message. As of writing, bots can only send custom stickers from the current guild. TYPE: |
stickers | If provided, a sequence of the objects and IDs of up to 3 stickers to send on the message. As of writing, bots can only send custom stickers from the current guild. TYPE: |
tts | If provided, whether the message will be TTS (Text To Speech). TYPE: |
reply | If provided, the message to reply to. TYPE: |
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 TYPE: |
mentions_everyone | If provided, whether the message should parse @everyone/@here mentions. TYPE: |
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 TYPE: |
user_mentions | If provided, and TYPE: |
role_mentions | If provided, and TYPE: |
flags | If provided, optional flags to set on the message. If Note that some flags may not be able to be set. Currently the only flags that can be set are TYPE: |
RETURNS | DESCRIPTION |
---|---|
Message | The created message. |
RAISES | DESCRIPTION |
---|---|
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; |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you lack permissions to send messages in the given channel. |
NotFoundError | If the channel is not found. |
InternalServerError | If an internal error occurs on Discord while handling the request. |
ValueError | If more than 100 unique objects/entities are passed for |
TypeError | If both |
trigger_typing #
trigger_typing() -> TypingIndicator
Trigger typing in a given channel.
This returns an object that can either be awaited to trigger typing once, or used as an async context manager to keep typing until the block completes.
await channel.trigger_typing() # type for 10s
async with channel.trigger_typing():
await asyncio.sleep(35) # keep typing until this finishes
Note
Sending a message to this channel will stop the typing indicator. If using an async with
, it will start up again after a few seconds. This is a limitation of Discord's API.
RETURNS | DESCRIPTION |
---|---|
TypingIndicator | The typing indicator object. |
unpin_message async
#
unpin_message(message: SnowflakeishOr[PartialMessage]) -> None
Unpin a given message from the text channel.
PARAMETER | DESCRIPTION |
---|---|
message | The message to unpin. This may be the object or the ID of an existing message. TYPE: |
RAISES | DESCRIPTION |
---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the |
NotFoundError | If the channel is not found or the message is not a pinned message in the given channel. |
RateLimitTooLongError | Raised in the event that a rate limit occurs that is longer than |
InternalServerError | If an internal error occurs on Discord while handling the request. |
TextableGuildChannel #
Bases: GuildChannel
, TextableChannel
Mixin class for any guild channel which can have text messages in it.
ThreadMember #
Represents a thread's member.
flags class-attribute
instance-attribute
#
Bitfield flag of the user's settings for the thread.
Note
As of writing, the values of this field's are undocumented.
joined_at class-attribute
instance-attribute
#
When the user joined the relevant thread.
thread_id class-attribute
instance-attribute
#
ID of the thread this member is in.