Skip to content

A Telegram bot designed to protect sensitive images by adding watermarks

License

Notifications You must be signed in to change notification settings

luqmanhy/tg-watermarker-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telegram Watermarker Bot

Protect sensitive images with watermarks

FeaturesDeploymentUsageCredits

Watermarker Demo


Overview

A Telegram bot that helps protect sensitive images by adding customizable watermarks. It ensures that your sensitive images remain confidential and secure from unauthorized use, making it an ideal tool for safeguarding your images.

Features

  • Customizable: Offers flexible customization options for text size, opacity, and designs to suit your preferences.
  • Watermarking: Automatically adds a watermark to images based on the user's configuration.
  • Delete Original Photos: Automatically delete the original images after watermarking.

Deployment

Telegram Setup (required)

  1. Open Telegram and search for @BotFather.
  2. Start a chat and send /newbot.
  3. Choose a name and username for your bot.
  4. Receive and save the Bot Token provided by BotFather.

Deployment on Render

Render provides a cloud hosting solution that simplifies application deployment without the need for server management. Follow these steps to deploy the bot on Render:

  1. Go to Render and log in to your account.
  2. Click "+ New" > Web Service
  3. Choose Source Code > Existing Image
  • Image URL : luqmanhy/tg-watermarker-bot
  1. Click Connect
  2. Configure the service:
  • Add an environment variable:
    • Key: TELEGRAM_TOKEN
    • Value: Your Telegram Bot Token from BotFather.
  1. Click Deploy Web Service to deploy

Manual Deployment

If you prefer to deploy the bot on your own server, you can do so using the following methods:

Using Docker

  1. Clone the repository:
git clone https://github.com/luqmanhy/tg-watermarker-bot.git  
cd tg-watermarker-bot 
  1. Set up the .env file with your Telegram Bot Token:
cp .env.example .env 
  1. Build and run the Docker container:
docker build -t tg-watermarker-bot .  
docker run --name watermarker --env-file=.env -it tg-watermarker-bot 

Manual Deployment (Without Docker)

  1. Clone the repository:
git clone https://github.com/luqmanhy/tg-watermarker-bot.git  
cd tg-watermarker-bot  
  1. Set up the .env file with your Telegram Bot Token :
cp .env.example .env  
  1. Install the required Python packages:
pip install -r requirements.txt 
  1. Run the application:
python3 app/app.py  

Setting up the Webhook

Once the bot is running, you need to set up a webhook so Telegram can communicate with your bot:

  1. Determine the URL of your hosted bot. For Render, it will be something like https://your-app-name.onrender.com.
  2. Use the following command to set up the webhook:
curl -X POST "https://api.telegram.org/bot<YOUR_BOT_API_TOKEN>/setWebhook" -d "url=<YOUR_BOT_URL>"  

Replace <YOUR_BOT_API_TOKEN> with your bot token and <YOUR_BOT_URL> with your deployed bot URL.

  1. Verify the webhook setup:
curl "https://api.telegram.org/bot<YOUR_BOT_API_TOKEN>/getWebhookInfo"  

Ensure the response includes your bot URL and indicates that the webhook is set. 4. Test the bot by sending a message or image to ensure it works as expected.

Usage

  • Watermarking: When a photo is received with a caption, the bot adds the watermark based on the user's settings.
  • Customize : /set commands allow users to update settings like size, opacity, space, and angle for watermarks.

Customize options

Users can customize the following settings:

  • size: Font size for watermark text.
  • color: Color of the watermark text.
  • opacity: Opacity of the watermark.
  • space_x and space_y: Horizontal and vertical
  • spacing between watermarks.
  • angle: Rotation angle of the watermark.

Examples

/set size 50 - Set the watermark font size to 50.
/set opacity 0.5 - Set the opacity of the watermark to 0.5.

Credits

Contributing

We welcome contributions! Feel free to submit Pull Requests or report Issues.

Licensing

This utility is licensed under the MIT license. You are free to use, modify, and distribute it, as long as you follow the terms of the license. You can find the full license text in the repository - Full MIT license text.

About

A Telegram bot designed to protect sensitive images by adding watermarks

Resources

License

Stars

Watchers

Forks

Packages

No packages published