tgbot

command
v0.0.0-...-5f2f827 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2023 License: MIT Imports: 20 Imported by: 0

README

Telegram Bot

Local development

go run *.go -tg-bot-token "<token>" \
            -mongo-uri "mongodb+srv://<user>:<pasword>@<cluster>/?retryWrites=true&w=majority" \
            -db-namespace "dev" -tg-bot-debug "true"
Using dotenv
# copy .env.example to .env
cp .env.example .env
# edit .env file with the correct values

# run the bot
go run *.go

Deployment

Manual
# run the following commands from the current directory (tgbot)

# build docker image
docker build -t eq-tg-bot .

# run docker container
docker run \
            -e TELEGRAM_BOT_TOKEN="14...w" \
            -e MONGO_URI="mongodb+srv://.../?retryWrites=true&w=majority" \
            -e DB_NAMESPACE="dev" \
            -e TG_BOT_DEBUG="true" \
            --restart=always eq-tg-bot:latest
Fly.io

Install flyctl.

# run the following commands from the root directory

# log in with your account
flyctl auth login

# set app name
export APP_NAME=eq-tg-bot

# launch the app
fly launch --path tgbot --region ams --copy-config --remote-only --no-deploy --name $APP_NAME  

# set app secrets 
flyctl secrets set TELEGRAM_BOT_TOKEN="<token>" \
                   MONGO_URI="<mongo-db-uri>" -a $APP_NAME 

# deploy
fly deploy --dockerfile tgbot/Dockerfile -a $APP_NAME        

# if deployment fails, try to restart it
fly scale count 0 -a $APP_NAME
fly scale count 1 -a $APP_NAME

# test deploy (run from root directory)
fly deploy --build-only --no-cache --config tgbot/fly.toml

Check the official documentation.

Bot Father configuration

Name

Earthquake Events ⚠️

Description

It makes you able to receive notifications of recent earthquakes by making subscriptions configured with parameters such as magnitude, location, and observing radius.

Commands
start - Starts the home screen
list - Lists current subscriptions

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL