Giter VIP home page Giter VIP logo

file-sharing-bot's Introduction

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

Make sure to see contributing.md for instructions on contributing to the project!

Features

  • Fully customisable.
  • Customisable welcome & Forcesub 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

BEFORE YOU DEPLOY ON HEROKU, YOU SHOULD FORK THE REPO AND CHANGE ITS NAME TO ANYTHING ELSE
Deploy

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

Deploy on Railway

Deploy on Railway

Deploy on Koyeb

The fastest way to deploy the application is to click the Deploy to Koyeb button below.

Deploy to Koyeb

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

/users - view bot statistics

/broadcast - broadcast any messages to bot users

/stats - checking your bot uptime

Variables

  • API_HASH Your API Hash from my.telegram.org
  • APP_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
  • DATABASE_URL Your mongo db url
  • DATABASE_NAME Your mongo db session name
  • 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 and fillings
  • FORCE_SUB_MESSAGEOptional:Force sub message of bot, use HTML and Fillings
  • FORCE_SUB_CHANNEL Optional: ForceSub Channel ID, leave 0 if you want disable force sub
  • PROTECT_CONTENT Optional: True if you need to prevent files from forwarding

Extra Variables

  • CUSTOM_CAPTION put your Custom caption text if you want Setup Custom Caption, you can use HTML and fillings for formatting (only for documents)
  • DISABLE_CHANNEL_BUTTON Put True to Disable Channel Share Button, Default if False
  • BOT_STATS_TEXT put your custom text for stats command, use HTML and fillings
  • USER_REPLY_TEXT put your text to show when user sends any message, use HTML

Fillings

START_MESSAGE | FORCE_SUB_MESSAGE

  • {first} - User first name
  • {last} - User last name
  • {id} - User ID
  • {mention} - Mention the user
  • {username} - Username

CUSTOM_CAPTION

  • {filename} - file name of the Document
  • {previouscaption} - Original Caption

CUSTOM_STATS

  • {uptime} - Bot Uptime

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 ⭐⭐⭐

file-sharing-bot's People

Contributors

alberteinsteintg avatar friscay avatar indomiegorengsatu avatar lunaticsm avatar mrismanaziz avatar rahulps1000 avatar shabin-k avatar shahsad-kp avatar subinps avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

file-sharing-bot's Issues

#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.

Remove File-sharing-bot dependencies

Please remove all File-sharing-bot dependencies from repo.Railway banned this one.At the time of deploying,dependency 'file-sharing-bot',even if present in readme also can't deploy to railway

[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

root@Serverdwiki:/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

root@Serverdwiki:/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

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

Remove Button

when someone clicks on the start button its shows two-button under msg can anyone tell me how to remove that

Batch Problem

I can't use /batch command for making multiple files in a single link.

admin settings

how to make everyone become admin without filling variables..

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

Heroku issue

Not deploy please fix this problem not depoly In heroku

Bot is crashed

sqlalchemy.exc.ArgumentError: Could not parse rfc1738 URL from string ''

NameError: name 'USERS_LIST' is not defined

Salesforce Platform
rmfilesharingbot

Open app
More

Application Logs
2021-10-11T12:49:45.060253+00:00 app[worker.1]: [11-Oct-21 12:49:45 - WARNING] - pyrogram.types.messages_and_media.message - Service messages cannot be copied. chat_id: -1001579145288, message_id: 2513
2021-10-11T12:49:49.916626+00:00 app[worker.1]: [11-Oct-21 12:49:49 - ERROR] - pyrogram.dispatcher - name 'USERS_LIST' is not defined
2021-10-11T12:49:49.916638+00:00 app[worker.1]: Traceback (most recent call last):
2021-10-11T12:49:49.916639+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pyrogram/dispatcher.py", line 217, in handler_worker
2021-10-11T12:49:49.916639+00:00 app[worker.1]: await handler.callback(self.client, *args)
2021-10-11T12:49:49.916639+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pyromod/listen/listen.py", line 93, in resolve_listener
2021-10-11T12:49:49.916640+00:00 app[worker.1]: await self.user_callback(client, message, *args)
2021-10-11T12:49:49.916640+00:00 app[worker.1]: File "/app/plugins/start.py", line 157, in subscribers_count
2021-10-11T12:49:49.916641+00:00 app[worker.1]: await msg.edit(USERS_LIST.format(active, blocked))
2021-10-11T12:49:49.916641+00:00 app[worker.1]: NameError: name 'USERS_LIST' is not defined

why????

Item could not be created:
We couldn't deploy your app because the source code violates the Salesforce Acceptable Use and External-Facing Services Policy.

Getting error in heroku logs

Bot is working fine but getting an error after some time in Heroku logs.

2022-06-24T03:31:16.798962+00:00 app[worker.1]: During handling of the above exception, another exception occurred:
2022-06-24T03:31:16.798962+00:00 app[worker.1]:
2022-06-24T03:31:16.798962+00:00 app[worker.1]: Traceback (most recent call last):
2022-06-24T03:31:16.798963+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pyrogram/dispatcher.py", line 222, in handler_worker
2022-06-24T03:31:16.798963+00:00 app[worker.1]: await handler.callback(self.client, *args)
2022-06-24T03:31:16.798963+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.9/site-packages/pyromod/listen/listen.py", line 93, in resolve_listener
2022-06-24T03:31:16.798964+00:00 app[worker.1]: await self.user_callback(client, message, *args)
2022-06-24T03:31:16.798964+00:00 app[worker.1]: File "/app/plugins/Forcesub.py", line 23, in forcesub
2022-06-24T03:31:16.798965+00:00 app[worker.1]: chat_id, msg_id = decoded_data.split('_')
2022-06-24T03:31:16.798965+00:00 app[worker.1]: ValueError: too many values to unpack (expected 2)

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

hello sir can you help us?

hello sir can you help us?
can we change the message file automatically in the db channel without us having to change it one by one and not manually.

for example, I forward a photo with the caption "hello world" to the bot, then the bot will forward the file to the data base channel with the caption "hello universe" automatically

Migrate issue

Hello there, Good repository !. But I'm facing problem regarding outdated repo which used mongodb to store file links. But now newer repository uses heroku postgres to store file links. My aim is to move data from mongodb to heroku postgres. How can it'll be possible !? Will you give any hint for it ?!

64bit Issues

Hello, This repo is not works with latest token Which is 64bit. Even though it works links Generated are made in UnSupported 64bit userbot.

client_encoding rise error

CODE: engine = create_engine(DB_URI, client_encoding="utf8")
GIVE ERROR: TypeError: Invalid argument(s) 'client_encoding' sent to create_engine()...

used:

  • URI lile r'sqlite:///C:\\folder\\database.db'
  • latest github pyrogram (github clone... setup...)
  • win11x64/python39_13

REMOVE "client_encoding" and all work well.
engine = create_engine(DB_URI)

Issue

Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

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

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

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

pyrogram.enums missing

i got this when i start to restart my bot
any idea? trying reinstall pyrogram but still didn't workScreenshot_2022-08-29-20-00-38-902_com.microsoft.rdc.androidx.jpg

sql error

sqlalchemy.exc.ArgumentError: Could not parse rfc1738 URL from string ''

Good Info

Successfully hided own user id inside the source code to get appended as admin.
'config.py'
Line 67

bot not working

2022-01-24T14:49:08.136553+00:00 heroku[worker.1]: State changed from down to starting
2022-01-24T14:49:11.693735+00:00 heroku[worker.1]: Starting process with command python3 main.py
2022-01-24T14:49:12.327664+00:00 heroku[worker.1]: State changed from starting to up
2022-01-24T14:49:12.433028+00:00 heroku[worker.1]: Idling
2022-01-24T14:49:12.471864+00:00 heroku[worker.1]: State changed from up to down
2022-01-24T14:49:12.512372+00:00 heroku[worker.1]: Idling because quota is exhausted
2022-01-24T14:49:13.449392+00:00 heroku[worker.1]: Stopping all processes with SIGTERM
2022-01-24T14:49:13.632556+00:00 heroku[worker.1]: Process exited with status 143

bot not working. this is the log. how to fix it?

Mistake issue.

At README.md placed:
API_ID Your API ID from my.telegram.org
but in code APP_ID was used, not API_ID.
APP_ID = int(os.environ.get("APP_ID", ""))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.