fix logger

This commit is contained in:
2024-03-22 22:34:59 +08:00
parent 1185d4bc5f
commit 19fb5b9822
+2 -1
View File
@@ -118,7 +118,6 @@ class TGTweet(Tweet):
async def __aenter__(self): async def __aenter__(self):
self._tweet: dict = await self._fetch_tweet(self._api_param) self._tweet: dict = await self._fetch_tweet(self._api_param)
super().__init__(*self._init_properties) super().__init__(*self._init_properties)
logger.info("Media: {0}".format(str(m) for m in self.media))
return self return self
async def __aexit__(self, exc_type, exc_val, exc_tb): async def __aexit__(self, exc_type, exc_val, exc_tb):
@@ -172,6 +171,7 @@ class TGTweet(Tweet):
@property @property
def inline_query_generator(self) -> Generator[InlineQueryResultPhoto | InlineQueryResultVideo, None, None]: def inline_query_generator(self) -> Generator[InlineQueryResultPhoto | InlineQueryResultVideo, None, None]:
for i, tweet_media in enumerate(self.media): for i, tweet_media in enumerate(self.media):
logger.info(f"Media: {str(tweet_media)}")
if tweet_media.type == "image": if tweet_media.type == "image":
yield InlineQueryResultPhoto( yield InlineQueryResultPhoto(
id=str(i), id=str(i),
@@ -195,6 +195,7 @@ class TGTweet(Tweet):
@property @property
def pm_media_generator(self) -> Generator[InputMediaPhoto | InputMediaVideo, None, None]: def pm_media_generator(self) -> Generator[InputMediaPhoto | InputMediaVideo, None, None]:
for tweet_media in self.media: for tweet_media in self.media:
logger.info(f"Media: {str(tweet_media)}")
if tweet_media.type == "image": if tweet_media.type == "image":
yield InputMediaPhoto( yield InputMediaPhoto(
media=tweet_media.url, media=tweet_media.url,