hikari.scheduled_events
Application and entities that are used to describe guild scheduled events 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 guild scheduled events on Discord.""" from __future__ import annotations __all__: typing.Sequence[str] = ( "EventPrivacyLevel", "ScheduledEventType", "ScheduledEventStatus", "ScheduledEvent", "ScheduledExternalEvent", "ScheduledStageEvent", "ScheduledVoiceEvent", "ScheduledEventUser", ) import typing import attr from hikari import snowflakes from hikari import urls from hikari.internal import attr_extensions from hikari.internal import enums from hikari.internal import routes if typing.TYPE_CHECKING: import datetime from hikari import files from hikari import guilds from hikari import traits from hikari import users class EventPrivacyLevel(int, enums.Enum): """Enum of the possible scheduled event privacy levels.""" GUILD_ONLY = 2 """The scheduled event is only available to guild members.""" class ScheduledEventType(int, enums.Enum): """Enum of the scheduled event types.""" STAGE_INSTANCE = 1 """A scheduled stage instance.""" VOICE = 2 """A scheculed voice chat event.""" EXTERNAL = 3 """A scheduled event which takes part outside of Discord.""" class ScheduledEventStatus(int, enums.Enum): """Enum of the scheduled event statuses.""" SCHEDULED = 1 """Indicates that the scheduled event hasn't occurred yet.""" ACTIVE = 2 """Indicates an eventis on-going.""" COMPLETED = 3 """Indicates an event has finished.""" CANCELED = 4 """Indicates an event has been canceled.""" CANCELLED = CANCELED """Alias of `ScheduledEventStatus.CANCELED`.""" @attr_extensions.with_copy @attr.define(hash=True, kw_only=True, weakref_slot=False) class ScheduledEvent(snowflakes.Unique): """Base class for scheduled events.""" # entity_id is ignored right now due to always being null # creator_id is ignored as it just dupes creator.id 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.""" id: snowflakes.Snowflake = attr.field(hash=True, repr=True) """ID of the scheduled event.""" guild_id: snowflakes.Snowflake = attr.field(hash=False, repr=True) """ID of the guild this scheduled event belongs to.""" name: str = attr.field(hash=False, repr=True) """Name of the scheduled event.""" description: typing.Optional[str] = attr.field(hash=False, repr=False) """Description of the scheduled event.""" start_time: datetime.datetime = attr.field(hash=False, repr=False) """When the event is scheduled to start.""" end_time: typing.Optional[datetime.datetime] = attr.field(hash=False, repr=False) """When the event is scheduled to end, if set.""" privacy_level: EventPrivacyLevel = attr.field(hash=False, repr=False) """Privacy level of the scheduled event. This restricts who can view and join the scheduled event. """ status: ScheduledEventStatus = attr.field(hash=False, repr=True) """Status of the scheduled event.""" entity_type: ScheduledEventType = attr.field(hash=False, repr=True) """The type of entity this scheduled event is associated with.""" creator: typing.Optional[users.User] = attr.field(hash=False, repr=False) """The user who created the scheduled event. This will only be set for event created after 2021-10-25. """ user_count: typing.Optional[int] = attr.field(hash=False, repr=False) """The number of users that have subscribed to the event. This will be `None` on gateway events when creating and editing a scheduled event. """ image_hash: typing.Optional[str] = attr.field(hash=False, repr=False) """Hash of the image used for the scheduled event, if set.""" @property def image_url(self) -> typing.Optional[files.URL]: """Cover image for this scheduled event, if set.""" return self.make_image_url() def make_image_url(self, *, ext: str = "png", size: int = 4096) -> typing.Optional[files.URL]: """Generate the cover image for this scheduled event, if set. Parameters ---------- ext : str The extension to use for this URL, defaults to `png`. Supports `png`, `jpeg`, `jpg` and `webp`. size : int The size to set for the URL, defaults to `4096`. Can be any power of two between 16 and 4096. Returns ------- typing.Optional[hikari.files.URL] The URL, or `None` if no cover image is set. Raises ------ ValueError If `size` is not a power of two between 16 and 4096 (inclusive). """ if self.image_hash is None: return None return routes.SCHEDULED_EVENT_COVER.compile_to_file( urls.CDN_URL, scheduled_event_id=self.id, hash=self.image_hash, size=size, file_format=ext, ) @attr_extensions.with_copy @attr.define(hash=True, kw_only=True, weakref_slot=False) class ScheduledExternalEvent(ScheduledEvent): """A scheduled event that takes place outside of Discord.""" location: str = attr.field(hash=False, repr=False) """The location of the scheduled event. .. note:: There is no strict format for this field, and it will likely be a user friendly string. """ end_time: datetime.datetime = attr.field(hash=False, repr=False) """When the event is scheduled to end.""" @attr_extensions.with_copy @attr.define(hash=True, kw_only=True, weakref_slot=False) class ScheduledStageEvent(ScheduledEvent): """A scheduled event that takes place in a stage channel.""" channel_id: snowflakes.Snowflake = attr.field(hash=False, repr=False) """ID of the stage channel this event is scheduled in.""" @attr_extensions.with_copy @attr.define(hash=True, kw_only=True, weakref_slot=False) class ScheduledVoiceEvent(ScheduledEvent): """A scheduled event that takes place in a voice channel.""" channel_id: snowflakes.Snowflake = attr.field(hash=False, repr=False) """ID of the voice channel this scheduled event is in.""" @attr_extensions.with_copy @attr.define(kw_only=True, weakref_slot=False) class ScheduledEventUser: """A user who is subscribed to a scheduled event.""" event_id: snowflakes.Snowflake = attr.field(hash=False, repr=True) """ID of the scheduled event they're subscribed to.""" user: users.User = attr.field(hash=True, repr=True) """Object representing the user.""" member: typing.Optional[guilds.Member] = attr.field(hash=False, repr=False) """Their guild member object if they're in the event's guild."""
View Source
class EventPrivacyLevel(int, enums.Enum): """Enum of the possible scheduled event privacy levels.""" GUILD_ONLY = 2 """The scheduled event is only available to guild members."""
Enum of the possible scheduled event privacy levels.
Variables and properties
The scheduled event is only available to guild members.
the denominator of a rational number in lowest terms
the imaginary part of a complex number
Return the name of the enum member as a str
.
the numerator of a rational number in lowest terms
the real part of a complex number
Return the value of the enum member.
Methods
View Source
def __call__(cls, value: typing.Any) -> typing.Any: """Cast a value to the enum, returning the raw value that was passed if value not found.""" try: return cls._value_to_member_map_[value] except KeyError: # If we can't find the value, just return what got casted in return value
Cast a value to the enum, returning the raw value that was passed if value not found.
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
Number of bits necessary to represent self in binary.
>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
Returns self, the complex conjugate of any int.
Return the integer represented by the given array of bytes.
bytes Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol. byteorder The byte order used to represent the integer. If byteorder is 'big', the most significant byte is at the beginning of the byte array. If byteorder is 'little', the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder' as the byte order value. signed Indicates whether two's complement is used to represent the integer.
Return an array of bytes representing an integer.
length Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. byteorder The byte order used to represent the integer. If byteorder is 'big', the most significant byte is at the beginning of the byte array. If byteorder is 'little', the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder' as the byte order value. signed Determines whether two's complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
View Source
@attr_extensions.with_copy @attr.define(hash=True, kw_only=True, weakref_slot=False) class ScheduledEvent(snowflakes.Unique): """Base class for scheduled events.""" # entity_id is ignored right now due to always being null # creator_id is ignored as it just dupes creator.id 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.""" id: snowflakes.Snowflake = attr.field(hash=True, repr=True) """ID of the scheduled event.""" guild_id: snowflakes.Snowflake = attr.field(hash=False, repr=True) """ID of the guild this scheduled event belongs to.""" name: str = attr.field(hash=False, repr=True) """Name of the scheduled event.""" description: typing.Optional[str] = attr.field(hash=False, repr=False) """Description of the scheduled event.""" start_time: datetime.datetime = attr.field(hash=False, repr=False) """When the event is scheduled to start.""" end_time: typing.Optional[datetime.datetime] = attr.field(hash=False, repr=False) """When the event is scheduled to end, if set.""" privacy_level: EventPrivacyLevel = attr.field(hash=False, repr=False) """Privacy level of the scheduled event. This restricts who can view and join the scheduled event. """ status: ScheduledEventStatus = attr.field(hash=False, repr=True) """Status of the scheduled event.""" entity_type: ScheduledEventType = attr.field(hash=False, repr=True) """The type of entity this scheduled event is associated with.""" creator: typing.Optional[users.User] = attr.field(hash=False, repr=False) """The user who created the scheduled event. This will only be set for event created after 2021-10-25. """ user_count: typing.Optional[int] = attr.field(hash=False, repr=False) """The number of users that have subscribed to the event. This will be `None` on gateway events when creating and editing a scheduled event. """ image_hash: typing.Optional[str] = attr.field(hash=False, repr=False) """Hash of the image used for the scheduled event, if set.""" @property def image_url(self) -> typing.Optional[files.URL]: """Cover image for this scheduled event, if set.""" return self.make_image_url() def make_image_url(self, *, ext: str = "png", size: int = 4096) -> typing.Optional[files.URL]: """Generate the cover image for this scheduled event, if set. Parameters ---------- ext : str The extension to use for this URL, defaults to `png`. Supports `png`, `jpeg`, `jpg` and `webp`. size : int The size to set for the URL, defaults to `4096`. Can be any power of two between 16 and 4096. Returns ------- typing.Optional[hikari.files.URL] The URL, or `None` if no cover image is set. Raises ------ ValueError If `size` is not a power of two between 16 and 4096 (inclusive). """ if self.image_hash is None: return None return routes.SCHEDULED_EVENT_COVER.compile_to_file( urls.CDN_URL, scheduled_event_id=self.id, hash=self.image_hash, size=size, file_format=ext, )
Base class for scheduled events.
Variables and properties
The client application that models may use for procedures.
When the object was created.
The user who created the scheduled event.
This will only be set for event created after 2021-10-25.
Description of the scheduled event.
When the event is scheduled to end, if set.
The type of entity this scheduled event is associated with.
ID of the guild this scheduled event belongs to.
ID of the scheduled event.
Hash of the image used for the scheduled event, if set.
Cover image for this scheduled event, if set.
Name of the scheduled event.
Privacy level of the scheduled event.
This restricts who can view and join the scheduled event.
When the event is scheduled to start.
Status of the scheduled event.
The number of users that have subscribed to the event.
This will be None
on gateway events when creating and editing a scheduled event.
Methods
self,
*,
app: hikari.traits.RESTAware,
id: hikari.snowflakes.Snowflake,
guild_id: hikari.snowflakes.Snowflake,
name: str,
description: Optional[str],
start_time: datetime.datetime,
end_time: Optional[datetime.datetime],
privacy_level: hikari.scheduled_events.EventPrivacyLevel,
status: hikari.scheduled_events.ScheduledEventStatus,
entity_type: hikari.scheduled_events.ScheduledEventType,
creator: Optional[hikari.users.User],
user_count: Optional[int],
image_hash: Optional[str]
):
View Source
def __init__(self, *, app, id, guild_id, name, description, start_time, end_time, privacy_level, status, entity_type, creator, user_count, image_hash): self.app = app self.id = id self.guild_id = guild_id self.name = name self.description = description self.start_time = start_time self.end_time = end_time self.privacy_level = privacy_level self.status = status self.entity_type = entity_type self.creator = creator self.user_count = user_count self.image_hash = image_hash
Method generated by attrs for class ScheduledEvent.
View Source
def make_image_url(self, *, ext: str = "png", size: int = 4096) -> typing.Optional[files.URL]: """Generate the cover image for this scheduled event, if set. Parameters ---------- ext : str The extension to use for this URL, defaults to `png`. Supports `png`, `jpeg`, `jpg` and `webp`. size : int The size to set for the URL, defaults to `4096`. Can be any power of two between 16 and 4096. Returns ------- typing.Optional[hikari.files.URL] The URL, or `None` if no cover image is set. Raises ------ ValueError If `size` is not a power of two between 16 and 4096 (inclusive). """ if self.image_hash is None: return None return routes.SCHEDULED_EVENT_COVER.compile_to_file( urls.CDN_URL, scheduled_event_id=self.id, hash=self.image_hash, size=size, file_format=ext, )
Generate the cover image for this scheduled event, if set.
Parameters
- ext (str): The extension to use for this URL, defaults to
png
. Supportspng
,jpeg
,jpg
andwebp
. - size (int): The size to set for the URL, defaults to
4096
. Can be any power of two between 16 and 4096.
Returns
- typing.Optional[hikari.files.URL]: The URL, or
None
if no cover image is set.
Raises
- ValueError: If
size
is not a power of two between 16 and 4096 (inclusive).
View Source
class ScheduledEventStatus(int, enums.Enum): """Enum of the scheduled event statuses.""" SCHEDULED = 1 """Indicates that the scheduled event hasn't occurred yet.""" ACTIVE = 2 """Indicates an eventis on-going.""" COMPLETED = 3 """Indicates an event has finished.""" CANCELED = 4 """Indicates an event has been canceled.""" CANCELLED = CANCELED """Alias of `ScheduledEventStatus.CANCELED`."""
Enum of the scheduled event statuses.
Variables and properties
Indicates an eventis on-going.
Indicates an event has been canceled.
Alias of ScheduledEventStatus.CANCELED
.
Indicates an event has finished.
Indicates that the scheduled event hasn't occurred yet.
the denominator of a rational number in lowest terms
the imaginary part of a complex number
Return the name of the enum member as a str
.
the numerator of a rational number in lowest terms
the real part of a complex number
Return the value of the enum member.
Methods
View Source
def __call__(cls, value: typing.Any) -> typing.Any: """Cast a value to the enum, returning the raw value that was passed if value not found.""" try: return cls._value_to_member_map_[value] except KeyError: # If we can't find the value, just return what got casted in return value
Cast a value to the enum, returning the raw value that was passed if value not found.
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
Number of bits necessary to represent self in binary.
>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
Returns self, the complex conjugate of any int.
Return the integer represented by the given array of bytes.
bytes Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol. byteorder The byte order used to represent the integer. If byteorder is 'big', the most significant byte is at the beginning of the byte array. If byteorder is 'little', the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder' as the byte order value. signed Indicates whether two's complement is used to represent the integer.
Return an array of bytes representing an integer.
length Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. byteorder The byte order used to represent the integer. If byteorder is 'big', the most significant byte is at the beginning of the byte array. If byteorder is 'little', the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder' as the byte order value. signed Determines whether two's complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
View Source
class ScheduledEventType(int, enums.Enum): """Enum of the scheduled event types.""" STAGE_INSTANCE = 1 """A scheduled stage instance.""" VOICE = 2 """A scheculed voice chat event.""" EXTERNAL = 3 """A scheduled event which takes part outside of Discord."""
Enum of the scheduled event types.
Variables and properties
A scheduled event which takes part outside of Discord.
A scheduled stage instance.
A scheculed voice chat event.
the denominator of a rational number in lowest terms
the imaginary part of a complex number
Return the name of the enum member as a str
.
the numerator of a rational number in lowest terms
the real part of a complex number
Return the value of the enum member.
Methods
View Source
def __call__(cls, value: typing.Any) -> typing.Any: """Cast a value to the enum, returning the raw value that was passed if value not found.""" try: return cls._value_to_member_map_[value] except KeyError: # If we can't find the value, just return what got casted in return value
Cast a value to the enum, returning the raw value that was passed if value not found.
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
Number of bits necessary to represent self in binary.
>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
Returns self, the complex conjugate of any int.
Return the integer represented by the given array of bytes.
bytes Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol. byteorder The byte order used to represent the integer. If byteorder is 'big', the most significant byte is at the beginning of the byte array. If byteorder is 'little', the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder' as the byte order value. signed Indicates whether two's complement is used to represent the integer.
Return an array of bytes representing an integer.
length Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. byteorder The byte order used to represent the integer. If byteorder is 'big', the most significant byte is at the beginning of the byte array. If byteorder is 'little', the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder' as the byte order value. signed Determines whether two's complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
View Source
@attr_extensions.with_copy @attr.define(kw_only=True, weakref_slot=False) class ScheduledEventUser: """A user who is subscribed to a scheduled event.""" event_id: snowflakes.Snowflake = attr.field(hash=False, repr=True) """ID of the scheduled event they're subscribed to.""" user: users.User = attr.field(hash=True, repr=True) """Object representing the user.""" member: typing.Optional[guilds.Member] = attr.field(hash=False, repr=False) """Their guild member object if they're in the event's guild."""
A user who is subscribed to a scheduled event.
Variables and properties
ID of the scheduled event they're subscribed to.
Their guild member object if they're in the event's guild.
Object representing the user.
Methods
self,
*,
event_id: hikari.snowflakes.Snowflake,
user: hikari.users.User,
member: Optional[hikari.guilds.Member]
):
View Source
def __init__(self, *, event_id, user, member): self.event_id = event_id self.user = user self.member = member
Method generated by attrs for class ScheduledEventUser.
View Source
@attr_extensions.with_copy @attr.define(hash=True, kw_only=True, weakref_slot=False) class ScheduledExternalEvent(ScheduledEvent): """A scheduled event that takes place outside of Discord.""" location: str = attr.field(hash=False, repr=False) """The location of the scheduled event. .. note:: There is no strict format for this field, and it will likely be a user friendly string. """ end_time: datetime.datetime = attr.field(hash=False, repr=False) """When the event is scheduled to end."""
A scheduled event that takes place outside of Discord.
Variables and properties
The client application that models may use for procedures.
When the object was created.
The user who created the scheduled event.
This will only be set for event created after 2021-10-25.
Description of the scheduled event.
When the event is scheduled to end.
The type of entity this scheduled event is associated with.
ID of the guild this scheduled event belongs to.
ID of the scheduled event.
Hash of the image used for the scheduled event, if set.
Cover image for this scheduled event, if set.
The location of the scheduled event.
Note: There is no strict format for this field, and it will likely be a user friendly string.
Name of the scheduled event.
Privacy level of the scheduled event.
This restricts who can view and join the scheduled event.
When the event is scheduled to start.
Status of the scheduled event.
The number of users that have subscribed to the event.
This will be None
on gateway events when creating and editing a scheduled event.
Methods
self,
*,
app: hikari.traits.RESTAware,
id: hikari.snowflakes.Snowflake,
guild_id: hikari.snowflakes.Snowflake,
name: str,
description: Optional[str],
start_time: datetime.datetime,
privacy_level: hikari.scheduled_events.EventPrivacyLevel,
status: hikari.scheduled_events.ScheduledEventStatus,
entity_type: hikari.scheduled_events.ScheduledEventType,
creator: Optional[hikari.users.User],
user_count: Optional[int],
image_hash: Optional[str],
location: str,
end_time: datetime.datetime
):
View Source
def __init__(self, *, app, id, guild_id, name, description, start_time, privacy_level, status, entity_type, creator, user_count, image_hash, location, end_time): self.app = app self.id = id self.guild_id = guild_id self.name = name self.description = description self.start_time = start_time self.privacy_level = privacy_level self.status = status self.entity_type = entity_type self.creator = creator self.user_count = user_count self.image_hash = image_hash self.location = location self.end_time = end_time
Method generated by attrs for class ScheduledExternalEvent.
View Source
def make_image_url(self, *, ext: str = "png", size: int = 4096) -> typing.Optional[files.URL]: """Generate the cover image for this scheduled event, if set. Parameters ---------- ext : str The extension to use for this URL, defaults to `png`. Supports `png`, `jpeg`, `jpg` and `webp`. size : int The size to set for the URL, defaults to `4096`. Can be any power of two between 16 and 4096. Returns ------- typing.Optional[hikari.files.URL] The URL, or `None` if no cover image is set. Raises ------ ValueError If `size` is not a power of two between 16 and 4096 (inclusive). """ if self.image_hash is None: return None return routes.SCHEDULED_EVENT_COVER.compile_to_file( urls.CDN_URL, scheduled_event_id=self.id, hash=self.image_hash, size=size, file_format=ext, )
Generate the cover image for this scheduled event, if set.
Parameters
- ext (str): The extension to use for this URL, defaults to
png
. Supportspng
,jpeg
,jpg
andwebp
. - size (int): The size to set for the URL, defaults to
4096
. Can be any power of two between 16 and 4096.
Returns
- typing.Optional[hikari.files.URL]: The URL, or
None
if no cover image is set.
Raises
- ValueError: If
size
is not a power of two between 16 and 4096 (inclusive).
View Source
@attr_extensions.with_copy @attr.define(hash=True, kw_only=True, weakref_slot=False) class ScheduledStageEvent(ScheduledEvent): """A scheduled event that takes place in a stage channel.""" channel_id: snowflakes.Snowflake = attr.field(hash=False, repr=False) """ID of the stage channel this event is scheduled in."""
A scheduled event that takes place in a stage channel.
Variables and properties
The client application that models may use for procedures.
ID of the stage channel this event is scheduled in.
When the object was created.
The user who created the scheduled event.
This will only be set for event created after 2021-10-25.
Description of the scheduled event.
When the event is scheduled to end, if set.
The type of entity this scheduled event is associated with.
ID of the guild this scheduled event belongs to.
ID of the scheduled event.
Hash of the image used for the scheduled event, if set.
Cover image for this scheduled event, if set.
Name of the scheduled event.
Privacy level of the scheduled event.
This restricts who can view and join the scheduled event.
When the event is scheduled to start.
Status of the scheduled event.
The number of users that have subscribed to the event.
This will be None
on gateway events when creating and editing a scheduled event.
Methods
self,
*,
app: hikari.traits.RESTAware,
id: hikari.snowflakes.Snowflake,
guild_id: hikari.snowflakes.Snowflake,
name: str,
description: Optional[str],
start_time: datetime.datetime,
end_time: Optional[datetime.datetime],
privacy_level: hikari.scheduled_events.EventPrivacyLevel,
status: hikari.scheduled_events.ScheduledEventStatus,
entity_type: hikari.scheduled_events.ScheduledEventType,
creator: Optional[hikari.users.User],
user_count: Optional[int],
image_hash: Optional[str],
channel_id: hikari.snowflakes.Snowflake
):
View Source
def __init__(self, *, app, id, guild_id, name, description, start_time, end_time, privacy_level, status, entity_type, creator, user_count, image_hash, channel_id): self.app = app self.id = id self.guild_id = guild_id self.name = name self.description = description self.start_time = start_time self.end_time = end_time self.privacy_level = privacy_level self.status = status self.entity_type = entity_type self.creator = creator self.user_count = user_count self.image_hash = image_hash self.channel_id = channel_id
Method generated by attrs for class ScheduledStageEvent.
View Source
def make_image_url(self, *, ext: str = "png", size: int = 4096) -> typing.Optional[files.URL]: """Generate the cover image for this scheduled event, if set. Parameters ---------- ext : str The extension to use for this URL, defaults to `png`. Supports `png`, `jpeg`, `jpg` and `webp`. size : int The size to set for the URL, defaults to `4096`. Can be any power of two between 16 and 4096. Returns ------- typing.Optional[hikari.files.URL] The URL, or `None` if no cover image is set. Raises ------ ValueError If `size` is not a power of two between 16 and 4096 (inclusive). """ if self.image_hash is None: return None return routes.SCHEDULED_EVENT_COVER.compile_to_file( urls.CDN_URL, scheduled_event_id=self.id, hash=self.image_hash, size=size, file_format=ext, )
Generate the cover image for this scheduled event, if set.
Parameters
- ext (str): The extension to use for this URL, defaults to
png
. Supportspng
,jpeg
,jpg
andwebp
. - size (int): The size to set for the URL, defaults to
4096
. Can be any power of two between 16 and 4096.
Returns
- typing.Optional[hikari.files.URL]: The URL, or
None
if no cover image is set.
Raises
- ValueError: If
size
is not a power of two between 16 and 4096 (inclusive).
View Source
@attr_extensions.with_copy @attr.define(hash=True, kw_only=True, weakref_slot=False) class ScheduledVoiceEvent(ScheduledEvent): """A scheduled event that takes place in a voice channel.""" channel_id: snowflakes.Snowflake = attr.field(hash=False, repr=False) """ID of the voice channel this scheduled event is in."""
A scheduled event that takes place in a voice channel.
Variables and properties
The client application that models may use for procedures.
ID of the voice channel this scheduled event is in.
When the object was created.
The user who created the scheduled event.
This will only be set for event created after 2021-10-25.
Description of the scheduled event.
When the event is scheduled to end, if set.
The type of entity this scheduled event is associated with.
ID of the guild this scheduled event belongs to.
ID of the scheduled event.
Hash of the image used for the scheduled event, if set.
Cover image for this scheduled event, if set.
Name of the scheduled event.
Privacy level of the scheduled event.
This restricts who can view and join the scheduled event.
When the event is scheduled to start.
Status of the scheduled event.
The number of users that have subscribed to the event.
This will be None
on gateway events when creating and editing a scheduled event.
Methods
self,
*,
app: hikari.traits.RESTAware,
id: hikari.snowflakes.Snowflake,
guild_id: hikari.snowflakes.Snowflake,
name: str,
description: Optional[str],
start_time: datetime.datetime,
end_time: Optional[datetime.datetime],
privacy_level: hikari.scheduled_events.EventPrivacyLevel,
status: hikari.scheduled_events.ScheduledEventStatus,
entity_type: hikari.scheduled_events.ScheduledEventType,
creator: Optional[hikari.users.User],
user_count: Optional[int],
image_hash: Optional[str],
channel_id: hikari.snowflakes.Snowflake
):
View Source
def __init__(self, *, app, id, guild_id, name, description, start_time, end_time, privacy_level, status, entity_type, creator, user_count, image_hash, channel_id): self.app = app self.id = id self.guild_id = guild_id self.name = name self.description = description self.start_time = start_time self.end_time = end_time self.privacy_level = privacy_level self.status = status self.entity_type = entity_type self.creator = creator self.user_count = user_count self.image_hash = image_hash self.channel_id = channel_id
Method generated by attrs for class ScheduledVoiceEvent.
View Source
def make_image_url(self, *, ext: str = "png", size: int = 4096) -> typing.Optional[files.URL]: """Generate the cover image for this scheduled event, if set. Parameters ---------- ext : str The extension to use for this URL, defaults to `png`. Supports `png`, `jpeg`, `jpg` and `webp`. size : int The size to set for the URL, defaults to `4096`. Can be any power of two between 16 and 4096. Returns ------- typing.Optional[hikari.files.URL] The URL, or `None` if no cover image is set. Raises ------ ValueError If `size` is not a power of two between 16 and 4096 (inclusive). """ if self.image_hash is None: return None return routes.SCHEDULED_EVENT_COVER.compile_to_file( urls.CDN_URL, scheduled_event_id=self.id, hash=self.image_hash, size=size, file_format=ext, )
Generate the cover image for this scheduled event, if set.
Parameters
- ext (str): The extension to use for this URL, defaults to
png
. Supportspng
,jpeg
,jpg
andwebp
. - size (int): The size to set for the URL, defaults to
4096
. Can be any power of two between 16 and 4096.
Returns
- typing.Optional[hikari.files.URL]: The URL, or
None
if no cover image is set.
Raises
- ValueError: If
size
is not a power of two between 16 and 4096 (inclusive).