maxapi/maxapi/methods/get_me.py
2025-07-24 18:54:41 +03:00

41 lines
1017 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from typing import TYPE_CHECKING
from ..types.users import User
from ..enums.http_method import HTTPMethod
from ..enums.api_path import ApiPath
from ..connection.base import BaseConnection
if TYPE_CHECKING:
from ..bot import Bot
class GetMe(BaseConnection):
"""
Класс для получения информации о боте.
Args:
bot (Bot): Экземпляр бота для выполнения запроса.
"""
def __init__(self, bot: 'Bot'):
self.bot = bot
async def fetch(self) -> User:
"""
Выполняет GET-запрос для получения данных о боте.
Returns:
User: Объект пользователя с полной информацией.
"""
assert self.bot is not None
return await super().request(
method=HTTPMethod.GET,
path=ApiPath.ME,
model=User,
params=self.bot.params
)