A bot to alert a role when Ethereum's GAS price drops below a specified value.
Invite here: coming soon
The GasWatch bot is built to watch Ethereum's gas price and act accordingly based on values defined by its config. The
bot will take the value defined by cooldown
and gasvalue
and ping users who have a certain role whenever the API
returns a value below gasvalue
, as long as it is occurring after the time defined by cooldown
has passed.
The GasWatch bot is built with Discord.js V13. It uses Axios for the API requests.
The value for Ethereum's current GAS used for the alerts, and the values used for the gas tracker in the activity
section
and for the alerts
are fetched from https://docs.spice.xyz/api/ethereum/gas-fees
Invite the bot here: coming soon
If you would like to host your own local version, you can follow the steps below. Please note that the self-hosted version is different to the public one hosted. The self-hosted version is built to be used on one specific server while the public version is built for hundreds of servers to use at once.
- Node.js
- NPM
- Clone the GitHub repo
git clone https://github.com/Adamt20054/GasWatch.git
-
Make sure you have the latest Node.js and NPM version installed and then go into the folders directory, open a terminal and install the packages required in
package.json
by doingnpm install
Your
node_modules
folder should populate after NPM has installed the packages it needs. If you get an error, make sure you are in the right directory (The same directory as the package.json) and try deletingpackage-lock.json
if the error continues. -
Get a bot token by creating an application at https://discord.com/developers/applications
- Make sure you enable the "message content" intent to use the commands.
-
Paste the token into
/src/Data/config.json
in the "token" value. -
Choose a prefix you want your bot to use, and then put it in the prefix value.
-
Grab the Channel ID of the channel you want users to be pinged in, and then put it in the "ChannelID" value.
-
Grab the Role ID of the role you want to be pinged, and then put it in the RoleID value.
-
Run the bot by going into the main directory and running
node index.js
Once the bot is running, and you have invited it to your server, you can use
{prefix}gasvalue {value}
to make the bot ping users when the GWEI is below that level. Eg, if you wanted users to be pinged when the GAS is below 70 GWEI, you'd do
-gasvalue 70
You can also change the time between pings so users don't get spammed using
{prefix}cooldown {value in ms}
The program checks the API every 15minutes, so without this cool-down the role would be pinged every 15 minutes. If you want the time between pings to be at least 1hour, you'd do
-cooldown 3600000
The cool-down command uses Milliseconds for the value given.
As default, the bot has a 1Hour cool-down and is triggered when the GWEI gas value drops below 200
Contributions are what make the open source community such an amazing place to be learned, inspire, and create. Any contributions you make are greatly appreciated.
- If you have suggestions for adding or removing projects, feel free to open an issue to discuss it, or directly create a pull request after you edit the README.md file with necessary changes.
- Please make sure you check your spelling and grammar.
- Create individual PR for each suggestion.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the GNU GPLv3
License. See LICENSE for
more information.
- Adam O'neill - A-level student - program developer.
- Pat - Code master who helps me solve issues <3