samsymons / RedditKit.rb

[Deprecated] A Ruby wrapper for the reddit API
https://redditkit.com/
MIT License
152 stars 26 forks source link

comment on a post #38

Open ninjonxb opened 9 years ago

ninjonxb commented 9 years ago

I am trying to figure out how to post a comment to a reddit post I just made. So far I have tried saving the object that is returned when I do a submit and doing: RedditKit.submit_comment(submit_object, "test") -- which errors with permission denied I have tried making a link that I could put in the submit_comment but that just keeps returning nil even though within the same session I was able to make the post originally. test_link = RedditKit.link("http://www.reddit.com/r/redditbotplaygroundsw/comments/2poh23/test_title/") Not sure what else to try. The ruby doc says that it will return nil if I am not currently signed in but I am:

2.1.2 :021 > RedditKit.sign_in 'OMIT', "OMIT" => "OMIT" 2.1.2 :022 > test_link = RedditKit.link("http://www.reddit.com/r/redditbotplaygroundsw/comments/2poh23/test_title/") => nil

This is a private reddit I have for getting my bot working. I am the moderator and I can without issue make posts. I just can't comment.

BukhariH commented 9 years ago

That's because you're not using the fullname of the link.

The fullname of a link is the 'kind' of t3 and then an underscore followed by the link id. (You can see here for more: https://www.reddit.com/dev/api#fullnames)

E.G. For your link it would be:

t3_2poh23

So, you would do:

RedditKit.link("t3_2poh23")

Hope that helps! Hasnain