/iskhubslow

the IsKHubSlow API (the twitter bot has its own repo at xyr11/iskhubslow-twitter!)

MIT LicenseMIT

License Bot status Uptime ratio Twitter


@IsKHubSlow profile picture

A bot that checks if KHub is slow and tweets it.
See it LIVE! · Report Bug · Website


Table of Contents
  1. About the Project
  2. Getting Started
  3. Changelogs
  4. Development status
  5. License
  6. Author
  7. Acknowledgements

About the Project

IsKHubSlow is a bot that checks if KHub is slow based on its response time and tweets it, inspired by the idea of @IsKHubDown on Twitter. Open-sourced here on GitHub! (Not affiliated to KHub or PSHS.)

Planned Features

For starters, here's what I plan to do:

  • Request data from an API that checks for response times
  • Determines if current response time is slow using historical data and statistics
  • Condense information and tweets the results
  • I also tweet routinely every 4 hours about current statuses of KHub

Built With

  • Node.js
  • Twitter API v2
  • UptimeRobot API
  • Replit database

Getting Started

Prerequisites

  • Twitter Developer account (you can apply for one here)
  • A Twitter developer app, which can be created in your Twitter developer account.
  • "Read and Write" permissions to your app (Project Settings > App permissions)
  • Your API key, API key secret, Access token, and Access token secret from your app in the Twitter developer portal
  • Node.js
  • npm (This is automatically installed with Node)

Note: I'm temporarily using Replit's database for the storage of the bot, so the code only works in a Replit environment.

Click for detailed instructions relating to all things Twitter bot account related
  1. Create a new Twitter account
  2. Go to https://developer.twitter.com/en/application and apply for a developer account by following the instructions given
  3. Go to the Developer dashboard at https://developer.twitter.com/en/portal/dashboard and create a project. When you create a project, you should also be able to create an app.
  4. Go to the app that you created and go to its app settings. Go to "App permissions", click edit, and choose "Read and Write" so that your account will be able to 'write' tweets. Press "Save".
  5. Go back to the app settings and navigate to the "Keys and tokens" part (below your app name).
    • Press "Regenerate" on the "API key & secret" part and copy your API key and API key secret values.
    • Press "Generate" on the "Access token & secret" part and copy your Access token and Access token secret values.

Installation

I'm temporarily using Replit's database for the storage of the bot, so the code only works in a Replit environment. An installation guide will be available after I switch for a better database

Changelogs

Beta 0.2

  • Fixed bug that wrongly placed newData[i] rather than newData[0] and other variable declaration problems that I didn't review much because I'm trying to speedrun finishing Beta 0.1
  • More robust code for determining if KHub is 'slow' by outliers and a bunch of statistics-related terms nobody cares about
  • An insane amount of brain wracking and code editing for the part that deletes outliers when it detects that the current response time is too small and far away (it's hard.)
  • More optimization, made repetitive commands in their own functions (basically made the code short and dense)
  • Updated website layout to reflect data from this README file (because no one will probably visit this)
  • Made in line with JavaScript Standard Style because, I mean, it's cool following a standard!

Beta 0.1

  • Finally a version that can stay up 24/7 without major errors, can store stuff in a database, can read and detect stuff, basically the basic functions of the bot! (except, of course, it's very VERY buggy.)

Development status

Status Description
Start the project, figuring out a plan on how to do it, pick essential modules
Build system that receives data, stores in database, tweets in certain times
How to figure out if the response time is above "average", condense the results, error mitigation, automation system
🟡 Beta period, run the code, debug if there are any errors, ask for feedback, repeat
v1 launch, replit hosting, better database system
Version that can be run locally anywhere

Author

Xyrus Kurt Roldan

License

Distributed under the MIT License. See LICENSE for more information.

Acknowledgements