refactor(lolz): post param for has_comments
This commit is contained in:
@@ -2,7 +2,7 @@ import logging
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from LOLZTEAM.Client import Forum
|
from LOLZTEAM.Client import Forum
|
||||||
from typing import Dict, Any, Union, List
|
from typing import Dict, Any, Optional, Union, List
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -59,8 +59,15 @@ class Lolz:
|
|||||||
|
|
||||||
return comments
|
return comments
|
||||||
|
|
||||||
async def has_comments(self, post_id: int) -> bool:
|
async def has_comments(
|
||||||
post = await self.get_post(post_id=post_id)
|
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
|
return post.get("post_comment_count", 0) > 0
|
||||||
|
|
||||||
async def create_comment(self, post_id: int, comment_body: str) -> bool:
|
async def create_comment(self, post_id: int, comment_body: str) -> bool:
|
||||||
|
|||||||
Reference in New Issue
Block a user