Telegram Bot to store Posts and Documents and it can Access by Special Links.

Overview

File-sharing-Bot


     

Telegram Bot to store Posts and Documents and it can Access by Special Links. I Guess This Will Be Usefull For Many People..... 😇 .

If you need any more modes in repo or If you find out any bugs, mention in @codexbotzsupport

Features

  • Fully customisable.
  • Customisable welcome messages.
  • More than one Posts in One Link.
  • Can be deployed on heroku directly.

Setup

  • Add the bot to Database Channel with all permission
  • Add bot to ForceSub channel as Admin with Invite Users via Link Permission if you enabled ForceSub

Installation

Deploy on Heroku

Deploy

Check This Tutorial Video on YouTube for any Help
Thanks to Erich and his InFoTel for this Video

Deploy in your VPS

git clone https://github.com/CodeXBotz/File-Sharing-Bot
cd File-Sharing-Bot
pip3 install -r requirements.txt
# <Create config.py appropriately>
python3 main.py

Admin Commands

/start - start the bot or get posts

/batch - create link for more than one posts

/genlink - create link for one post

Variables

  • API_HASH Your API Hash from my.telegram.org
  • API_ID Your API ID from my.telegram.org
  • TG_BOT_TOKEN Your bot token from @BotFather
  • OWNER_ID Must enter Your Telegram Id
  • CHANNEL_ID Your Channel ID eg:- -100xxxxxxxx
  • ADMINS Optional: A space separated list of user_ids of Admins, they can only create links
  • START_MESSAGE Optional: start message of bot, use HTML parsemode format
  • FORCE_SUB_CHANNEL Optional: ForceSub Channel ID, leave 0 if you want disable force sub

Support

Join Our Telegram Group For Support/Assistance And Our Channel For Updates.

Report Bugs, Give Feature Requests There..

Credits

  • Thanks To Dan For His Awsome Libary
  • Our Support Group Members

Licence

GNU GPLv3 Image

FILE-SHARING-BOT is Free Software: You can use, study share and improve it at your will. Specifically you can redistribute and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Star this Repo if you Liked it

Comments
  • Source code violates the salesforce and cannot deploy in Heroku 🥺🥺🥺

    Source code violates the salesforce and cannot deploy in Heroku 🥺🥺🥺

    Hello Sir, Today I try to deploy File Sharing Bot in Heroku, but then there's a notification that said "We cannot deploy your app because the source code violates the Salesforce Acceptable Use and External-Facing Services Policy."

    image

    Please help me...

    opened by awanyuya 5
  • #OffTopic

    #OffTopic

    Hello @rahulps1000 Sir, there is no problem with the bot.

    I open this issue to ask you how can I use get.chat.member so that bot users can see the chat title they are subscribed to. And I don't want to enable force subscription on multiple channels. I just wanted to know if a bot user has joined some of my channels, I want to greet them by showing chat title.

    I asked in two big telegram group, but they sent me to read docs but docs don't have any information on how to use it to check user status in multiple chat at once. I have come across some repos which are using multiple force subscriber, I don't like that idea.

    I just want that if users are already in my channels, they will get a special greeting when they start the bot. e.g. if they are in one of my channels, message = thanks for joining {chat1} If they are two or more then the greeting should be like: Thanks for joining {chat1} {chat2} {chat3} ets.

    If you can help me in understanding this and how to implement this is my pyrogram bot, I will be thankful to you.

    Sorry if I wasted your time, you may delete this message.

    help wanted 
    opened by X-Uchiha 3
  • On new command

    On new command

    hello sir good afternoon

    I have deployed your advance file share bot for movies purpose and its great i appreciate but the only problem is that people kept send movie titles to the bot directly....which the bot doesn't support and i wanted the bot to auto respond every directs texts except the known commands with "❌Don't send me messages directly I'm only File Share bot! Search for movie file links here (channel link) to access me"

    if there is any string i can add on GitHub please help me

    enhancement 
    opened by Nempah 3
  • Issue with sqllchamy arg erro

    Issue with sqllchamy arg erro

    2022-07-20T03:07:43.095666+00:00 heroku[worker.1]: State changed from crashed to starting 2022-07-20T03:07:47.281447+00:00 heroku[worker.1]: Starting process with command python3 main.py 2022-07-20T03:07:47.871357+00:00 heroku[worker.1]: State changed from starting to up 2022-07-20T03:07:56.685015+00:00 app[worker.1]: Traceback (most recent call last): 2022-07-20T03:07:56.685033+00:00 app[worker.1]: File "/app/main.py", line 3, in 2022-07-20T03:07:56.685102+00:00 app[worker.1]: Bot().run() 2022-07-20T03:07:56.685110+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/methods/utilities/run.py", line 54, in run 2022-07-20T03:07:56.685205+00:00 app[worker.1]: run(self.start()) 2022-07-20T03:07:56.685208+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete 2022-07-20T03:07:56.685359+00:00 app[worker.1]: return future.result() 2022-07-20T03:07:56.685361+00:00 app[worker.1]: File "/app/bot.py", line 24, in start 2022-07-20T03:07:56.685430+00:00 app[worker.1]: await super().start() 2022-07-20T03:07:56.685433+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/methods/utilities/start.py", line 67, in start 2022-07-20T03:07:56.685506+00:00 app[worker.1]: await self.initialize() 2022-07-20T03:07:56.685508+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/methods/auth/initialize.py", line 44, in initialize 2022-07-20T03:07:56.685577+00:00 app[worker.1]: self.load_plugins() 2022-07-20T03:07:56.685579+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/pyrogram/client.py", line 723, in load_plugins 2022-07-20T03:07:56.685749+00:00 app[worker.1]: module = import_module(module_path) 2022-07-20T03:07:56.685759+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/importlib/init.py", line 126, in import_module 2022-07-20T03:07:56.685833+00:00 app[worker.1]: return _bootstrap._gcd_import(name[level:], package, level) 2022-07-20T03:07:56.685836+00:00 app[worker.1]: File "", line 1050, in _gcd_import 2022-07-20T03:07:56.685910+00:00 app[worker.1]: File "", line 1027, in _find_and_load 2022-07-20T03:07:56.685961+00:00 app[worker.1]: File "", line 1006, in _find_and_load_unlocked 2022-07-20T03:07:56.685998+00:00 app[worker.1]: File "", line 688, in _load_unlocked 2022-07-20T03:07:56.686041+00:00 app[worker.1]: File "", line 883, in exec_module 2022-07-20T03:07:56.686091+00:00 app[worker.1]: File "", line 241, in _call_with_frames_removed 2022-07-20T03:07:56.686150+00:00 app[worker.1]: File "/app/plugins/start.py", line 11, in 2022-07-20T03:07:56.686225+00:00 app[worker.1]: from database.sql import add_user, query_msg, full_userbase 2022-07-20T03:07:56.686227+00:00 app[worker.1]: File "/app/database/sql.py", line 18, in 2022-07-20T03:07:56.686287+00:00 app[worker.1]: SESSION = start() 2022-07-20T03:07:56.686289+00:00 app[worker.1]: File "/app/database/sql.py", line 11, in start 2022-07-20T03:07:56.686352+00:00 app[worker.1]: engine = create_engine(DB_URI, client_encoding="utf8") 2022-07-20T03:07:56.686353+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/sqlalchemy/engine/init.py", line 525, in create_engine 2022-07-20T03:07:56.686510+00:00 app[worker.1]: return strategy.create(*args, **kwargs) 2022-07-20T03:07:56.686512+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/sqlalchemy/engine/strategies.py", line 54, in create 2022-07-20T03:07:56.686582+00:00 app[worker.1]: u = url.make_url(name_or_url) 2022-07-20T03:07:56.686585+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/sqlalchemy/engine/url.py", line 229, in make_url 2022-07-20T03:07:56.686680+00:00 app[worker.1]: return _parse_rfc1738_args(name_or_url) 2022-07-20T03:07:56.686683+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/sqlalchemy/engine/url.py", line 290, in _parse_rfc1738_args 2022-07-20T03:07:56.686777+00:00 app[worker.1]: raise exc.ArgumentError( 2022-07-20T03:07:56.686817+00:00 app[worker.1]: sqlalchemy.exc.ArgumentError: Could not parse rfc1738 URL from string '' 2022-07-20T03:07:56.889589+00:00 heroku[worker.1]: Process exited with status 1 2022-07-20T03:07:56.991161+00:00 heroku[worker.1]: State changed from up to crashed

    opened by baba-code 3
  • how to make force sub more than one?

    how to make force sub more than one?

    I have 7 channels and 1 group, how do I get people to follow the seven channels and enter the group and then they can take the file . bts Thank you very much to the developers and everyone who has contributed to this program

    opened by ahnaffauzanorg 3
  • Error in heroku app

    Error in heroku app

    Error notif "We couldn't deploy your app because the source code violates the Salesforce Acceptable Use and External-Facing Services Policy." thank you

    opened by updutech 2
  • plugins/link_generator.py got an error

    plugins/link_generator.py got an error

    base64_string = base64_string.rstrip("=") is working but i think you didn't add the support to encode the string please add it now the bot is giving the safe url but it cannot decode it could you please give me your contact user id of telegram please replay

    opened by sarangsahajan 2
  • [400 CHANNEL_INVALID]: The channel parameter is invalid (caused by

    [400 CHANNEL_INVALID]: The channel parameter is invalid (caused by "channels.GetChannels")

    I want to deploy the File Sharing Bot Telegram on my vps linux debian 10.4 but the code is error when i run the main.py like in the log. Bot is already admin in channel force sub and db channel

    [email protected]:/home/dwiki/File-Sharing-Bot# python3 main.py 
    Pyrogram v1.2.18, Copyright (C) 2017-2021 Dan 
    Licensed under the terms of the GNU Lesser General Public License v3 or later (LGPLv3+)
    
    [16-Dec-21 16:19:43 - WARNING] - bot - [400 CHANNEL_INVALID]: The channel parameter is invalid (caused by "channels.GetChannels")
    [16-Dec-21 16:19:43 - WARNING] - bot - Bot can't Export Invite link from Force Sub Channel!
    [16-Dec-21 16:19:43 - WARNING] - bot - Please Double check the FORCE_SUB_CHANNEL value and Make sure Bot is Admin in channel with Invite Users via Link Permission, Current Force Sub Channel Value: -1001671790214
    [16-Dec-21 16:19:43 - INFO] - bot - 
    Bot Stopped. Join https://t.me/ CodeXBotzSupport for support
    

    IF i dont fill the FORCE_SUB

    The error log

    [email protected]:/home/dwiki/File-Sharing-Bot# python3 main.py 
    Pyrogram v1.2.18, Copyright (C) 2017-2021 Dan <https://github.com/delivrance>
    Licensed under the terms of the GNU Lesser General Public License v3 or later (LGPLv3+)
    
    [16-Dec-21 16:24:09 - WARNING] - bot - [400 CHANNEL_INVALID]: The channel parameter is invalid (caused by "channels.GetChannels")
    [16-Dec-21 16:24:09 - WARNING] - bot - Make Sure bot is Admin in DB Channel, and Double check the CHANNEL_ID Value, Current Value -1001671790214
    [16-Dec-21 16:24:09 - INFO] - bot - 
    Bot Stopped. Join https://t.me/CodeXBotzSupport for support
    
    opened by DwikiPermana 2
  • bot not working fine.

    bot not working fine.

    this bot used to work fine till 30 nov.

    but on 1st dec it stopped working. now only the channel admins are able to get content using the link generated by bot. previously any user with the special link was able to use bot

    here are the logs when other users try it

    [02-Dec-21 09:28:43 - ERROR] - pyrogram.dispatcher - 5048476112

    Traceback (most recent call last):

    File "/home/travis/virtualenv/python3.9.7/lib/python3.9/site-packages/pyrogram/dispatcher.py", line 191, in handler_worker

    await parser(update, users, chats)
    

    File "/home/travis/virtualenv/python3.9.7/lib/python3.9/site-packages/pyrogram/dispatcher.py", line 83, in message_parser

    return await pyrogram.types.Message._parse(
    

    File "/home/travis/virtualenv/python3.9.7/lib/python3.9/site-packages/pyrogram/types/messages_and_media/message.py", line 655, in _parse

    sender_chat = types.Chat._parse(client, message, users, chats) if not from_user else None
    

    File "/home/travis/virtualenv/python3.9.7/lib/python3.9/site-packages/pyrogram/types/user_and_chats/chat.py", line 243, in _parse

    return Chat._parse_user_chat(client, users[message.peer_id.user_id])
    

    KeyError: 5048476112

    opened by ShashiTharoor 2
  • broadcast.py

    broadcast.py

    (c) @AbirHasan2005

    import time import string import random import asyncio import datetime import aiofiles.os import traceback from configs import Config from helpers.database.access_db import db from pyrogram.types import Message from pyrogram.errors import FloodWait, InputUserDeactivated, UserIsBlocked, PeerIdInvalid

    broadcast_ids = {}

    async def send_msg(user_id, message): try: if Config.BROADCAST_AS_COPY is False: await message.forward(chat_id=user_id) elif Config.BROADCAST_AS_COPY is True: await message.copy(chat_id=user_id) return 200, None except FloodWait as e: await asyncio.sleep(e.x) return send_msg(user_id, message) except InputUserDeactivated: return 400, f"{user_id} : deactivated\n" except UserIsBlocked: return 400, f"{user_id} : blocked the bot\n" except PeerIdInvalid: return 400, f"{user_id} : user id invalid\n" except Exception as e: return 500, f"{user_id} : {traceback.format_exc()}\n"

    async def broadcast_handler(m: Message): all_users = await db.get_all_users() broadcast_msg = m.reply_to_message while True: broadcast_id = ''.join([random.choice(string.ascii_letters) for i in range(3)]) if not broadcast_ids.get(broadcast_id): break out = await m.reply_text( text=f"Broadcast Started! You will be notified with log file when all the users are notified." ) start_time = time.time() total_users = await db.total_users_count() done = 0 failed = 0 success = 0 broadcast_ids[broadcast_id] = dict( total=total_users, current=done, failed=failed, success=success ) async with aiofiles.open('broadcast.txt', 'w') as broadcast_log_file: async for user in all_users: sts, msg = await send_msg( user_id=int(user['id']), message=broadcast_msg ) if msg is not None: await broadcast_log_file.write(msg) if sts == 200: success += 1 else: failed += 1 if sts == 400: await db.delete_user(user['id']) done += 1 if broadcast_ids.get(broadcast_id) is None: break else: broadcast_ids[broadcast_id].update( dict( current=done, failed=failed, success=success ) ) if broadcast_ids.get(broadcast_id): broadcast_ids.pop(broadcast_id) completed_in = datetime.timedelta(seconds=int(time.time() - start_time)) await asyncio.sleep(3) await out.delete() if failed == 0: await m.reply_text( text=f"broadcast completed in {completed_in}\n\nTotal users {total_users}.\nTotal done {done}, {success} success and {failed} failed.", quote=True ) else: await m.reply_document( document='broadcast.txt', caption=f"broadcast completed in {completed_in}\n\nTotal users {total_users}.\nTotal done {done}, {success} success and {failed} failed.", quote=True ) await aiofiles.os.remove('broadcast.txt')

    opened by Thiyaku17 2
  • Help sir, im deployed on railway but... This happens

    Help sir, im deployed on railway but... This happens

    Traceback (most recent call last): File "main.py", line 3, in Bot().run() File "/usr/local/lib/python3.8/site-packages/pyrogram/methods/utilities/run.py", line 80, in run run(self.start()) File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete return future.result() File "/app/bot.py", line 40, in start await super().start() File "/usr/local/lib/python3.8/site-packages/pyrogram/methods/utilities/start.py", line 74, in start await self.initialize() File "/usr/local/lib/python3.8/site-packages/pyrogram/methods/auth/initialize.py", line 46, in initialize self.load_plugins() File "/usr/local/lib/python3.8/site-packages/pyrogram/client.py", line 664, in load_plugins module = import_module(module_path) File "/usr/local/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 843, in exec_module File "", line 219, in _call_with_frames_removed File "/app/plugins/start.py", line 16, in from database.database import add_user, del_user, full_userbase, present_user File "/app/database/database.py", line 10, in dbclient = pymongo.MongoClient(DB_URI) File "/usr/local/lib/python3.8/site-packages/pymongo/mongo_client.py", line 736, in init res = uri_parser.parse_uri( File "/usr/local/lib/python3.8/site-packages/pymongo/uri_parser.py", line 478, in parse_uri raise InvalidURI( pymongo.errors.InvalidURI: Invalid URI scheme: URI must begin with 'mongodb://' or 'mongodb+srv://' Traceback (most recent call last): File "main.py", line 3, in Bot().run()

    opened by sasangeo 0
Releases(v10.4)
Owner
Code X Botz
Purpose of this Organisation is Making Maximum Useful Bots in Telegram. We will publish Open Source Projects here
Code X Botz
Buy early bsc gems with custom gas fee, slippage, amount. Auto approve token after buy. Sell buyed token with custom gas fee, slippage, amount. And more.

Pancakeswap Sniper bot Full version of Pancakeswap sniping bot used to snipe during fair coin launches. With advanced options and a graphical user int

Jesus Crypto 204 Apr 27, 2022
This is a very simple botnet with a CnC server, made by me. Feel free to change anything

This is a very simple botnet with a CnC server, made by me. Feel free to change anything

8 Nov 12, 2022
A simple telegram Bot, Upload Media File| video To telegram using the direct download link. (youtube, Mediafire, google drive, mega drive, etc)

URL-Uploader (Bot) A Bot Upload file|video To Telegram using given Links. Features: 👉 Only Auth Users (AUTH_USERS) Can Use The Bot 👉 Upload YTDL Sup

Hash Minner 18 Dec 17, 2022
A modular Telegram Python bot running on python3 with a sqlalchemy database.

Nao Tomori Robot Found Me On Telegram As Nao Tomori 🌼 A modular Telegram Python bot running on python3 with a sqlalchemy database. How to setup/deplo

Stinkyproject 1 Nov 24, 2021
📖 GitHub action schedular (cron) that posts a Hadith every hour on Twitter & Facebook.

Hadith Every Hour 📖 A bot that posts a Hadith every hour on Twitter & Facebook (Every 3 hours for now to avoid spamming) Follow on Twitter @HadithEve

Ananto 13 Dec 14, 2022
Free and Open Source Machine Translation API. 100% self-hosted, no limits, no ties to proprietary services. Built on top of Argos Translate.

LibreTranslate Try it online! | API Docs Free and Open Source Machine Translation API, entirely self-hosted. Unlike other APIs, it doesn't rely on pro

UAV4GEO 3.5k Jan 03, 2023
Tools ini hanya bisa digunakan untuk menyerang website atau http/s

☢️ Tawkun DoS ☢️ Tools ini hanya bisa digunakan untuk menyerang website atau http/s FITUR: [ ☯️ ] Proxy Mode [ 🔥 ] SOCKS Mode | Kadang Eror [ ☢️ ] Ht

Bandhitawkunthi 9 Jul 19, 2022
Self-adjusting, auto-compounding multi-pair DCA crypto trading bot using Python, AWS Lambda & 3Commas API

Self-adjusting, auto-compounding multi-pair DCA crypto trading bot using Python, AWS Lambda & 3Commas API The following code describes how we can leve

Jozef Jaroščiak 21 Dec 07, 2022
Python app to notify via slack channel the status_code change from an URL

Python app to notify, via slack channel you choose to be notified, for the status_code change from the URL list you setup to be checked every yy seconds

Pedro Nunes 1 Oct 25, 2021
Official python API for Phish.AI public and private API to detect zero-day phishing websites

phish-ai-api Summary Official python API for Phish.AI public and private API to detect zero-day phishing websites How it Works (TLDR) Essentially we h

Phish.AI 168 May 17, 2022
Autofilterv5 With Same more Features

Autofilterv5 With Same more Features ✨ Imbd + Index +.....

Selfie SD 8 Oct 21, 2022
Telegram bot to check availability of vaccination slots in India.

cowincheckbot Telegram bot to check availability of vaccination slots in India. Setup Install requirements using pip3 install -r requirements.txt Crea

Muhammed Shameem 10 Jun 11, 2022
Simple PoC script that allows you to exploit telegram's "send with timer" feature by saving any media sent with this functionality.

Simple PoC script that allows you to exploit telegram's "send with timer" feature by saving any media sent with this functionality.

Matteo 52 Nov 29, 2022
Cryptocurrency Prices Telegram Bot For Python

Cryptocurrency Prices Telegram Bot How to Run Set your telegram bot token as environment variable TELEGRAM_BOT_TOKEN: export TELEGRAM_BOT_TOKEN=your_

Sina Nazem 3 Oct 31, 2022
One of Best renamer bot with python

🌀 One of Best renamer bot repo Please Give a ☆ if You like This Open Source and Don't Forget to Follow Me On Github For More Repos And Codes. Scrappe

1 Dec 14, 2021
Editing a Tinder bot created by @frederikme

tinder_bot_edit Editing a Tinder bot created by @frederikme Table of Contents Basic Swipe Bot Basic Swipe Bot Download the code as a zip or clone the

Alex Carter 1 Nov 23, 2021
Drcom-pt-client - Drcom Pt version client with refresh timer

drcom-pt-client Drcom Pt version client with refresh timer Dr.com Pt版本客户端 可用于网页认

4 Nov 16, 2022
this is a telegram bot repository, that can stream video on telegram group video chat.

VIDEO STREAM BOT telegram bot project for streaming video on telegram video chat, powered by tgcalls and pyrogram 🛠 Commands: /vstream (reply to vide

levina 319 Aug 15, 2022
Simple base for a telethon bot!

Telethon Bot Simple base used to make a Telegram Bot in telethon. Join @BotzHub! Note: The client, here, is named BotzHub. Fork and add your plugins t

Aditya 54 Oct 21, 2022
Schedule Twitter updates with easy

coo: schedule Twitter updates with easy Coo is an easy to use Python library for scheduling Twitter updates. To use it, you need to first apply for a

wilfredinni 46 Nov 03, 2022