Last active
March 18, 2025 08:14
A dead simple script to upload files on your server through Telegram bot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This is a simple script that takes some files as arguments and sends them to a special chat | |
# Just create a new bot at @BotFather and get your chat ID from @myidbot and enter them here | |
# You can also make a shortcut in '~/.bashrc' like "alias tg='bash /opt/scripts/tg.sh'" | |
# After that restart bash and use it like 'tg file1.txt file2.jpg' | |
# EDIT TOKEN and CHAT_ID: | |
TOKEN="TOKEN" | |
CHAT_ID="12341234" | |
# Make sure curl is installed | |
for arg in "$@" | |
do | |
curl -X POST -H "content-type: multipart/form-data" -F document=@"$arg" -F chat_id=$CHAT_ID https://api.telegram.org/bot$TOKEN/sendDocument | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment