A bot that checks if KHub is slow and tweets it.
See it LIVE!
·
Report Bug
·
Website
Table of Contents
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.)
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
- Node.js
- Twitter API v2
- UptimeRobot API
- Replit database
- 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
, andAccess 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
- Create a new Twitter account
- Go to https://developer.twitter.com/en/application and apply for a developer account by following the instructions given
- 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.
- 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".
- 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
andAPI key secret
values. - Press "Generate" on the "Access token & secret" part and copy your
Access token
andAccess token secret
values.
- Press "Regenerate" on the "API key & secret" part and copy your
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
- Fixed bug that wrongly placed
newData[i]
rather thannewData[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!
- 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.)
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 |
Xyrus Kurt Roldan
- Twitter: @xy_rus
- Project link: https://github.com/xyr11/iskhubslow
Distributed under the MIT License. See LICENSE
for more information.
- Replit for the bot hosting
- UptimeRobot API for data fetching
- @IsKHubDown for the original idea