GramCore/plugin/methods/get_real_user_name.py
2024-03-10 19:31:21 +08:00

19 lines
429 B
Python

from typing import TYPE_CHECKING
if TYPE_CHECKING:
from telegram import Update
class GetRealUserName:
@staticmethod
def get_real_user_name(
update: "Update",
) -> str:
user = update.effective_user
message = update.effective_message
if message:
channel = message.sender_chat
if channel:
return channel.title
return user.first_name