public class Bot
extends java.lang.Object
| Constructor and Description |
|---|
Bot(java.lang.String subreddit)
Creates the bot for the specified subreddit.
|
| Modifier and Type | Method and Description |
|---|---|
me.timothy.jreddit.info.Listing |
getRecentComments()
Returns a list of recent comments that might need to be scanned.
|
me.timothy.jreddit.info.Listing |
getRecentSubmissions()
Returns any new submissions.
|
me.timothy.jreddit.info.Listing |
getUnreadMessages()
Returns any new messages.
|
me.timothy.jreddit.User |
getUser()
Gets the user.
|
boolean |
loginReddit(java.lang.String username,
java.lang.String password,
java.lang.String appClientID,
java.lang.String appClientSecret)
Logs in to reddit.
|
boolean |
respondTo(me.timothy.jreddit.info.Thing replyable,
java.lang.String message)
Responds to the specified replyable with the specified message.
|
me.timothy.jreddit.info.Errorable |
sendPM(java.lang.String to,
java.lang.String title,
java.lang.String message)
Sends a personal message
|
boolean |
setReadMessage(java.lang.String ids)
Marks the specified messages as read.
|
public Bot(java.lang.String subreddit)
subreddit - the subreddit to scanpublic boolean loginReddit(java.lang.String username,
java.lang.String password,
java.lang.String appClientID,
java.lang.String appClientSecret)
throws java.io.IOException,
org.json.simple.parser.ParseException
username - Username of the reddit accountpassword - Password of the reddit accountorg.json.simple.parser.ParseException - if the response from reddit is unparsablejava.io.IOException - if an i/o exception occurspublic me.timothy.jreddit.info.Listing getRecentComments()
throws java.lang.IllegalStateException,
java.io.IOException,
org.json.simple.parser.ParseException
java.lang.IllegalStateException - if the user is nullorg.json.simple.parser.ParseException - if the response from reddit is unparsablejava.io.IOException - if an i/o exception occurspublic me.timothy.jreddit.info.Listing getRecentSubmissions()
throws java.lang.IllegalStateException,
java.io.IOException,
org.json.simple.parser.ParseException
org.json.simple.parser.ParseException - if the response from reddit is unparsablejava.io.IOException - if an i/o exception occursjava.lang.IllegalStateExceptionpublic me.timothy.jreddit.info.Listing getUnreadMessages()
throws java.io.IOException,
org.json.simple.parser.ParseException
org.json.simple.parser.ParseException - if the response from reddit is unparsablejava.io.IOException - if an i/o exception occurspublic boolean respondTo(me.timothy.jreddit.info.Thing replyable,
java.lang.String message)
throws java.lang.IllegalStateException,
java.io.IOException,
org.json.simple.parser.ParseException
replyable - the thing to reply tomessage - the messagejava.lang.IllegalStateException - the illegal state exceptionorg.json.simple.parser.ParseException - if the response from reddit is unparsablejava.io.IOException - if an i/o exception occurspublic me.timothy.jreddit.info.Errorable sendPM(java.lang.String to,
java.lang.String title,
java.lang.String message)
throws java.io.IOException,
org.json.simple.parser.ParseException
to - who to send the message totitle - the title of the messagemessage - the text of the messageorg.json.simple.parser.ParseExceptionjava.io.IOExceptionpublic boolean setReadMessage(java.lang.String ids)
throws java.lang.IllegalStateException,
java.io.IOException,
org.json.simple.parser.ParseException
ids - the messagesjava.lang.IllegalStateException - if rest client or user is nullorg.json.simple.parser.ParseException - if the response from reddit is unparsablejava.io.IOException - if an i/o exception occurspublic me.timothy.jreddit.User getUser()