Copy of NaaiveBot, but this time written in Go.
You need Go, ngrok and curl as well installed in your system for this to work
- Fork/Clone this repo.
- Run
git clone link-to-repo.gitto clone this repo locally. - Run
cd beepstarbot-go- to go to the repo folder. - Run
go getto install dependencies. - Create a new bot using BotFather and get your BOT_TOKEN.
- Copy .env.example file to .env and add BOT_TOKEN & SENTRY_DSN(this is optional, leave this empty if you want but Sentry is a nice tool to log errors in production.)
- Run
go run main.go(Bot is now running) - Run
ngrok http 3000(Firstcdinto the directory where you installedngrokthen run this command) - You'll see some public URLs after running the previous command.
- URLs will look like this
https://<some_code>.ngrok.io(notice https), copy the URL which havehttps. - Now run the following command
curl -F "url=https://<some_code>.ngrok.io/" https://api.telegram.org/bot<your_api_token>/setWebhookThis will let telegram know that our bot has to talk to this url whenever it receives any message.
- Now your bot ready to kick members.
Note: When you are done testing or if you restart ngrok then run the following command
curl https://api.telegram.org/bot<your_api_token>/deleteWebhookThis will reset the webhook url.
- This article helped a lot.
- Golang bindings for the Telegram Bot API
- Telegram API Docs
- Please file bugs and send pull requests to the GitHub Repository and issue tracker.
- Don't be afraid to open half-finished PRs, and ask questions if something is unclear!
- No contribution is too small! Please submit as many fixes for typos and grammar bloopers as you can!
- Try to limit each pull request to one change only.
- For help and support please reach out to us on Slack.