comment#

PyPtt.API.comment(self, board: str, comment_type: CommentType, content: str, aid: str | None = None, index: int = 0) None

推文。

參數:
  • board (str) – 看板名稱。

  • comment_type (CommentType) – 推文類型。

  • content (str) – 推文內容。

  • aid (str) – 文章編號。

  • index (int) – 文章編號。

回傳:

None

引發:

範例:

import PyPtt

ptt_bot = PyPtt.API()
try:
    # .. login ..
    ptt_bot.comment(board='Test', comment_type=PyPtt.CommentType.PUSH, content='Comment by index', index=123)
    ptt_bot.comment(board='Test', comment_type=PyPtt.CommentType.PUSH, content='Comment by index', aid='17MrayxF')
    # .. do something ..
finally:
    ptt_bot.logout()

參考 推文類型取得最新文章編號