Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement Member.id #465

Merged
merged 5 commits into from Feb 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion interactions/api/models/member.py
Expand Up @@ -3,7 +3,7 @@

from .channel import Channel
from .flags import Permissions
from .misc import MISSING, DictSerializerMixin
from .misc import MISSING, DictSerializerMixin, Snowflake
from .role import Role
from .user import User

Expand Down Expand Up @@ -74,6 +74,16 @@ def __init__(self, **kwargs):

if not self.avatar and self.user:
self.avatar = self.user.avatar

@property
def id(self) -> Snowflake:
"""
Returns the ID of the user.

:return: The ID of the user
:rtype: Snowflake
"""
return self.user.id if self.user else None

async def ban(
self,
Expand Down
5 changes: 3 additions & 2 deletions interactions/api/models/member.pyi
@@ -1,15 +1,14 @@
from datetime import datetime
from typing import Any, List, Optional, Union

from .misc import DictSerializerMixin, MISSING
from .misc import DictSerializerMixin, MISSING, Snowflake
from .role import Role
from .user import User
from .flags import Permissions
from ..http import HTTPClient
from .message import Message, Embed, MessageInteraction
from ...models.component import ActionRow, Button, SelectMenu


class Member(DictSerializerMixin):

_json: dict
Expand All @@ -28,6 +27,8 @@ class Member(DictSerializerMixin):
communication_disabled_until: Optional[datetime.isoformat]
hoisted_role: Any # TODO: post-v4: Investigate what this is for when documented by Discord.
def __init__(self, **kwargs): ...
@property
def id(self) -> Snowflake: ...
async def ban(
self,
guild_id: int,
Expand Down