GithubHelp home page GithubHelp logo

gastracker's Introduction

Gas Tracker Discord Bot ⛽

Built with ❤︎ by Min Fam

A Discord bot that allows you to get the current Gas for cryptocurrency markets using Slash commands.

Bot Demo

📝 Table of Contents

🏁 Getting Started

Prerequisites

To run this project, you'll need to have:

  • Deno (version 1.34.3 or newer)
  • A Discord bot token, which you can get by creating a bot on the Discord Developer Portal
  • Discord.js 14
  • Typescript
  • An environment variable file (.env) for your bot token

Installing(Windows)

  1. Clone this repository:
git clone https://github.com/ziko3000/Fear-and-Greed-Index](https://github.com/ziko3000/GasTracker
  1. Change into the cloned repository:
cd your-repo-name
  1. Create an .env file in the root of your project and insert your bot token:
BOT_TOKEN=YourDiscordBotToken
APPLICATION_ID=YourApplicationId
ETHERSCAN_API_KEY = YourEtherscanAPIkey
  1. Run the bot:
deno task run_bot

Using PM2 to keep bot alive

PM2 is a process manager for Node.js applications with a built-in load balancer. It allows you to keep applications alive forever and reload them without downtime. It's perfect for production environments. Here are the steps to install it:

To install PM2 globally (available to all your Node.js/Deno projects), you can run:

npm install -g pm2

If you're facing permission issues, you may need to prepend sudo:

sudo npm install -g pm2

Congratulations! You've successfully installed PM2 on your Linux machine. Now, you can use the pm2 command to run your bot:

pm2 start pm2_config.json

🎈 Usage

This bot supports the following Slash commands:

  • /gas: Get Ethereum gas prices
  • /help: Get help about the bot and its commands.

⛏️ Adding Commands

To add a new command:

  1. Create a new command file in the commands folder, like mycommand.ts.
  2. Define your command as a class with name, description, and execute method.
  3. Import your command class in CommandHandler.ts and register it in the constructor.

For example:

import { MyCommand } from './mycommand';

// In CommandHandler constructor
this.registerCommand('mycommand', 'This is my command', (interaction) => new MyCommand().execute(interaction));

📄 License

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

gastracker's People

Contributors

ziko3000 avatar salemalem avatar

Watchers

 avatar

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.