diff --git a/lolz.py b/lolz.py index f8679b7..9527985 100644 --- a/lolz.py +++ b/lolz.py @@ -2,7 +2,7 @@ import logging import asyncio from LOLZTEAM.Client import Forum -from typing import Dict, Any, Union, List +from typing import Dict, Any, Optional, Union, List logger = logging.getLogger(__name__) @@ -59,8 +59,15 @@ class Lolz: return comments - async def has_comments(self, post_id: int) -> bool: - post = await self.get_post(post_id=post_id) + async def has_comments( + self, post_id: Optional[int], post: Dict[str, Any] = None + ) -> bool: + if not post: + if not post_id: + post = {} + else: + post = await self.get_post(post_id=post_id) + return post.get("post_comment_count", 0) > 0 async def create_comment(self, post_id: int, comment_body: str) -> bool: