Guild Scheduled Events¶
This section documents everything related to Guild Scheduled Events.
Discord Models¶
GuildScheduledEventRecurrenceRule¶
- class disnake.GuildScheduledEventRecurrenceRule[source]¶
Represents the recurrence rule payload used when creating a scheduled event.
This structure defines how and when a scheduled event repeats.
Certain combinations and values are restricted by the Discord client. See the official Discord documentation on recurrence rules for detailed constraints and valid combinations.
New in version 2.11.
- frequency¶
How often the event repeats.
- interval¶
The spacing between each occurrence. For example, a value of
2
with a weekly frequency would mean “every other week”.Valid only when
frequency
isGuildScheduledEventFrequency.WEEKLY
if greater than1
.- Type:
- by_weekday¶
A list of
GuildScheduledEventWeekday
values indicating the weekdays the event repeats on.Valid only when
frequency
isGuildScheduledEventFrequency.DAILY
orGuildScheduledEventFrequency.WEEKLY
.For
DAILY
frequency: Must match one of the allowed weekday sets.For
WEEKLY
frequency: May only contain one entry.
- Type:
Optional[List[
GuildScheduledEventWeekday
]]
- by_n_weekday¶
A list of weekday-within-week combinations, such as “2nd Tuesday”.
Each item represents a specific week (1-5) and a weekday (0 = Monday, …, 6 = Sunday), indicating a recurring event like “third Friday of every month”.
Valid only when
frequency
isGuildScheduledEventFrequency.MONTHLY
.Must contain exactly one item.
- Type:
Optional[List[
GuildScheduledEventNWeekday
]]
- by_month¶
A list of month values, represented by
GuildScheduledEventMonth
.Valid only when
frequency
isGuildScheduledEventFrequency.YEARLY
.Must be used together with
by_month_day
.Must contain exactly one item.
- Type:
Optional[List[
GuildScheduledEventMonth
]]
- by_month_day¶
A list of days in the month (1-31).
Valid only when
frequency
isGuildScheduledEventFrequency.YEARLY
.Must be used together with
by_month
.Must contain exactly one item.
- Type:
Optional[List[
int
]]
GuildScheduledEvent¶
- class disnake.GuildScheduledEvent[source]¶
Represents a guild scheduled event.
New in version 2.3.
- x == y
Checks if two guild scheduled events are equal.
- x != y
Checks if two guild scheduled events are not equal.
- hash(x)
Returns the guild scheduled event’s hash.
- channel_id¶
The channel ID in which the guild scheduled event will be hosted. This field is
None
ifentity_type
isGuildScheduledEventEntityType.external
.- Type:
Optional[
int
]
- creator_id¶
The ID of the user that created the guild scheduled event. This field is
None
for events created before October 25th, 2021.- Type:
Optional[
int
]
- creator¶
The user that created the guild scheduled event. This field is
None
for events created before October 25th, 2021.- Type:
Optional[
User
]
- scheduled_start_time¶
The time when the guild scheduled event will start.
- Type:
- scheduled_end_time¶
The time when the guild scheduled event will end, or
None
if the event does not have a scheduled time to end.- Type:
Optional[
datetime.datetime
]
- privacy_level¶
The privacy level of the guild scheduled event.
- status¶
The status of the guild scheduled event.
- entity_type¶
The type of the guild scheduled event.
- entity_metadata¶
Additional metadata for the guild scheduled event.
- recurrence_rule¶
An optional recurrence rule that specifies how the event should repeat over time. This allows for recurring scheduled events such as weekly meetings or monthly check-ins.
- user_count¶
The number of users subscribed to the guild scheduled event. If the guild scheduled event was fetched with
with_user_count
set toFalse
, this field isNone
.- Type:
Optional[
int
]
- property created_at[source]¶
Returns the guild scheduled event’s creation time in UTC.
New in version 2.6.
- Type:
- channel¶
The channel in which the guild scheduled event will be hosted.
This will be
None
ifentity_type
isGuildScheduledEventEntityType.external
.- Type:
Optional[
abc.GuildChannel
]
- property image[source]¶
The cover image asset of the guild scheduled event, if available.
- Type:
Optional[
Asset
]
- await delete()[source]¶
This function is a coroutine.
Deletes the guild scheduled event.
You must have
manage_events
permission to do this.- Raises:
Forbidden – You do not have proper permissions to delete the event.
NotFound – The event does not exist.
HTTPException – Deleting the event failed.
- await edit(*, name=..., description=..., image=..., channel=..., privacy_level=..., scheduled_start_time=..., scheduled_end_time=..., entity_type=..., entity_metadata=..., status=..., reason=None)[source]¶
This function is a coroutine.
Edits the guild scheduled event.
You must have
manage_events
permission to do this.Changed in version 2.6: Updates must follow requirements of
Guild.create_scheduled_event()
Changed in version 2.6: Now raises
TypeError
instead ofValueError
for invalid parameter types.Changed in version 2.6: Removed
channel_id
parameter in favor ofchannel
.Changed in version 2.6: Naive datetime parameters are now assumed to be in the local timezone instead of UTC.
- Parameters:
name (
str
) – The name of the guild scheduled event.description (Optional[
str
]) – The description of the guild scheduled event.image (Optional[Union[
bytes
,Asset
,Emoji
,PartialEmoji
,StickerItem
,Sticker
]]) –The cover image of the guild scheduled event. Set to
None
to remove the image.New in version 2.4.
Changed in version 2.5: Now accepts various resource types in addition to
bytes
.channel (Optional[
abc.Snowflake
]) –The channel in which the guild scheduled event will be hosted. Set to
None
if changingentity_type
toGuildScheduledEventEntityType.external
.New in version 2.6.
privacy_level (
GuildScheduledEventPrivacyLevel
) – The privacy level of the guild scheduled event.scheduled_start_time (
datetime.datetime
) – The time to schedule the guild scheduled event. If the datetime is naive, it is assumed to be local time.scheduled_end_time (Optional[
datetime.datetime
]) – The time when the guild scheduled event is scheduled to end. If the datetime is naive, it is assumed to be local time.entity_type (
GuildScheduledEventEntityType
) – The entity type of the guild scheduled event.entity_metadata (Optional[
GuildScheduledEventMetadata
]) – The entity metadata of the guild scheduled event.status (
GuildScheduledEventStatus
) –The status of the guild scheduled event.
reason (Optional[
str
]) – The reason for editing the guild scheduled event. Shows up on the audit log.
- Raises:
Forbidden – You do not have proper permissions to edit the event.
NotFound – The event does not exist or the
image
asset couldn’t be found.HTTPException – Editing the event failed.
TypeError – The
image
asset is a lottie sticker (seeSticker.read()
), one ofentity_type
,privacy_level
,entity_metadata
orstatus
is not of the correct type, or the provided channel’s type is neitherChannelType.voice
norChannelType.stage_voice
.
- Returns:
The newly updated guild scheduled event instance.
- Return type:
- await start(*, reason=None)[source]¶
This function is a coroutine.
Starts the guild scheduled event.
Changes the event status to
active
.You must have
manage_events
permission to do this.New in version 2.7.
- Parameters:
reason (Optional[
str
]) – The reason for starting the guild scheduled event. Shows up on the audit log.- Raises:
ValueError – The event has already started or ended, or was cancelled.
Forbidden – You do not have permissions to start the event.
HTTPException – Starting the event failed.
- Returns:
The started guild scheduled event instance.
- Return type:
- await end(*, reason=None)[source]¶
This function is a coroutine.
Ends the guild scheduled event.
Changes the event status to
completed
.You must have
manage_events
permission to do this.New in version 2.7.
- Parameters:
reason (Optional[
str
]) – The reason for ending the guild scheduled event. Shows up on the audit log.- Raises:
ValueError – The event has not started yet, has already ended, or was cancelled.
Forbidden – You do not have permissions to end the event.
HTTPException – Ending the event failed.
- Returns:
The ended guild scheduled event instance.
- Return type:
- await cancel(*, reason=None)[source]¶
This function is a coroutine.
Cancels the guild scheduled event.
Changes the event status to
cancelled
.You must have
manage_events
permission to do this.New in version 2.7.
- Parameters:
reason (Optional[
str
]) – The reason for cancelling the guild scheduled event. Shows up on the audit log.- Raises:
ValueError – The event has already started or ended, or was already cancelled.
Forbidden – You do not have permissions to cancel the event.
HTTPException – Cancelling the event failed.
- Returns:
The cancelled guild scheduled event instance.
- Return type:
- fetch_users(*, limit=None, with_members=True, before=None, after=None)[source]¶
This function is a coroutine.
Returns an
AsyncIterator
of users subscribed to the guild scheduled event.If
before
is specified, users are returned in reverse order, i.e. starting with the highest ID.Changed in version 2.5: Now returns an
AsyncIterator
instead of a list of the first 100 users.- Parameters:
limit (Optional[
int
]) – The number of users to retrieve.with_members (
bool
) – Whether to include some users as members. Defaults toTrue
.before (Optional[
abc.Snowflake
]) – Retrieve users before this object.after (Optional[
abc.Snowflake
]) – Retrieve users after this object.
- Raises:
Forbidden – You do not have proper permissions to fetch the users.
NotFound – The event does not exist.
HTTPException – Retrieving the users failed.
- Yields:
Union[
User
,Member
] – The member (if retrievable) or user subscribed to the guild scheduled event.
Examples
Usage
async for user in event.fetch_users(limit=500): print(user.name)
Flattening into a list
users = await event.fetch_users(limit=250).flatten()
RawGuildScheduledEventUserActionEvent¶
- class disnake.RawGuildScheduledEventUserActionEvent[source]¶
Represents the event payload for an
on_raw_guild_scheduled_event_subscribe()
andon_raw_guild_scheduled_event_unsubscribe()
events.New in version 2.3.
- event_id¶
The ID of the guild scheduled event that the user subscribed to or unsubscribed from.
- Type:
Data Classes¶
GuildScheduledEventMetadata¶
- class disnake.GuildScheduledEventMetadata(*, location=None)[source]¶
Represents a guild scheduled event entity metadata.
New in version 2.3.
- location¶
The location of the guild scheduled event. If
GuildScheduledEvent.entity_type
isGuildScheduledEventEntityType.external
, this value is notNone
.- Type:
Optional[
str
]
GuildScheduledEventNWeekday¶
- class disnake.GuildScheduledEventNWeekday(*, n, day)[source]¶
Represents a specific weekday occurrence within a month for recurrence rules.
New in version 2.11.
- day¶
The day of the week (e.g.
GuildScheduledEventWeekday.TUESDAY
) the event should occur on.
Enumerations¶
GuildScheduledEventEntityType¶
- class disnake.GuildScheduledEventEntityType[source]¶
Represents the type of a guild scheduled event entity.
New in version 2.3.
- stage_instance¶
The guild scheduled event will take place in a stage channel.
- voice¶
The guild scheduled event will take place in a voice channel.
- external¶
The guild scheduled event will take place in a custom location.
GuildScheduledEventStatus¶
GuildScheduledEventPrivacyLevel¶
GuildScheduledEventFrequency¶
- class disnake.GuildScheduledEventFrequency[source]¶
Represents the frequency of recurrence for a scheduled event.
This determines how often the event should repeat, such as daily, weekly, monthly, or yearly.
New in version 2.11.
- YEARLY¶
The event occurs once a year.
- MONTHLY¶
The event occurs once a month.
- WEEKLY¶
The event occurs once a week.
- DAILY¶
The event occurs every day.
GuildScheduledEventWeekday¶
- class disnake.GuildScheduledEventWeekday[source]¶
Represents the day of the week used in recurrence rules.
Used for specifying which days an event should recur on.
New in version 2.11.
- MONDAY¶
Monday.
- TUESDAY¶
Tuesday.
- WEDNESDAY¶
Wednesday.
- THURSDAY¶
Thursday.
- FRIDAY¶
Friday.
- SATURDAY¶
Saturday.
- SUNDAY¶
Sunday.
GuildScheduledEventMonth¶
- class disnake.GuildScheduledEventMonth[source]¶
Represents the month of the year used in recurrence rules.
Used for specifying which months an event should recur on.
New in version 2.11.
- JANUARY¶
January.
- FEBRUARY¶
February.
- MARCH¶
March.
- APRIL¶
April.
- MAY¶
May.
- JUNE¶
June.
- JULY¶
July.
- AUGUST¶
August.
- SEPTEMBER¶
September.
- OCTOBER¶
October.
- NOVEMBER¶
November.
- DECEMBER¶
December.