hikari.voices
Application and entities that are used to describe voice state on Discord.
View Source
# -*- coding: utf-8 -*- # cython: language_level=3 # Copyright (c) 2020 Nekokatt # Copyright (c) 2021-present davfsa # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Application and entities that are used to describe voice state on Discord.""" from __future__ import annotations __all__: typing.Sequence[str] = ("VoiceRegion", "VoiceState") import typing import attr from hikari.internal import attr_extensions if typing.TYPE_CHECKING: import datetime from hikari import guilds from hikari import snowflakes from hikari import traits @attr_extensions.with_copy @attr.define(hash=True, kw_only=True, weakref_slot=False) class VoiceState: """Represents a user's voice connection status.""" app: traits.RESTAware = attr.field( repr=False, eq=False, hash=False, metadata={attr_extensions.SKIP_DEEP_COPY: True} ) """The client application that models may use for procedures.""" channel_id: typing.Optional[snowflakes.Snowflake] = attr.field(eq=False, hash=False, repr=True) """The ID of the channel this user is connected to. This will be `None` if they are leaving voice. """ guild_id: snowflakes.Snowflake = attr.field(eq=False, hash=False, repr=True) """The ID of the guild this voice state is in.""" is_guild_deafened: bool = attr.field(eq=False, hash=False, repr=False) """Whether this user is deafened by the guild.""" is_guild_muted: bool = attr.field(eq=False, hash=False, repr=False) """Whether this user is muted by the guild.""" is_self_deafened: bool = attr.field(eq=False, hash=False, repr=False) """Whether this user is deafened by their client.""" is_self_muted: bool = attr.field(eq=False, hash=False, repr=False) """Whether this user is muted by their client.""" is_streaming: bool = attr.field(eq=False, hash=False, repr=False) """Whether this user is streaming using "Go Live".""" is_suppressed: bool = attr.field(eq=False, hash=False, repr=False) """Whether this user is considered to be "suppressed" in a voice context. In the context of a voice channel this may mean that the user is muted by the current user and in the context of a stage channel this means that the user is not a speaker.""" is_video_enabled: bool = attr.field(eq=False, hash=False, repr=False) """Whether this user's camera is enabled.""" user_id: snowflakes.Snowflake = attr.field(eq=False, hash=False, repr=True) """The ID of the user this voice state is for.""" member: guilds.Member = attr.field(eq=False, hash=False, repr=False) """The guild member this voice state is for.""" session_id: str = attr.field(hash=True, repr=True) """The string ID of this voice state's session.""" requested_to_speak_at: typing.Optional[datetime.datetime] = attr.field(eq=False, hash=False, repr=True) """When the user requested to speak in a stage channel. Will be `None` if they have not requested to speak. """ @attr_extensions.with_copy @attr.define(hash=True, kw_only=True, weakref_slot=False) class VoiceRegion: """Represents a voice region server.""" id: str = attr.field(hash=True, repr=True) """The string ID of this region. .. note:: Unlike most parts of this API, this ID will always be a string type. This is intentional. """ name: str = attr.field(eq=False, hash=False, repr=True) """The name of this region.""" is_optimal_location: bool = attr.field(eq=False, hash=False, repr=False) """Whether this region's server is closest to the current user's client.""" is_deprecated: bool = attr.field(eq=False, hash=False, repr=False) """Whether this region is deprecated.""" is_custom: bool = attr.field(eq=False, hash=False, repr=False) """Whether this region is custom (e.g. used for events).""" def __str__(self) -> str: return self.id
View Source
@attr_extensions.with_copy @attr.define(hash=True, kw_only=True, weakref_slot=False) class VoiceRegion: """Represents a voice region server.""" id: str = attr.field(hash=True, repr=True) """The string ID of this region. .. note:: Unlike most parts of this API, this ID will always be a string type. This is intentional. """ name: str = attr.field(eq=False, hash=False, repr=True) """The name of this region.""" is_optimal_location: bool = attr.field(eq=False, hash=False, repr=False) """Whether this region's server is closest to the current user's client.""" is_deprecated: bool = attr.field(eq=False, hash=False, repr=False) """Whether this region is deprecated.""" is_custom: bool = attr.field(eq=False, hash=False, repr=False) """Whether this region is custom (e.g. used for events).""" def __str__(self) -> str: return self.id
Represents a voice region server.
Variables and properties
The string ID of this region.
Note: Unlike most parts of this API, this ID will always be a string type. This is intentional.
Whether this region is custom (e.g. used for events).
Whether this region is deprecated.
Whether this region's server is closest to the current user's client.
The name of this region.
Methods
self,
*,
id: str,
name: str,
is_optimal_location: bool,
is_deprecated: bool,
is_custom: bool
):
View Source
def __init__(self, *, id, name, is_optimal_location, is_deprecated, is_custom): self.id = id self.name = name self.is_optimal_location = is_optimal_location self.is_deprecated = is_deprecated self.is_custom = is_custom
Method generated by attrs for class VoiceRegion.
View Source
@attr_extensions.with_copy @attr.define(hash=True, kw_only=True, weakref_slot=False) class VoiceState: """Represents a user's voice connection status.""" app: traits.RESTAware = attr.field( repr=False, eq=False, hash=False, metadata={attr_extensions.SKIP_DEEP_COPY: True} ) """The client application that models may use for procedures.""" channel_id: typing.Optional[snowflakes.Snowflake] = attr.field(eq=False, hash=False, repr=True) """The ID of the channel this user is connected to. This will be `None` if they are leaving voice. """ guild_id: snowflakes.Snowflake = attr.field(eq=False, hash=False, repr=True) """The ID of the guild this voice state is in.""" is_guild_deafened: bool = attr.field(eq=False, hash=False, repr=False) """Whether this user is deafened by the guild.""" is_guild_muted: bool = attr.field(eq=False, hash=False, repr=False) """Whether this user is muted by the guild.""" is_self_deafened: bool = attr.field(eq=False, hash=False, repr=False) """Whether this user is deafened by their client.""" is_self_muted: bool = attr.field(eq=False, hash=False, repr=False) """Whether this user is muted by their client.""" is_streaming: bool = attr.field(eq=False, hash=False, repr=False) """Whether this user is streaming using "Go Live".""" is_suppressed: bool = attr.field(eq=False, hash=False, repr=False) """Whether this user is considered to be "suppressed" in a voice context. In the context of a voice channel this may mean that the user is muted by the current user and in the context of a stage channel this means that the user is not a speaker.""" is_video_enabled: bool = attr.field(eq=False, hash=False, repr=False) """Whether this user's camera is enabled.""" user_id: snowflakes.Snowflake = attr.field(eq=False, hash=False, repr=True) """The ID of the user this voice state is for.""" member: guilds.Member = attr.field(eq=False, hash=False, repr=False) """The guild member this voice state is for.""" session_id: str = attr.field(hash=True, repr=True) """The string ID of this voice state's session.""" requested_to_speak_at: typing.Optional[datetime.datetime] = attr.field(eq=False, hash=False, repr=True) """When the user requested to speak in a stage channel. Will be `None` if they have not requested to speak. """
Represents a user's voice connection status.
Variables and properties
The client application that models may use for procedures.
The ID of the channel this user is connected to.
This will be None
if they are leaving voice.
The ID of the guild this voice state is in.
Whether this user is deafened by the guild.
Whether this user is muted by the guild.
Whether this user is deafened by their client.
Whether this user is muted by their client.
Whether this user is streaming using "Go Live".
Whether this user is considered to be "suppressed" in a voice context.
In the context of a voice channel this may mean that the user is muted by the current user and in the context of a stage channel this means that the user is not a speaker.
Whether this user's camera is enabled.
The guild member this voice state is for.
When the user requested to speak in a stage channel.
Will be None
if they have not requested to speak.
The string ID of this voice state's session.
The ID of the user this voice state is for.
Methods
self,
*,
app: hikari.traits.RESTAware,
channel_id: Optional[hikari.snowflakes.Snowflake],
guild_id: hikari.snowflakes.Snowflake,
is_guild_deafened: bool,
is_guild_muted: bool,
is_self_deafened: bool,
is_self_muted: bool,
is_streaming: bool,
is_suppressed: bool,
is_video_enabled: bool,
user_id: hikari.snowflakes.Snowflake,
member: hikari.guilds.Member,
session_id: str,
requested_to_speak_at: Optional[datetime.datetime]
):
View Source
def __init__(self, *, app, channel_id, guild_id, is_guild_deafened, is_guild_muted, is_self_deafened, is_self_muted, is_streaming, is_suppressed, is_video_enabled, user_id, member, session_id, requested_to_speak_at): self.app = app self.channel_id = channel_id self.guild_id = guild_id self.is_guild_deafened = is_guild_deafened self.is_guild_muted = is_guild_muted self.is_self_deafened = is_self_deafened self.is_self_muted = is_self_muted self.is_streaming = is_streaming self.is_suppressed = is_suppressed self.is_video_enabled = is_video_enabled self.user_id = user_id self.member = member self.session_id = session_id self.requested_to_speak_at = requested_to_speak_at
Method generated by attrs for class VoiceState.