Telegram bot will show GitHub statistic by languages, stars and forks. Written on GO.
- Download githubstatbot
- You need to talk with BotFather and follow the few simple steps for the register Telegram bot. So you will get access token(GITHUBSTATBOT_TELEGRAMTOKEN)
- Go to GitHub OAuth App and create the new OAuth Apps. You will get
Client ID
(GITHUBSTATBOT_GITHUBCLIENTID) andClient Secret
(GITHUBSTATBOT_GITHUBCLIENTSECRET) - Export the environment variables, from the previous steps and start the application:
# Required environment variables
# telegram token, like: 47174:342lt;j34;lkgj;l3kgj
$ export GITHUBSTATBOT_TELEGRAMTOKEN=
# see to github account settings, like: b2fb4db59dj20g8d92d2
$ export GITHUBSTATBOT_GITHUBCLIENTID=
# see to the github account settings, like: 96d687e72c049sku1lf5567ca810cd09eaacbe6
$ export GITHUBSTATBOT_GITHUBCLIENTSECRET=
# Not required environment variables
# port, like: 8080
$ export PORT=
# database URL, like: postgres://postgres:password@localhost:5432/githubstatbot?sslmode=disable
$ export DATABASE_URL=
# static files directory, default: ./static
$ export GITHUBSTATBOT_STATICFILESDIR=
# basic auth username, default: username
$ export GITHUBSTATBOT_AUTHBASICUSERNAME=
# basic auth password, default: password
$ export GITHUBSTATBOT_AUTHBASICPASSWORD=
$ ./githubstatbot
$ go build
$ export PORT=port
$ export DATABASE_URL=database_url
$ export GITHUBSTATBOT_TELEGRAMTOKEN=telegram_token
$ export GITHUBSTATBOT_GITHUBCLIENTID=github_client_id
$ export GITHUBSTATBOT_GITHUBCLIENTSECRET=github_client_secret
$ ./githubstatbot
You MUST NOT forget to insert the environment variables in command.
Start bot only inline prompt command
$ docker build -t githubstatbot:latest .
$ docker run --rm -p 8080:8080 \
-e PORT='8080' \
-e DATABASE_URL='' \
-e GITHUBSTATBOT_TELEGRAMTOKEN='' \
-e GITHUBSTATBOT_GITHUBCLIENTID='' \
-e GITHUBSTATBOT_GITHUBCLIENTSECRET='' \
--name githubstatbot githubstatbot:latest
$ docker run --rm -p 8080:8080 \
-e PORT='8080' \
-e DATABASE_URL='' \
-e GITHUBSTATBOT_TELEGRAMTOKEN='' \
-e GITHUBSTATBOT_GITHUBCLIENTID='' \
-e GITHUBSTATBOT_GITHUBCLIENTSECRET='' \
-e GITHUBSTATBOT_DBPATH='/app/data/database.db' \
--mount=type=bind,source="$(pwd)"/data,target=/app/data \
--name githubstatbot githubstatbot:latest
See bot output information.
- statistics by commits by week, quarter and year;
- support the notifications of user activities (statistics by commits) at the end of the week, quarter and year;
- increase the test coverage;
- add the internalization;
- change method of receiving messages from the Telegram servers, from polling to the webhook.
You are welcome!