Categorygithub.com/kenjitheman/newsman
modulepackage
0.2.0
Repository: https://github.com/kenjitheman/newsman.git
Documentation: pkg.go.dev

# README

newsletter tg bot in golang

go logo

project structure:

.
├── bot
│   ├── bot.go
│   ├── keyboards.go
│   └── vars.go
├── Dockerfile
├── go.mod
├── go.sum
├── LICENSE
├── main.go
├── README.md
└── users.json

installation

git clone https://github.com/kenjitheman/newsman

usage

  • create .env file and inside you should create env variable with your api key:
TELEGRAM_API_TOKEN=YOUR_TOKEN
  • then you should uncomment commented lines in tg/tg.go \
    • ( ! you need uncomment commented lines only if you using this way !)
//"github.com/joho/godotenv"
// err := godotenv.Load("../.env")
// if err != nil {
// 	fmt.Println("[ERROR] error loading .env file")
// 	log.Panic(err)
// }
  • you need to add usernames(optional) and chatIDs to users.json file like this:
{
  "users": {
    "kenjitheman": 5785150199,
    "username": chatID,
    "optional_not_real_username": 3942049232
  }
}
  • run it
go run main.go
  • or build and run
go build
./newsman

you can also run it using docker

ENV TELEGRAM_API_TOKEN=YOUR_API_TOKEN
docker build -t your_image_name .
docker run -d -p 8080:80 your_image_name

contributing

  • pull requests are welcome, for major changes, please open an issue first to discuss what you would like to change

license

# Packages

No description provided by the author