Git Product home page Git Product logo

graw's Introduction

graw

Build Status Version: 1.2.0 GoDoc

go get github.com/turnage/graw

graw is a library for building Reddit bots that takes care of everything you don't want to. Read the tutorial book!

As of major version 1, the API promise is: no breaking changes, ever. Details below. This applies to all (library) subpackages of graw.

Usage

The design of graw is that your bot is a handler for events, Reddit is a source of events, and graw connects the two. If you want to announce all the new posts in a given subreddit, this is your bot:

type announcer struct {}

func (a *announcer) Post(post *reddit.Post) error {
        fmt.Printf("%s posted \"%s\"\n", post.Author, post.Title)
        return nil
}

Give this to graw with an api handle from the reddit package and a tell it what events you want to subscribe to; graw will take care of the rest. See the godoc and tutorial book for more information.

Features

The primary feature of graw is robust event streams. graw supports many exciting event streams:

  • New posts in subreddits.
  • New comments in subreddits.
  • New posts or comments by users.
  • Private messages sent to the bot.
  • Replies to the bot's posts.
  • Replies to the bot's comments.
  • Mentions of the bot's username.

Processing all of these events is as as simple as implementing a method to receive them!

graw also provides two lower level packages for developers to tackle other interactions with Reddit like one-shot scripts and bot actions. See subdirectories in the godoc.

API Promise

As of version 1.0.0, the graw API is stable. I will not make any backwards incompatible changes, ever. The only exceptions are:

  • I may add methods to an interface. This will only break you if you embed it and implement a method with the same name as the one I add.
  • I may add fields to the Config struct. This will only break you if you embed it and add a field with the same name as the one I add, or initialize it positionally.

I don't foresee anyone having a reason to do either of these things.

graw's People

Contributors

atrox avatar bogatuadrian avatar bravecorvus avatar gastrodon avatar hinsley avatar michaelshobbs avatar stefanoj3 avatar tdakkota avatar turnage avatar ultralight-meme avatar wpwilson10 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.