Skip to content

Automatically detects new posts made on Reddit that match the specified queries and are in the specified subreddits, and sends them to Discord.

Notifications You must be signed in to change notification settings

eric-lu-VT/DEPRECATED-Reddit-Discord-Alert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PROJECT IS DEPRECATED; SEE NEW VERSION HERE

Reddit-Discord-Alert

Automatically detects new posts made on Reddit that match the specified queries and are in the specified subreddits, and sends them to Discord.

Impressions

img img

Overview

This bot primarily uses the Discord API (through discord.js) and the Reddit API (through snoowrap), in conjuction with a MongoDB for the backend (through mongoose). Here is a pseudocode outline of how the bot works:

  • On login, initialize commands to Discord API and begin infinite timer
  • Every 30 seconds
    • For each Discord server Bot is in
      • Search for the specified query in the specified subreddit in the past hour for all search entries attributed to the given server
        • Check database if the query has been searched for, and from the current server.
          • If yes, do nothing (if the database has the entry, it means it has been searched for from the current server already)
          • If no, send the query to Discord, and send the query to the database with an expiration date of one hour
  • Constantly listen for commands/events
    • If user runs comamand ( /ping or /addchannel or /removechannel or /addquery [query] [subreddit] or /removequery [query] [subreddit]), respond appropriately
    • If Bot is added to new server, add the corresponding server info to the database
    • If Bot is removed from a server, remove the corresponding server info from the database

Commands

  • /ping: Replies with pong!
  • /addchannel: Allows the bot to post in the channel in which the command was sent.
  • /removechannel: Revokes the bot's access to post in the channel in which the command was sent.
  • /addquery [query] [subreddit]: Tells the bot to search for the specified query in the specified subreddit, if such an entry does not already exist. (Subreddit is last space separated keyword provided; defaults to "all" if only one space separated keyword provided.)
  • /removequery [query] [subreddit]: Tells the bot to stop searching for the specified query in the specified subreddit, if such an entry does already exist. (Subreddit is last space separated keyword provided; defaults to "all" if only one space separated keyword provided.)

Public Version Installation

No longer avaiable due to project deprecation. (See new updated version, as listed above, for a new working version.)

Self-Hosting Installation

See here for instructions on how to self-host this bot.

Roadmap

  • Add compound indexing to reduce time complexity of database search from O(n) to O(1)
  • Add manual start/stop (requires multithreading)

See new version, as listed above, for new updates (including these fixes)

About

Automatically detects new posts made on Reddit that match the specified queries and are in the specified subreddits, and sends them to Discord.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published