Skip to content
/ redd Public
forked from avinashbot/redd

An intuitive API wrapper for reddit, written in Ruby.

License

Notifications You must be signed in to change notification settings

storyful/redd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


<!-- Badges -->
<a href="https://rubygems.org/gems/redd">
  <img src="https://img.shields.io/gem/v/redd.svg?style=flat-square" alt="Gem Version">
</a>
<a href="https://travis-ci.org/avinashbot/redd">
  <img src="https://img.shields.io/travis/avinashbot/redd.svg?style=flat-square" alt="Build Status">
</a>
<a href="https://rubygems.org/gems/redd">
  <img src="https://img.shields.io/gem/dt/redd.svg?style=flat-square" alt="Gem Downloads">
</a>

Redd is a batteries-included API wrapper for reddit.


Features

  • Supports most of the reddit API, including live threads and the beta mod-mail.
  • Includes support for streaming new posts and comments.
  • Built-in rate limiting and error handling.
  • Automatic retrying of failed requests.

Demo

require 'redd'

session = Redd.it(
  user_agent: 'Redd:RandomBot:v1.0.0 (by /u/Mustermind)',
  client_id:  'PQgS0UaX9l70oQ',
  secret:     'PsF_kVZrW8nSVCG5kNsIgl-AaXE',
  username:   'RandomBot',
  password:   'hunter2'
)

session.subreddit('all').comment_stream do |comment|
  if comment.body.include?('roll a dice')
    comment.reply("I just rolled a dice! It's a #{rand(1..6)}!")
  elsif comment.body.include?('flip a coin')
    comment.reply("I just flipped a coin! It's a #{%w(heads tails).sample}!")
  end
end

FAQ

Is that bot fully functional?

Yes, that's all there is to it! You don't need to handle rate-limiting, refresh access tokens or protect against issues on reddit's end (like 5xx errors).

Where can I find the documentation?

Gem / GitHub

How do I request a feature / contribute?

  • The quickest way to get a feature into Redd is to raise a GitHub issue.
  • Pull requests are also appreciated!
  • Don't hesitate! There are no stupid questions!

How can I contact you?

Reddit / GitHub / Email


This project is available under the MIT License. See LICENSE.txt for more details.
The Redd logo uses the FARRAY font by Coquet Adrien.

About

An intuitive API wrapper for reddit, written in Ruby.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 99.9%
  • Shell 0.1%