1.281 - 7/21/2018
- Reddit::Client's comment handling is now mostly complete. This necessitated the adding of a new class, MoreComments, which is basically a container that holds a list of unexpanded comments (although it does have one method,
get_collapsed_comments
). - Added a new main class property
subdomain
. This will allow you to change the subdomain of links that are generated by functions likeget_web_url
. For example, you can change the subdomain to 'old' to generate links to old.reddit.com, which forces Reddit to return the old version of pages, or 'new' for new.reddit.com, to force the new version, or 'np', to generate non-participation links. Defaults to 'www'. get_permalink
has been renamed toget_web_url
in both Link and Comment.get_permalink
will continue to work for now, but is deprecated.- Added function get_links_by_id.
- Updated function get_comment to take the argument
include_children
. By default,get_comment
only returns a single Comment object, not any replies. This is just how Reddit's API works; the only way to get information about a comment using its ID alone is the 'info' endpoint, which returns only a single thing. Usinginclude_children
will cause it to make a second request, populating thereplies
field with any replies to it. If you had the subreddit name and link id, you could useget_comments
instead, which would fetch the comment and its replies in a single request. - Updated function get_comments (plural) in main and added it to the public documentation.^1 It retrieves the comment tree for a link or comment. It can now accept either a permalink, a subreddit name/post ID combination, a subreddit name/post ID/comment ID combination, or a complete URL. Collapsed comments will be in the
more
field as an array of comment IDs. These can be expanded into comments by calling get_collapsed_comments. - Added function get_collapsed_comments.
- Added function
get_comments
(plural) to both the Link and Comment classes. This calls get_comments using the Link/Comment's permalink as an argument. The Comment class's version includes an alias function,get_children
. - Failed requests now die without the message that includes the line number, unless
request_errors
is enabled. - get_modqueue had been corrected. It now takes a optional single argument,
subreddit
. - Line numbers are no longer reported on failed HTTP requests. They will still be reported if
print_request_errors
is true.
^1 This function has actually existed for years, undocumented. It accepted only one argument, a 'permalink', and had no way of handling collapsed comments. (Those are the comments where, on the website, you see "load more comments" and have to click to load more. In the API, these take the form of an array of IDs, which you must expand with a second request, just like you are doing when you click "load more comments" on the website.)
1.27 - 6/17/2018
- Added function get_modqueue.
- Added new class propery
print_request_on_error
. If this is true, Reddit::Client will print the entire response and request when there is an error. (This is the same information you would get withprint_request
, but only printed on error.) - Reduced automotic token refresh time even further, to 58 minutes, then reset it to 59 minutes 10 seconds after testing that appears to show that the cause of the 401s is not our tokens at all, but Reddit failing under heavy load. These appear to be errors that would normally be 503s, but are failing in a different way on Reddit's end for some reason, and failing as a 401 instead. So while nothing has changed on that front in 1.27, hopefully who are gettings 401s might find this information useful.
1.26 - 6/10/2018
- Added function
submit_crosspost
to main methods. - 'subreddit' is now required in
submit_link
- Variable
print_response
has been renamedprint_response_content
, but the former will still work. - Dropped automatic token refresh time to 3550 (1 hour, minus 50 seconds). This is to try to catch overlap in scripts that run for longer than an hour.
- 'username' can now optionally be passed in when initializing a new web-type Reddit::Client object. Since username is not required for web-type authentication, it wasn't set by default like it used to be with script-type apps. Functions that require it (for example fetching your own multis) would fail unless it was passed in manually with the function call. This allows you to pass it in at the beginning
1.244 - 5/9/2018
- 1.243: Reverted change making the
request_errors
flag default to true. It now defaults to false again. It now has the more sensible aliasprint_request_errors
, which is how the documentation will refer to it from now on. - 1.244: Fixed bug introduced while doing that.
1.241 - 4/29/2018
- Reddit::Client now prints the content of request errors by default, instead of just the status code. (Previously it would print just the status code unless
request_errors
was true. You can still setrequest_errors
to false if you choose.) - Added function
ban
to main methods.
1.23 - 4/16/2018
- Added function
get_refresh_token
. This is a big one for people using Web-type apps. It allows you to use Reddit::Client to get a permanent refresh token. Previously one had to write a script to do this themselves. - Added function
get_modmail_raw
to main methods. This retrieves new modmail from Reddit in its raw form, which is a mess.get_modmail
is planned as a function that will return it in a more usable form. - Removed some unused fields from Link and Comment.
- Clarified the meanings of some lesser-known debug variables:
print_request
now prints the entire request and response, always.print_reponse
now prints the content of Reddit's response, always.request_errors
prints the content of the response, if there is an error (unchanged).
1.21 - ?
- Added function
spam
to main methods. - Link and Comment also have their own
spam
methods.
1.20 - 3/5/2018
"Web" type apps are now supported! This means that you can now write apps to be used by the public at large, not just "script" type apps, which require a username and password and are intended for personal use only.
Users can authorize a "web" type app to take actions on their behalf. This process will be familiar to you if you've ever used a non-official Android or iPhone app to interact with Reddit. The user is presented with a confirmation screen (from Reddit itself-- they give their password to Reddit, not you) where they can then click "accept" to give the app persmission to take actions on their behalf, for example make posts or read their inbox messages.
To use "web" type authentication, pass in the key refresh_token
, which you have obtained by following Reddit's oauth setup guide: https://github.com/reddit-archive/reddit/wiki/OAuth2. There are plans to add a guide for that in the future, since it's slightly involved, but for now you're on your own.
Other changes this update:
- Added functions
get_wiki
andget_wiki_data
in main methods. edit_wiki
now accepts the alias 'sub' for parameter 'subreddit'.user_agent
is now required when instantiating a new Reddit::Client object.
1.10 - 2/25/2018
- Added moderation functions function approve and ignore_reports in main methods.
1.0991 - 2/23/2018
- Fixed a bug that had been introduced in the last version
1.099 - 02/10/2018
- get_user can now accept the 'about' view, which will return an Account object of the user's account.
- Added 'about' user constant
- Added "delete" method to the Link class, which documentation already lyingly said was there
- Internal: updated get_user and list_subreddits to use set_listing_defaults
1.098 - 11/27/2017
- Added moderation function remove in main methods.
- Link and Comment objects have their own remove method too.
submit_link
.submit_text
andget_subreddit_comments
can now accept the subreddit as sub as well as subreddit.
1.0972 - 11/02/2017
- Added function edit in main methods.
- Comments and Links now also have their own edit methods, which are the same but doesn't require a fullname as the first argument.
- get_comment and get_link can now accept a short id as well as a fullname.
- Comments and Links now have their own delete functions.
- Fixed get_permalink in Comment, which was returning the wrong result if its parent was a comment rather than a post.
- Added function get_permalink to Link.
1.0965 - 10/28/2017
get_modlinks has been updated to support all 5 categories of mod links, not just 'modqueue'.
1.096 - 10/27/2017
- Added function get_modlinks.
-
Link and User classes now have properties
user_reports
andmod_reports
. They are both array references; the difference is thatmod_reports
contains the name of the moderator who reported it. (Only if they are a moderator of the sub it's being reported in.) Despite being array references, they are formatted like an array of hashes. For example,[["First report", 1], ["Second report", 1]]
The number is the number of times that report has appeared.
-
Account, Message, and SubReddit classes now have a
type
property like Links and Comments do. It corresponds to the types of things. - Functions that return listings are now more consistent, and all now recognize all of the listing variables, such as
count
,sr_detail
, andonly
. - The Account class now has many more properties, nearly all that are returned by Reddit.
1.094 - 9/12/2017
- Fixed a bug that would prevent passwords with special characters from authenticating (thanks jay.wilmarth@gmail.com).
- Added function get_subreddit_info.
1.093 - 8/20/2017
- Reverted a change from 1.0901 that would display the full content of request errors. Sometimes Reddit returns a full web page instead of just the JSON error data (usually on 503-type heavy traffic errors), which could cause problems for scripts not expecting it.
- Full request errors can now be displayed by setting
request_errors
to true when creating a new Reddit::Client object. - Accidentally skipped two minor version numbers. This should have been 1.091. Woops.
1.0902 - 8/19/2017
- Fixed a bug that would cause an warning message when using
get_subreddit_comments
- Removed the
view
argument fromget_subreddit_comments
as it did nothing.
1.0901 - 8/9/2017
- Fixed a bug that would cause an error message if Reddit's response was empty on a successful request.
- Reddit::Client can now handle PUT and DELETE requests, which was required for the new functions.
- Request errors now include the body of Reddit's response. This is usually a small glob of JSON.
- Added the
create_multi
,delete_multi
,edit_multi
andget_multi
functions.
1.086 - 7/3/2017
Added the repost
parameter to submit_link
.
1.085 - 7/2/2017
Fixed bug in submit_text
and submit_link
functions that was causing the inbox_replies
flag to be ignored if false.
1.084 - 1/22/2017
Added the comment
function.
1.083 - 1/21/2017
Added the edit_wiki
function.
1.082 - September 2016
Added a patch for Perl 5.22, which would cause warning messages when using the info() function.
1.081
Added get_flair_options, set_post_flair and set_user_flair to the main methods.
1.080
Added subreddit_type and public_traffic to SubReddit.
1.079
Fixed bug that caused Comment->reply() to reply to the parent instead of the comment.
1.078
token_request was incorrectly passing the user agent string to LWP, which was causing an error with new versions of LWP.
1.076
The get_permalink
method of Comment no longer makes a request, making it safe to use as much as you'd like.
The main Reddit::Client class's get_permalink method still makes a request, although now it can take either an ID or fullname for the comment and post.
1.075
- added
get_user
function - Links and Comments now have a type property, a constant which is "t3" or "t1" repsectively.
1.073
find_subreddits
now returns a list instead of a hash, bringing it in line with all other functions that returns lists of things.find_subreddits
now accepts a hash that can contain the usual list control variables: before, after and limit, along with a sort type that's unique to itself