Giter Club home page Giter Club logo

discord-uptime-pinger's Introduction

Website Monitoring Bot

Pinger, a website pinger discord bot

Overview

The Website Monitoring Bot is a simple yet powerful tool designed to keep track of the availability of a specified website. It periodically sends requests to the target URL and reacts accordingly by sending colour-coded messages to indicate the status: green for up, orange for potential issues, red for confirmed downtime, and blue for maintenance mode.

Built with

  • The bot is built with Discord.js v14 using JavaScript
  • Uses Axios to ping the site

Features

  • Request Monitoring: Regularly checks the specified website's availability.
  • Color-Coded Messages: Responds with different color-coded messages based on the website's status.
  • Automatic Reaction: Takes action based on the website's status after a series of consecutive requests.
  • Maintenance Mode: Allows you to manually set the bot to maintenance mode, temporarily stopping the requests.
  • Config file: Easy to edit config file

Setup

  1. Clone the repository:

    git clone https://github.com/IPQow/discord-uptime-pinger
    cd discord-uptime-pinger
  2. Install dependencies:

    Since this bot is written in JavaScript, ensure you have Node.js installed. You can install the required dependencies using:

    npm install
  3. Configure the bot:

    Open the config.js file and update the following parameters:

How to Edit the Config File

To customize the bot's configuration, follow these steps:

  1. Open the config.js file in a text editor.

  2. Modify the following parameters:

    • TOKEN: 'BOT_TOKEN', // Your Discord bot token
    • URL_TO_PING: 'URL_TO_PING', // The URL of the website you want to monitor
    • STATUS_CHANNEL_ID: 'MAIN_STATUS_CHANNEL_ID', // Discord channel ID to send the status messages to (public)
    • LOG_CHANNEL_ID: 'LOG_CHANNEL_ID', // Discord channel ID to send log messages to (private)
    • MAINTENANCE_USER_ID: 'USER_ID', // Discord user ID that can activate/deactivate maintenance mode
    • SERVICENAME: 'Example', // Name of the service being monitored
    • STATUSPAGE: 'https://status.example.com/', // URL to the service's status page
    • PINGTIME: '300000', // Time in milliseconds between each ping (default: 300000 - 5 minutes)
    • ORANGETRIES: 3, // Number of consecutive pings triggering an orange status message
    • DOWNTRIES: 10, // Number of consecutive pings confirming service downtime and triggering a red status message
    • GREEN: 'https://github.com/IPQow/discord-uptime-pinger/blob/main/assets/online.png?raw=true', // URL to the green status image
    • RED: 'https://github.com/IPQow/discord-uptime-pinger/blob/main/assets/offline.png?raw=true', // URL to the red status image
    • BLUE: 'https://github.com/IPQow/discord-uptime-pinger/blob/main/assets/maintenance.png?raw=true', // URL to the blue status image
    • ORANGE: 'https://github.com/IPQow/discord-uptime-pinger/blob/main/assets/maybe.png?raw=true', // URL to the orange status image
  3. Save the changes.

Screenshots

Embed guide Embed guide

Online embed - Green Online embed - Green

Potential issues embed - Orange Potential issues embed - Orange

Offline embed - Red Offline embed - Red

Maintenance mode enable - Blue Maintenance mode enable - Blue

Maintenance mode disable - Blue Maintenance mode disable - Blue

Maintenance mode message showcase - Blue Maintenance mode message showcase - Blue

Logs when service initially stops responding Logs when service initially stops responding

Usage

  1. Start the bot:

    node uptime.js
  2. Interact with the bot:

    • Type "maintenance" followed my a reason to activate maintenance mode. (e.g. "maintenance upgrading versions")
    • The bot will automatically respond with appropriate messages based on the website's status.

Example Messages

  • Green Message: "The website is up and running smoothly."
  • Orange Message: "The website may be experiencing issues. Checking again..."
  • Red Message: "The website is down. Confirming the issue..."
  • Blue Message: "Maintenance mode activated. The service is currently undergoing maintenance."

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests to enhance the bot's functionality or fix any issues.

License

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

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.