Total Complexity | 2 |
Total Lines | 34 |
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 dataclasses import dataclass |
||
5 | from typing import Optional |
||
6 | |||
7 | |||
8 | from ...objects.guild.role import Role |
||
9 | from ...objects.user.user import User |
||
10 | |||
11 | |||
12 | @dataclass |
||
13 | class Mentionable: |
||
14 | """ |
||
15 | Represents the Mentionable type |
||
16 | |||
17 | user : Optional[:class:`~pincer.objects.user.user.User`] |
||
18 | User object returned from a discord interaction |
||
19 | role: Optional[:class:`~pincer.objects.guild.role.Role`] |
||
20 | Role object returned from a discord interaction |
||
21 | """ |
||
22 | user: Optional[User] = None |
||
23 | role: Optional[Role] = None |
||
24 | |||
25 | @property |
||
26 | def is_user(self): |
||
27 | """Returns true if the Mentionable object has a User""" |
||
28 | return self.user is not None |
||
29 | |||
30 | @property |
||
31 | def is_role(self): |
||
32 | """Returns true if the Mentionable object has a Role""" |
||
33 | return self.role is not None |
||
34 |