TELESHARE
A efficient and configurable telegram file sharing bot
DEMO: BOT LINK
SUPPORT CHANNEL: THE HQ
- All available commands.
- CodeXbotz links compatibility.
- Fully asynchronous.
- In-built rate limiter.
- Multi-channel force subscription.
- Option Setup.
- Protect content.
- Database and Option refactor.
- Ban command.
- File rename command.
- Tokenized access.
Use: /help [command name]
for more informations.
/make_files
: Handles a conversation that receives files to generate an accessable file link./start
: Handle start command, it returns files if a link is included otherwise sends the user a request./broadcast
: Broadcasts a message to multiple subscribed users this command may take awhile depending on user count./option
: Use to configure database options. See bot options for more informations./delete_link
: Delete an accessible link from the database and delete the corresponding file from the backup channel.- Auto link generation: just forward or send a file directly to the bot.
/range_files
: Fetch files directly from backup channel to create a sharable link of ranged file ids.
FAQS
- How do i disable automatic deletation:
/option AUTO_DELETE_SECONDS 0
- Can I disable file backup? It depends on your use case. By default, the bot automatically grabs the files through the Telegram server. If you need to use the links in the future on another bot, backing up the files is mandatory.
.env / environ
You can set up the configuration using either a
.env
file or anenviron variable
. Please refer to the .env_example file as a reference. Don't forget to add[
and]
or brackets if required, as shown in the example file.
- API_ID
- API_HASH
- BOT_TOKEN
- MONGO_DB_URL = mongodb+srv
Bot Config
BOT_WORKER (int)
: amount of bot workers, default to 8.BOT_SESSION (int)
: bot session name, reads from bot directory.BOT_MAX_MESSAGE_CACHE_SIZE (int)
: amount of message to cache, recommended to cache more than a thousand if your bot is big enough due to scheduling. default to 100.
Main config
BACKUP_CHANNEL (int)
: file backup channel.ROOT_ADMINS_ID (list[int])
: bot admins.PRIVATE_REQUEST (bool)
: enable private request on private channel/group. default toFalse
.PROTECT_CONTENT (bool)
: disalllow forwarding and saving of files sent by the bot. default toTrue
.FORCE_SUB_CHANNELS (list[int])
: force subscription channels.AUTO_GENERATE_LINK
: toggle auto link generator when file is recieve directly. default toTrue
.
Bot options
-
FORCE_SUB_MESSAGE (str|int)
: message during force subscription. -
STARR_MESSAGE (str|int)
: a start message. -
AUTO_DELETE_MESSAGE (str|int)
: an auto delete messages, {} is the amount of minutes. -
AUTO_DELETE_SECONDS (int)
: auto deletion in minutes, is set as {} of AUTO_DELETE_MESSAGE. -
GLOBAL_MODE (bool)
: toggle everyone to generate a file link. -
BACKUP_FILES (bool)
: toggle all files to back up.
configure through /option
command or use /help option
for more information.
Usage:
/option key new_value
/option key [reply to a message]
Example:
/option AUTO_DELETE_SECONDS 600
/option FORCE_SUB_MESSAGE [reply to a message.]
Please edit the following "Environment Variable" for quick deployment
or create an ".env" for local deployment
and refer to .env_example for reference or configuration for descriptions.
Local Deployment
- Clone the repo
git clone https://github.com/zawsq/Teleshare.git
then change directory to Teleshare
cd Teleshare
-
Create an .env file refer to .env_example for referencee.
-
Create an python environment (poetry / virtualenv):
Optional
pip install virtualenv
virtualenv myenv
source myenv/bin/activate
windows:
myenv\Scripts\activate
- Install requirements
pip install -r requirements.txt
- Start the bot.
python -m bot.main
Heroku Deployment
If this repo cannot be deployed in Heroku, please fork it and deploy it manually using the heroku-deploy branch.
Render Deployment
To deploy on render, fork the main repo and deploy using Dockerfile
Setup your Render environment variable refer to .env_example for reference or configuration for descriptions.