A simple telegram bot written in java for my personal use. Feel free to use if you want.
-
Java 11+
-
Maven
- Mirror bot (direct link, telegram files)
-
Add torrent download support
-
Beautify the progress message
-
Add To Do List remainder support
-
API_HASH
- Telegram API hash. Get here by login your telegram account. -
API_ID
- Telegram API ID. Get here by login your telegram account. -
BOT_TOKEN
- Your telegram bot token. Check here -
BOT_USERNAME
- Your telegram bot username. -
CREATOR_ID
- Your telegram user ID. There are some bots to know your user id. One of them - userinfobot or searchuserinfobot
in telegram. -
CREDENTIALS_FILE
- Yourcredentials.json
file direck link. -
GDRIVE_INDEX_LINK
- Your gdrive index link without trailing/
. Example -https://mirror.dhina17.workers.dev/0:
. There is a lot of gdrive index out there. Simply do a github search. -
HEROKU_API_KEY
- Go to your heroku account settings, You will get it. -
HEROKU_APP_NAME
- Name of your heroku app. -
HEROKU_EMAIL
- Your email id associated with your heroku account. -
OAUTH_TOKEN_FILE
- YourStoredCredential
file direct link. -
TDLIB_SESSION_FILE
- Yourtd.binlog
file direct link. -
TEAM_DRIVE_ID
- Your Gdrive shared drive ID if you are using shared drive. -
USE_TEAM_DRIVE
- true if you are using shared drive else set it to false.
-
Clone this repo to your local pc.
git clone https://github.com/Dhina17/DhinaBot
or Download this repo as zip and unzip -
Go to DhinaBot folder. In terminal , type the following commands
mvn clean package assembly:single
After compiled successfully, you will get the fat jar with name
dhinabot-$version-jar-with-dependencies.jar
in target folder.
-
Enable Google Drive API. Refer here
-
Open the Google API Console Credentials page
-
Click Select a project, then NEW PROJECT, and enter a name for the project, and optionally, edit the provided project ID. Click Create.
-
On the Credentials page, select Create credentials, then OAuth client ID.
-
You may be prompted to set a product name on the Consent screen; if so, click Configure consent screen, supply the requested information, and click Save to return to the Credentials screen.
-
Select Desktop app for the Application type, and enter any additional information required.
-
Click Create.
-
A dialog will be prompt with your client ID and secrets, Click Ok.
-
You can see the download button in the OAuth 2.0 Client IDs section, Click and download it.
-
Rename the downloaded file to
credentials.json
Reference : here
-
Place the credentials.json and the fat jar in the same directory
-
Run the jar
java -jar dhinabot-1.0-jar-with-dependencies.jar
-
Follow the instructions present in your screen.
-
After completing all the steps, you will get two folders named
tokens
andtdlib
-
Upload the following files to somewhere convenient for you and get the direct link
-
StoredCredential
fromtokens
folder -
td.binlog
fromtdlib
folder -
credentials.json
- Recommended to use Github gist
-
-
Fork this repo.
-
Go to heroku and create an account (skip this if you have an account already)
-
Add values for configs as Github Repository secrets
-
Go to Actions tab in the repository, Click Deploy CI present below the all workflows section.
-
On the right side, You will see a run workflow spinner. Click that and select
main
branch and click run workflow. -
Wait for 10 min, You will see a green tick. Finally, Bot deployed. (Make sure you have enabled the dyno in heroku for this app)
Feel free to open a Pull Request if you want to fix/update anything.
Feel free to create an issue if you have encounter any issues or want to tell some suggestions.
-
Rubenlagus for his awesome telegram bot library
-
Cavallium for his awesome tdlib java wrapper
-
Google for their DriveAPI.
DhinaBot - A simple telegram bot
Copyright (C) 2020-2022 Dhina17 <dhinalogu@gmail.com>
SPDX-License-Identifier: GPL-3.0-or-later