|
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 typing import TYPE_CHECKING |
|
8
|
|
|
|
|
9
|
|
|
from ...utils import APIObject |
|
10
|
|
|
|
|
11
|
|
|
if TYPE_CHECKING: |
|
12
|
|
|
from typing import Optional |
|
13
|
|
|
|
|
14
|
|
|
from ..guild import Guild |
|
15
|
|
|
from ..user.user import User |
|
16
|
|
|
from ...utils.snowflake import Snowflake |
|
17
|
|
|
from ...utils.timestamp import Timestamp |
|
18
|
|
|
|
|
19
|
|
|
|
|
20
|
|
|
@dataclass(repr=False) |
|
21
|
|
|
class GuildTemplate(APIObject): |
|
|
|
|
|
|
22
|
|
|
"""Represents a code that when used, |
|
23
|
|
|
creates a guild based on a snapshot of an existing guild. |
|
24
|
|
|
|
|
25
|
|
|
Attributes |
|
26
|
|
|
---------- |
|
27
|
|
|
code: :class:`str` |
|
28
|
|
|
the template code (unique ID) |
|
29
|
|
|
name: :class:`str` |
|
30
|
|
|
template name |
|
31
|
|
|
description: Optional[:class:`str`] |
|
32
|
|
|
the description for the template |
|
33
|
|
|
usage_count: :class:`int` |
|
34
|
|
|
number of times this template has been used |
|
35
|
|
|
creator_id: :class:`~pincer.utils.snowflake.Snowflake` |
|
36
|
|
|
the ID of the user who created the template |
|
37
|
|
|
creator: :class:`~pincer.objects.user.user.User` |
|
38
|
|
|
user who created the template |
|
39
|
|
|
created_at: :class:`~pincer.utils.timestamp.Timestamp` |
|
40
|
|
|
when this template was created |
|
41
|
|
|
updated_at: :class:`~pincer.utils.timestamp.Timestamp` |
|
42
|
|
|
when this template was last synced to the source guild |
|
43
|
|
|
source_guild_id: :class:`~pincer.utils.snowflake.Snowflake` |
|
44
|
|
|
the ID of the guild this template is based on |
|
45
|
|
|
serialized_source_guild: :class:`~pincer.objects.guild.guild.Guild` |
|
46
|
|
|
the guild snapshot this template contains |
|
47
|
|
|
is_dirty: Optional[:class:`bool`] |
|
48
|
|
|
whether the template has unsynced changes |
|
49
|
|
|
""" |
|
50
|
|
|
|
|
51
|
|
|
code: str |
|
52
|
|
|
name: str |
|
53
|
|
|
description: Optional[str] |
|
54
|
|
|
usage_count: int |
|
55
|
|
|
creator_id: Snowflake |
|
56
|
|
|
creator: User |
|
57
|
|
|
created_at: Timestamp |
|
58
|
|
|
updated_at: Timestamp |
|
59
|
|
|
source_guild_id: Snowflake |
|
60
|
|
|
serialized_source_guild: Guild |
|
61
|
|
|
is_dirty: Optional[bool] |
|
62
|
|
|
|