Giter VIP home page Giter VIP logo

redditmentionbot-temlate's Introduction

Reddit MentionBot-Template

Snoowrap mention messaging queue

Table of Contents

About

This is a template for a Reddit bot in JavaScript. It uses Snoowrap with two requesters, one to create a messaging queue, and another to process the mentions. If you've tried using Snoosorm to generate a stream from your inbox before, you may have run into a problem, where there is a need to utilize multiple requesters to complete API transactions. Well the fix is a messaging queue! This bot template is a simplified version of the ever popular Snoostorm library. It contains a messaging queue function (that Snoostorm was lacking!) to get around the problem of requiring many requesters.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

This application runs on NodeJS. You must have NodeJS to run it.

Installing

A step by step series of examples that tell you how to get a development env running.

Download the source code...

Run this command...

npm install

Of course you will find these values at https://www.reddit.com/prefs/apps/

USER_AGENT=''
CLIENT_ID=''
CLIENT_SECRET=''
REDDIT_USER=''
REDDIT_PASS=''

And begin coding your bot!

Usage

Open up the file: src/service/BotService.js

Write your functions in this file, put your code within doSomething().

doSomething() will be called each time a new mention is received.

It will be passed a pre-fetched comment object, from your inbox.

doSomething() must return a Promise Object. The resulting function doesn't actually do anything with it, but to complete the promise chain, it is required.

redditmentionbot-temlate's People

Contributors

bwz3rbot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

redditmentionbot-temlate's Issues

Unhandled rejection TypeError: Cannot read properties of undefined (reading 'created_utc')

After adding in the environment variables and running the program, it yields this error:

Unhandled rejection TypeError: Cannot read properties of undefined (reading 'created_utc')
    at assignFirstUTC (path\to\project\src\util\inboxStreamGenerator.js:41:44)
    at tryCatcher (path\to\project\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (path\to\project\node_modules\bluebird\js\release\promise.js:547:31)
    at Promise._settlePromise (path\to\project\node_modules\bluebird\js\release\promise.js:604:18)
    at Promise._settlePromise0 (path\to\project\node_modules\bluebird\js\release\promise.js:649:10)
    at Promise._settlePromises (path\to\project\node_modules\bluebird\js\release\promise.js:729:18)
    at _drainQueueStep (path\to\project\node_modules\bluebird\js\release\async.js:93:12)
    at _drainQueue (path\to\project\node_modules\bluebird\js\release\async.js:86:9)
    at Async._drainQueues (path\to\project\node_modules\bluebird\js\release\async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (path\to\project\node_modules\bluebird\js\release\async.js:15:14)
    at processImmediate (node:internal/timers:464:21)

I have changed nothing in the project aside from adding the file "pw.env".

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.