Skip to content

huynhducduy/binance-bot

Repository files navigation

Binance Bot

Require: bun

Build image

docker build . -t binance-bot

Run image

Port forward: PC_WEBHOOK_PORT = 3000 to 3001

docker rm -f binance-bot
docker run --init -dit -p 3000:3001 --name binance-bot binance-bot:latest

Stop

docker kill binance-bot

Deploy on Fly.io

Make sure internal_port match, currently using --local-only for faster build time, can switch to --remote-only

fly deploy --local-only && fly scale count 1

Config Telegram Bot

Deploy the bot with the supported port on ipv4: 443, 80, 88, 8443; Add a domain name; Add 149.154.160.0/20 and 91.108.4.0/22 to accept incoming subnet Add SSL/TLS support Make a POST request to https://api.telegram.org/bot<token>/setWebhook

async function setWebhook(token, url = "") {
  // Default options are marked with *
  const response = await fetch(`https://api.telegram.org/bot${token}/setWebhook`, {
    method: "POST",
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      url: url
    }),
  });
  return response.json();
}

TODO

  • Use Fly.io volume storage
  • Use elysiajs instead of fastify

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published