| Class | Parent class |
|---|---|
| Reddit::Client::Comment | Reddit::Client::VotableThing |
A Reddit comment. A Comment object is generated by the get_subreddit_comments and get_comment methods of Reddit::Client.
A description of Comment's properties can be found here, although it is not current. Below is example data dumped from an actual Comment object.
Constants
| Constant | Value |
|---|---|
| type | t1 |
Methods
| Method | Description |
|---|---|
| delete | Delete the comment. |
| edit(text) | Edit the comment. |
| get_children | Return the comment tree that starts with this comment. Does not include the comment itself. Also populates the current Comment object's replies field. |
| get_comments | Return the comment tree that starts with this comment, including this comment. This will be a single element array with this comment at the top, and any replies to it in the replies field. This is how the API works when requesting a comment tree; this function is provided for consistency with that. To get only the replies, use get_children. (Or call this and use $$result[0]->{replies}. Or, since this Comment object's replies field is now populated, use that.) Also populates the current Comment object's replies field. |
| get_web_url | Return a complete web URL for the comment. |
| reply(text) | Reply to comment. Returns the fullname of the new comment. |
Properties
| Field | Example |
|---|---|
| approved_by | undef |
| author | "author" |
| author_flair_css_class | undef |
| author_flair_text | undef |
| banned_by | undef |
| body | "test comment" |
| body_html | "<div class=\"md\"><p>test comment</p>\n</div>" |
| created | 1444097226 |
| created_utc | 1444068426 |
| downs | 0 |
| edited | 0 |
| id | "cvp3adj" |
| likes | 1 |
| link_id | "t3_3n7gr4" |
| mod_reports | [] |
| name | "t1_cvp3adj" |
| num_reports | undef |
| parent_id | "t3_3n7gr4" |
| permalink | https://www.reddit.com/r/test/comments/3ng7r5//cvp5afk |
| replies | [] |
| saved | 0 |
| score | 1 |
| subreddit | "test" |
| subreddit_id | "t5_2qh23" |
| type | "t1" |
| user_reports | [] |
| ups | 1 |