# Gas Notifier Bot

By [Will Hunter](https://paragraph.com/@willhunter) · 2021-12-02

---

During Thanksgiving break, I wanted to ape into a few projects (shoutout Koop and vibes.art) but was reluctant to do anything because of outrageous gas fees. I found myself constantly checking etherscan to see the latest gas prices, which was super annoying. I just wanted to be told once gas hit a reasonable price so that I could make my purchase/whatever I wanted to do).

Although I know you can set a custom gas limit on Etherscan, I am always a little tentative to do this because I don’t want the transaction to fail.

That’s where my gas notifier bot comes in. You set a maximum level that you are comfortable handling a transaction at in Discord, and you will receive a DM once gas dips below that price.

This way, you can find a cool project, set a gas alert, and run the transaction once you get the DM!

![Setting an alert in a server](https://storage.googleapis.com/papyrus_images/1080c1d8ebc4503abad8cee58303d12271f1fabe5973b1550ea83264b074b92d.png)

Setting an alert in a server

![Alert over DMs](https://storage.googleapis.com/papyrus_images/4f914233ca46e68d11ffbbce4b761aaa07d75d256d13b64fdff0d612917ae82b.png)

Alert over DMs

How to Use It
-------------

### Adding the Bot

Use the link below to add the bot to a server (you need admin privileges to do this). The bot requires specific permissions to work, which it will request through the link.

[https://discord.com/api/oauth2/authorize?client\_id=913226328080265286&permissions=2147552320&scope=bot%20applications.commands](https://discord.com/api/oauth2/authorize?client_id=913226328080265286&permissions=2147552320&scope=bot%20applications.commands)

### Discord Server

Join the dedicated Gas Alert server! You can learn more about the bot, request new features and help, set alerts, and use any of the commands! Feel free to join the server to use the bot.

[https://discord.gg/3zrsKhHnhN](https://discord.gg/3zrsKhHnhN)

### Direct Messaging

The bot will message you once the alert is triggered (gas dips below your alert threshold). You can also direct message the bot over Discord to utilize the full functionality.

### Commands

The bot is built off of slash commands, which means that their commands can be triggered by a “/’. These can be activated in a server that the bot is in or over DMs.

**List of Commands**

*   **/setalert** _gas level_ (set an alert for a specific gas level to receive a DM)
    
*   **/removealert** _gas level_ (remove an alert that you sent)
    
*   **/listalerts** (see what alerts that you have already set)
    
*   **/gas** (see what the current gas price is)
    

How It Works (behind the Scenes)
--------------------------------

Every time a person registers an alert, their username (user object) is inserted in the corresponding gas alert object on MongoDB.

Every 20 seconds, the bot pulls the recommended priority, normal, and slow gas levels from the Etherscan Gas API. It then takes the normal gas level and searches every alert that is less than or equal to that GWEI, then the person will receive a DM from the bot and their name will be removed from the gas alert object. The bot will then update its activity with the current gas price.

Quick Plug
----------

[https://twitter.com/wlhunter25](https://twitter.com/wlhunter25)

---

*Originally published on [Will Hunter](https://paragraph.com/@willhunter/gas-notifier-bot)*
