Giter Site home page Giter Site logo

0reddit's Introduction

๐ŸŒ 0reddit

NPM version

A small extension of snoowrap with some simplified reddit API functions.

Screenshot

๐Ÿ“ฅ Install

npm i 0reddit

๐Ÿ Use

const snoowrap = require("snoowrap");
const $reddit = require("0reddit");

const requester = new snoowrap({
  /* OAuth credentials here */
});
const $subreddit = $reddit(requester, "SomeSubreddit");

// Submit a link
const submission = await $subreddit.submitLink({
  title: "Wracurd",
  url: "https://example.com/wracurd.jpg",
  oc: true,
  flairs: ["artwork", "comic", "color"],
});

// Get own newest submission
const myLatestSubmission = await $subreddit.getNewByMe({ one: true });

๐Ÿ“• API

  • reddit(requester, subredditName) : Create an object containing the functions.

    • requester: snoowrap : Snoowrap requester object.
    • subredditName: String : Subreddit name (without r/ prefix).
  • await submitLink(post) : Submit a link post.

    • post: Object : Object describing a link post.
      • title: String : post title.
      • url: String : post link.
      • oc?: Boolean : If true, mark post as OC.
      • flairs?: String[] : Texts of flairs to assign to post.
  • await getNewByMe(options) : Get own new submissions.

    • options?: Object: Options object.
      • one?: Boolean : If true, return the first submission object (Instead of Array).
      • limit?: Number : Maximum number of submissions to retrieve.
  • await markAsOC(submission) : Mark a submission as OC.

  • await applyFlairs(submission, flairsTexts) : assign flairs to a submissions.

    • submission: Submission : Snowrap submission.
    • flairsTexts: String[] : Array of flairs texts.

๐Ÿ“ƒ License

MIT ยฉ Ambratolm

0reddit's People

Watchers

 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.