Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
z44d committed Sep 26, 2024
1 parent 49c45e0 commit 258a996
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions tgram/template/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from tgram import TgBot

# from tgram.types import LinkPreviewOptions
from config import TOKEN
from config import BOT_TOKEN

logging.basicConfig(level=logging.INFO)
py_version = sys.version_info[:2]
Expand All @@ -15,7 +15,7 @@

async def main():
bot = TgBot(
TOKEN,
BOT_TOKEN,
# parse_mode="Markdown",
# link_preview_options=LinkPreviewOptions(is_disabled=True),
plugins="./plugins",
Expand Down
13 changes: 6 additions & 7 deletions tgram/tgbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,17 +454,16 @@ def me(self) -> "tgram.types.User":
if self._me:
return self._me

async def func():
self.me = await self.get_me()
import requests

return self.me
response = requests.get(self._api_url + "getMe").json()

task = self.loop.create_task(func())
if not response["ok"]:
raise APIException._from_json(response)

while not task.done():
pass
self._me = tgram.types.User._parse(self, response["result"])

return task.result()
return self._me


wrap(RedisStorage)
Expand Down

0 comments on commit 258a996

Please sign in to comment.