1
|
|
|
# Copyright Pincer 2021-Present |
|
|
|
|
2
|
|
|
# Full MIT License can be found in `LICENSE` at the project root. |
3
|
|
|
|
4
|
|
|
from __future__ import annotations |
5
|
|
|
|
6
|
|
|
from dataclasses import dataclass |
7
|
|
|
from enum import IntEnum |
8
|
|
|
from typing import Optional, TYPE_CHECKING |
9
|
|
|
|
10
|
|
|
from ...utils.api_object import APIObject, MISSING |
11
|
|
|
|
12
|
|
|
if TYPE_CHECKING: |
13
|
|
|
from ..guild.stage import PrivacyLevel |
14
|
|
|
from ..user.user import User |
15
|
|
|
from ...utils.snowflake import Snowflake |
16
|
|
|
from ...utils.timestamp import Timestamp |
17
|
|
|
from ...utils.types import APINullable |
18
|
|
|
|
19
|
|
|
|
20
|
|
|
class EventStatus(IntEnum): |
21
|
|
|
""" |
22
|
|
|
The status of an event. |
23
|
|
|
|
24
|
|
|
Attributes |
25
|
|
|
---------- |
26
|
|
|
SCHEDULED: int |
27
|
|
|
The event is scheduled. |
28
|
|
|
ACTIVE: int |
29
|
|
|
The event is active. |
30
|
|
|
CANCELLED: int |
31
|
|
|
The event is cancelled. |
32
|
|
|
COMPLETED: int |
33
|
|
|
The event is completed. |
34
|
|
|
""" |
35
|
|
|
SCHEDULED = 1 |
36
|
|
|
ACTIVE = 2 |
37
|
|
|
COMPLETED = 3 |
38
|
|
|
CANCELLED = 4 |
39
|
|
|
|
40
|
|
|
|
41
|
|
|
class GuildScheduledEventEntityType(IntEnum): |
42
|
|
|
""" |
43
|
|
|
The type of entity that is scheduled. |
44
|
|
|
|
45
|
|
|
Attributes |
46
|
|
|
---------- |
47
|
|
|
STAGE_INSTANCE: int |
48
|
|
|
The event is scheduled for a stage instance. |
49
|
|
|
VOICE: int |
50
|
|
|
The event is scheduled for a voice channel. |
51
|
|
|
EXTERNAL: int |
52
|
|
|
The event is scheduled for an external resource. |
53
|
|
|
""" |
54
|
|
|
STAGE_INSTANCE = 1 |
55
|
|
|
VOICE = 2 |
56
|
|
|
EXTERNAL = 3 |
57
|
|
|
|
58
|
|
|
|
59
|
|
|
@dataclass(repr=False) |
60
|
|
|
class ScheduledEvent(APIObject): |
|
|
|
|
61
|
|
|
""" |
62
|
|
|
Represents a scheduled event in a guild. |
63
|
|
|
|
64
|
|
|
Attributes |
65
|
|
|
---------- |
66
|
|
|
id: :class:`int` |
67
|
|
|
The ID of the scheduled event. |
68
|
|
|
name: :class:`str` |
69
|
|
|
The name of the scheduled event (1-100 characters) |
70
|
|
|
guild_id: :class:`int` |
71
|
|
|
The guild id which the scheduled event belongs to |
72
|
|
|
scheduled_start_time: str |
73
|
|
|
The scheduled start time of the event. |
74
|
|
|
privacy_level: :class:`~pincer.guild.stage.PrivacyLevel` |
75
|
|
|
The privacy level of the scheduled event. |
76
|
|
|
status: :class:`~pincer.guild.schedule_events.EventStatus` |
77
|
|
|
The status of the scheduled event. |
78
|
|
|
entity_type: :class:`~pincer.guild.schedule_events.GuildScheduledEventEntityType` |
79
|
|
|
The type of the scheduled event |
80
|
|
|
channel_id: :class:`int` |
81
|
|
|
The channel id in which the scheduled event will be hosted, |
82
|
|
|
or null if scheduled entity type is EXTERNAL |
83
|
|
|
creator_id: :class:`int` |
84
|
|
|
The user id of the creator of the scheduled event |
85
|
|
|
scheduled_end_time: str |
86
|
|
|
The time the scheduled event will end, required if entity_type is EXTERNAL |
87
|
|
|
description: :class:`str` |
88
|
|
|
The description of the scheduled event (0-1000 characters) |
89
|
|
|
entity_id: :class:`int` |
90
|
|
|
The id of an entity associated with a guild scheduled event |
91
|
|
|
entity_metadata: :class:`str` |
92
|
|
|
Additional metadata for the guild scheduled event |
93
|
|
|
creator: :class:`~pincer.objects.user.user.User` |
94
|
|
|
The user who created the scheduled event |
95
|
|
|
user_count: :class:`int` |
96
|
|
|
The number of users who have joined the scheduled event |
97
|
|
|
""" |
98
|
|
|
id: Snowflake |
99
|
|
|
name: str |
100
|
|
|
guild_id: Snowflake |
101
|
|
|
scheduled_start_time: Timestamp |
102
|
|
|
privacy_level: PrivacyLevel |
103
|
|
|
status: EventStatus |
104
|
|
|
entity_type: GuildScheduledEventEntityType |
105
|
|
|
|
106
|
|
|
channel_id: APINullable[Snowflake] = MISSING |
107
|
|
|
creator_id: APINullable[Snowflake] = MISSING |
108
|
|
|
scheduled_end_time: Optional[Timestamp] = None |
109
|
|
|
|
110
|
|
|
description: APINullable[str] = MISSING |
111
|
|
|
entity_id: APINullable[Snowflake] = MISSING |
112
|
|
|
entity_metadata: APINullable[str] = MISSING |
113
|
|
|
creator: APINullable[User] = MISSING |
114
|
|
|
user_count: APINullable[int] = MISSING |
115
|
|
|
|