Total Complexity | 1 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Changes | 0 |
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 .permissions import Permission |
||
10 | from ...utils import APIObject |
||
11 | |||
12 | if TYPE_CHECKING: |
||
13 | from ...utils.snowflake import Snowflake |
||
14 | |||
15 | |||
16 | @dataclass(repr=False) |
||
17 | class Overwrite(APIObject): |
||
18 | """Represents a Discord Overwrite object |
||
19 | |||
20 | Attributes |
||
21 | ---------- |
||
22 | id: :class:`~pincer.utils.snowflake.Snowflake` |
||
23 | Role or user id |
||
24 | type: :class:`int` |
||
25 | Either 0 (role) or 1 (member) |
||
26 | allow: :class:`str` |
||
27 | Permission bit set |
||
28 | deny: :class:`str` |
||
29 | Permission bit set |
||
30 | """ |
||
31 | id: Snowflake |
||
32 | type: int |
||
33 | allow: str |
||
34 | deny: str |
||
35 | |||
36 | @property |
||
37 | def permissions(self) -> Permission: |
||
38 | """Returns the permissions for this overwrite""" |
||
39 | return Permission.from_int(int(self.allow), int(self.deny)) |
||