Get Started - Learn How To Make Your Bot!
List of all currently Free Items
Added on version 23.1.0b14
get_post(self, post_id: str) -> GetPublicPostResponse:
Fetch a single post given its post_id.
Args:
**`post_id (str)`**: The unique identifier for a post.
Returns:
**`GetPublicPostResponse`**: The public data of the post.
Now let’s see an example on how to get the last post details of the user that’s saying the command:
async def on_chat(self, user: User, message: str) -> None:
if message.lower().startswith("/postdetails"):
author_id = user.id
posts = await self.webapi.get_posts(author_id=author_id)
last_post_id = posts.posts[0].post_id
post_details = await self.webapi.get_post(last_post_id)
print (post_details)
Response:
GetPublicPostResponse(
post = Post(
post_id="62b0d42156a97183fac3dfd2",
author_id="6111e1fb22dcb50edf32e4a8",
created_at="2022-06-20T20:10:09.476000+00:00",
file_key="posts/6111e1fb22dcb50edf32e4a8/62b0d41f0a160174540ba611_0.webp",
type="photo",
visibility="public",
num_comments=4,
num_likes=3,
num_reposts=0,
body=PostBody(text="None", inventory=PostInventory(items=[])),
caption="num dia desses comuns que eu não me sinto normal",
featured_user_ids=[],
comments=[
Comment(
id="630f6003bc61a9e8cc54b063",
content="@ClaraMatos n me ama mais 😔",
post_id="62b0d42156a97183fac3dfd2",
author_id="6111e1fb22dcb50edf32e4a8",
author_name="ItsVini",
num_likes=0,
),
Comment(
id="630f5f963e248dfeb08f42e3",
content="oi, vem smp aqui? Pq agora eu venho😏",
post_id="62b0d42156a97183fac3dfd2",
author_id="605aba51da5a6c3e712f5808",
author_name="ClaraMatos",
num_likes=1,
),
Comment(
id="630f5f7dc9ae61ce60155bb0",
content="COMO ASSIM 20 DE JUNHO",
post_id="62b0d42156a97183fac3dfd2",
author_id="605aba51da5a6c3e712f5808",
author_name="ClaraMatos",
num_likes=1,
),
Comment(
id="630f5f6b695cc1d119fc414c",
content="QUE ISSO QUEM MANDOU",
post_id="62b0d42156a97183fac3dfd2",
author_id="605aba51da5a6c3e712f5808",
author_name="ClaraMatos",
num_likes=1,
),
],
))