Discord/modules/utils_sync.py

11 lines
237 B
Python
Raw Normal View History

2024-12-16 00:36:48 +02:00
from typing import Union
2023-05-04 17:09:47 +03:00
2023-05-08 17:39:46 +03:00
from discord import Member, User
2023-05-04 17:09:47 +03:00
2023-05-04 17:14:23 +03:00
2023-05-08 17:39:46 +03:00
def guild_name(member: Union[Member, User]) -> str:
if isinstance(member, User):
return member.name
2024-12-16 00:36:48 +02:00
return member.name if member.nick is None else member.nick