Skip to content

kgbier/feed-spidey-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spidey Bot feed reader

Konrad Biernacki (kgbier@gmail.com)

A Discord webhook bot that posts updates from rss/atom feeds, designed to be compiled and deployed into AWS Lambda.

  • Dependency on AWS DynamoDB for per-feed record keeping

Usage

  1. Configure ./src/config/config.js with AWS DynamoDB Table and Region

  2. Configure ./src/config/updateChannels.js, ./src/config/webhookEndpoints.js, ./src/config/personalities.js with valid webhook and feed data (as covered in Overview)

  3. $ yarn build - Compiles with webpack into ./dist/bundle.js

  4. $ yarn deploy - Uploads to a specified lambda function using the aws-cli (uses ./deploy.sh)

Run

$ node run.js to run the es6 program

or

$ node run.bundle.js to run the minified/bundled program

Overview

  • config/webhookEndpoints.js

Describes a named collection of webhook endpoints.

{
  'spidey#totesnotrobots': {
    path: '/api/webhooks/ID/TOKEN',
  },
  ...
};
  • config/personalities.js

A named collection of webhook Personalities. Comprises a Name, Colour, Avatar image, Thumbnail image, and a Subscriber webhook endpoint.

NB: Colour is expressed in Integer format

{
  'personalityOne': {
    name: 'Personality Name',
    colour: 16765995,
    avatar: '.jpg',
    thumbnail: '.jpg',
    subscriber: 'spidey#totesnotrobots',
  },
  ...
}
  • config/updateChannels.js

Contains a list of Channels. A Channel comprises a feed URL, a transform to compose the Discord Embed object from an Article, and a Personality to post articles to.

Transform object is required to compliment discord Embed object as seen here.

[
  {
    name: 'Channel',
    description: 'Channel Description',
    personality: 'personalityOne',
    feedUrl: 'https://www.feeds.com/feed/',
    transformer: (article, personality) => {
      return {
        title: article.title,
        description: article.link,
        timestamp: article.date,
        color: personality.colour,
        footer: {
          text: VERSION_TEXT,
        },
      };
    },
  },
  ...
]