Skip to content

chasersmith/image-backup-bot

Repository files navigation

Image Backup Bot

Discord bot that automatically backs up image/video links to Imgur based on base URLs provided for the bot to look for. The purpose of this Discord bot would be to back up image or video links that are posted that may not be retained by their host because of post expiration or deletion. Works with all Imgur supported formats which includes all standard image formats.

Installing

To clone and run this bot application, you'll need Git and Node.js

In the command line:

# Clone repository
$ git clone https://github.com/Freemann098/image-backup-bot

# Navigate to the repository directory
$ cd image-backup-bot

# Install dependencies
$ npm install

# Set environment variables in a .env file as described below
# Run the app
$ npm start

Note - Procfile is used for Heroku cloud paltform to host bot if you wanted to host on Heroku, otherwise, this file can be ignored

Environment Variables

This project uses dotenv for the environment variables. The following environment variables will need to be set in a .env file in order for the bot to run properly.

  • DISCORD_CLIENT_ID - Your Discord API application client ID
  • DISCORD_TOKEN - Your Discord API bot token
  • IMGUR_CLIENT_ID - Your Imgur API application client ID

Slash Commands

This bot uses Discord's slash commands for executing bot commands. After environment variables are set, you will need to run node deploy-commands.js to load the slash commands. This will have to be done everytime you add/edit slash commands. Per the Discord API, global slash commands can take up to an hour to update.

Usage

Once the node app is running, you will need to invite the bot to your Discord server using the following link, replace client_id with your bot's client ID.

https://discord.com/api/oauth2/authorize?client_id=1234567890&permissions=2147568640&scope=bot%20applications.commands

When this bot is running on a Discord server, it comes with 4 slash commands

  • /addurl URL - Adds URL to check for to backup images from that site. Example - /addurl i.redd.it will make sure any image link posted from Reddit in the Discord server will be backed up to Imgur
  • /removeurl URL - Removes URL to check for
  • /listurls - Lists added URLS
  • /backup IMAGE_URL - Onetime force backup specific image link to Imgur

Built With

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

Discord bot that will automatically backup images to Imgur based on provided base URLs

Topics

Resources

License

Stars

Watchers

Forks