This Telegram bot is designed to facilitate the process of uploading files from Telegram chats to a Nextcloud instance. It uses Telegraf, Express, Axios, and the Nextcloud Node.js client libraries to accomplish this task.
- File Uploading: Send a file, photo or video file to the bot via Telegram.
- Nextcloud Integration: Automatically uploads the file to a specified Nextcloud instance.
- Data Security: Deletes the uploaded data locally and from the Telegram chat using the Telegram API after successful upload to Nextcloud.
Before running the bot, ensure you have the following:
- Node.js installed on your system
- Telegram bot token obtained from BotFather on Telegram
- Nextcloud instance details (URL, username, password)
- Node.js libraries: Telegraf, Express, Axios, and Nextcloud Node.js client
-
Clone the repository:
git clone https://github.com/DanonekTM/TTNC.git
-
Install dependencies:
cd TTNC npm install
-
Set up configuration:
Rename the
.env.example
to.env
file and change the valuesPORT=5000 TOKEN=YOURTELEGRAMTOKENHERE SERVER_URL=https://example.com/ NEXTCLOUD_USERNAME="USERNAME" NEXTCLOUD_PASSWORD="PASSWORD" NEXTCLOUD_URL="https://cloud.example.com" DOWNLOADS_PATH="/PATH/TO/DOWNLOADS/FOLDER"
-
Run the bot:
npm run start
- Start a conversation with the bot on Telegram.
- Send a file you want to upload to the Nextcloud instance.
- The bot will download the file locally, upload it to Nextcloud, and then delete the data locally and from the Telegram chat.