Giter VIP home page Giter VIP logo

save-restricted-bot's Introduction

I'm Bipin Krishna


c logo cplusplus logo python logo jupyter logo dart logo flutter logo docker logo javascript logo mongodb logo mysql logo nodejs logo npm logo react logo sqlite logo vscode logo java logo


stats graph languages graph trophy graph streak graph activity-graph graph

save-restricted-bot's People

Contributors

bipinkrish avatar harshit-shrivastav 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

save-restricted-bot's Issues

Please add Cancel button and Logging

  1. Please add Option to Cancel Current running Process!

  2. Add a Logging of files in the Log Group and Collect What people are Using bot for(like forwarding Content in Private Dump)

#FeatureRequest

Currently the normal telegram users can't get the files with a size greater than 2 gb,

It would be great to return a direct download link if the file size is greater than 2GB instead of receiving an error message.

It would be helpful to include the file caption as an extra text message as well.

Error when running the bot

I was trying to run the bot, and it gave me this error:


Traceback (most recent call last):
  File "C:\Users\umile\Desktop\Tools\Save-Restricted-Bot-main\main.py", line 22, in <module>
    acc.start()
  File "C:\Users\umile\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\sync.py", line 66, in async_to_sync_wrap
    return loop.run_until_complete(coroutine)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\umile\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\umile\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\methods\utilities\start.py", line 58, in start
    is_authorized = await self.connect()
                    ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\umile\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\methods\auth\connect.py", line 47, in connect
    await self.session.start()
  File "C:\Users\umile\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\session\session.py", line 142, in start
    raise e
  File "C:\Users\umile\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\session\session.py", line 109, in start
    await self.send(raw.functions.Ping(ping_id=0), timeout=self.START_TIMEOUT)
  File "C:\Users\umile\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\session\session.py", line 333, in send
    raise BadMsgNotification(result.error_code)
pyrogram.errors.BadMsgNotification: [16] The msg_id is too low, the client time has to be synchronized.

How can I fix it?

Not an issue

Sorry for creating an issue. But I wanted to know the logic

Like I'm hosting it on my own computer but how does it uploads videos of 300+mb downloading them from the channel and reuploading in just few seconds?

And even I can't find the video downloaded to my local storage. So how does it do it??

What's the logic? Can you please explain. As I'm working on something very similar where I need this fast download speed to upload videos but I can't achieve this.

how to save restricted data from Private Group

Hi
First thanks for your great work. the bot work perfect on channel content.
I try to use this bot to save restricted post on Private Group in Telegram.
bot I got below Error. Is it any solution?
Thanks a lot

https://t.me/c/0000000000/1137
Telegram says: [400 CHANNEL_INVALID] - The channel parameter is invalid (caused
by "channels.GetChannels")
Traceback (most recent call last):
File "C:\python\lib\site-packages\pyrogram\methods\advanced\resolve_peer.py",
line 62, in resolve_peer
return await self.storage.get_peer_by_id(peer_id)
File "C:\python\lib\site-packages\pyrogram\storage\sqlite_storage.py", line 14
2, in get_peer_by_id
raise KeyError(f"ID not found: {peer_id}")
KeyError: 'ID not found: -0000000000'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\python\lib\site-packages\pyrogram\dispatcher.py", line 242, in handle
r_worker
await self.loop.run_in_executor(
File "C:\python\lib\concurrent\futures\thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "main.py", line 113, in save
handle_private(message,chatid,msgid)
File "main.py", line 150, in handle_private
msg: pyrogram.types.messages_and_media.message.Message = acc.get_messages(ch
atid,msgid)
File "C:\python\lib\site-packages\pyrogram\sync.py", line 78, in async_to_sync
_wrap
return asyncio.run_coroutine_threadsafe(coroutine, main_loop).result()
File "C:\python\lib\concurrent\futures_base.py", line 439, in result
return self.__get_result()
File "C:\python\lib\concurrent\futures_base.py", line 388, in __get_result
raise self._exception
File "C:\python\lib\site-packages\pyrogram\methods\messages\get_messages.py",
line 101, in get_messages
peer = await self.resolve_peer(chat_id)
File "C:\python\lib\site-packages\pyrogram\methods\advanced\resolve_peer.py",
line 111, in resolve_peer
await self.invoke(
File "C:\python\lib\site-packages\pyrogram\methods\advanced\invoke.py", line 7
9, in invoke
r = await self.session.invoke(
File "C:\python\lib\site-packages\pyrogram\session\session.py", line 389, in i
nvoke
return await self.send(query, timeout=timeout)
File "C:\python\lib\site-packages\pyrogram\session\session.py", line 357, in s
end
RPCError.raise_it(result, type(data))
File "C:\python\lib\site-packages\pyrogram\errors\rpc_error.py", line 91, in r
aise_it
raise getattr(
pyrogram.errors.exceptions.bad_request_400.ChannelInvalid: Telegram says: [400 C
HANNEL_INVALID] - The channel parameter is invalid (caused by "channels.GetChannels")

Help

How to deploy it on heroku

#Feature request

If possible add /batch command with no of file you want. I think this feature will be added soon. ๐Ÿค—

Error while saving files

IMG_20231228_105435
There is an error occur when i try to save file may be this is because of filename of that file because whenever i try to download any file that content \ sign it give me error example below images
IMG_20231228_105451

Error โŒ

TCP health check failed on port 8000. Retrying... how to fix it?

#Feature request

Can you please add stop command
Sometimes we need to stop process in batch process but we can't
So please add it.

Little bit improvement ๐Ÿ˜•

If we start batch process for private/public channel.. for example :- https://t.me/private or public_channel/1 - 10
and it Massage ID - 3,5,7 does not contain any media or content. Bot sending "Error : Telegram says: [400 MESSAGE_EMPTY] - The message sent is empty or contains invalid characters (caused by "messages.SendMessage")"

How to solve this problem.. i just want to skip those messages ID that doesn't contain any content by bot itself instead of sending error message [400 MESSAGE_EMPTY]

From Both public and private channel getting error like this.
Developer Please solve the problem. ๐Ÿ˜”๐Ÿ™๐Ÿป

yoo i tried literally all night and my brain is bout to exploade!! ill try some more for sure but help :0

if you try to fetch a message that is not there (been deleted or "0" for example) it gives error..
"
Telegram says: [400 ME
SSAGE_EMPTY] - The message sent is empty or contains invalid characters (caused
by "messages.SendMessage")
"
i couldnt find a way around it or a way to filter those messages :(

i tried looking but i failed :((((
https://docs.pyrogram.org/api/methods/send_message#send-message
https://docs.pyrogram.org/telegram/types/message-empty
https://docs.pyrogram.org/api/errors/bad-request#

thanks in advance for the help! :)

Private group join error

Thank you for fix, but I found new bug with latest code

When I send private group for join, bot return the error below:
Error : Telegram says: [400 BOT_METHOD_INVALID] - The method can't be used by bots (caused by "messages.ImportChatInvite")

So I manually entered the group and sent the link.
Then I got the following error: Error : Telegram says: [400 CHANNEL_INVALID] - The channel parameter is invalid (caused by "channels.GetChannels")

Is this just for me?

error auth

Save-Restricted-Bot-main>.\main.py
Traceback (most recent call last):
File "C:\Users\ddr7\Desktop\Save-Restricted-Bot-main\main.py", line 176, in
bot.run()
File "C:\Users\ddr7\AppData\Roaming\Python\Python311\site-packages\pyrogram\methods\utilities\run.py", line 84, in run
self.start()
File "C:\Users\ddr7\AppData\Roaming\Python\Python311\site-packages\pyrogram\sync.py", line 66, in async_to_sync_wrap
return loop.run_until_complete(coroutine)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\ddr7\AppData\Roaming\Python\Python311\site-packages\pyrogram\methods\utilities\start.py", line 58, in start
is_authorized = await self.connect()
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ddr7\AppData\Roaming\Python\Python311\site-packages\pyrogram\methods\auth\connect.py", line 40, in connect
await self.load_session()
File "C:\Users\ddr7\AppData\Roaming\Python\Python311\site-packages\pyrogram\client.py", line 627, in load_session
raise AttributeError("The API key is required for new authorizations. "
AttributeError: The API key is required for new authorizations. More info: https://docs.pyrogram.org/start/auth

C:\Users\ddr7\Desktop\Save-Restricted-Bot-main>.\main.py
Traceback (most recent call last):
File "C:\Users\ddr7\Desktop\Save-Restricted-Bot-main\main.py", line 176, in
bot.run()
File "C:\Users\ddr7\AppData\Roaming\Python\Python311\site-packages\pyrogram\methods\utilities\run.py", line 84, in run
self.start()
File "C:\Users\ddr7\AppData\Roaming\Python\Python311\site-packages\pyrogram\sync.py", line 66, in async_to_sync_wrap
return loop.run_until_complete(coroutine)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\ddr7\AppData\Roaming\Python\Python311\site-packages\pyrogram\methods\utilities\start.py", line 58, in start
is_authorized = await self.connect()
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ddr7\AppData\Roaming\Python\Python311\site-packages\pyrogram\methods\auth\connect.py", line 40, in connect
await self.load_session()
File "C:\Users\ddr7\AppData\Roaming\Python\Python311\site-packages\pyrogram\client.py", line 627, in load_session
raise AttributeError("The API key is required for new authorizations. "
AttributeError: The API key is required for new authorizations. More info: https://docs.pyrogram.org/start/auth

C:\Users\ddr7\Desktop\Save-Restricted-Bot-main>.\main.py
Traceback (most recent call last):
File "C:\Users\ddr7\Desktop\Save-Restricted-Bot-main\main.py", line 176, in
bot.run()
File "C:\Users\ddr7\AppData\Roaming\Python\Python311\site-packages\pyrogram\methods\utilities\run.py", line 84, in run
self.start()
File "C:\Users\ddr7\AppData\Roaming\Python\Python311\site-packages\pyrogram\sync.py", line 66, in async_to_sync_wrap
return loop.run_until_complete(coroutine)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\ddr7\AppData\Roaming\Python\Python311\site-packages\pyrogram\methods\utilities\start.py", line 58, in start
is_authorized = await self.connect()
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ddr7\AppData\Roaming\Python\Python311\site-packages\pyrogram\methods\auth\connect.py", line 40, in connect
await self.load_session()
File "C:\Users\ddr7\AppData\Roaming\Python\Python311\site-packages\pyrogram\client.py", line 627, in load_session
raise AttributeError("The API key is required for new authorizations. "
AttributeError: The API key is required for new authorizations. More info: https://docs.pyrogram.org/start/auth

Problem with Save Restricted Content

I was having trouble getting the bot string, so I decided to use Pyrogram to get it. I used this code in python:

from pyrogram import Client

def get_session_string(api_id, api_hash, bot_token):
    session_name = "my_bot.session"  # Nome del file del database della sessione
    app = Client(session_name, api_id=api_id, api_hash=api_hash, bot_token=bot_token)
    with app:
        return app.export_session_string()

if __name__ == "__main__":
    # Sostituisci con i tuoi dati
    API_ID = ""
    API_HASH = ""
    BOT_TOKEN = ""

    session_string = get_session_string(API_ID, API_HASH, BOT_TOKEN)
    print(f"Pyrogram session string: {session_string}")

Everything went like clockwork: I managed to get the string and entered this into the 'config.json' file. I start the bot via the command 'python main.py', and everything runs smoothly. However, as soon as I send the bot a link to a private channel post, it returns this message: "Error : Telegram says: [400 CHANNEL_INVALID] - The channel parameter is invalid (caused by "channels.GetChannels")". How do I solve this problem?

struct.error: unpack requires a buffer of 271 bytes

e "/root/Save-Restricted-Bot/main.py", line 22, in
acc.start()
File "/usr/local/lib/python3.10/site-packages/pyrogram/sync.py", line 66, in async_to_sync_wrap
return loop.run_until_complete(coroutine)
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete
return future.result()
File "/usr/local/lib/python3.10/site-packages/pyrogram/methods/utilities/start.py", line 58, in start
is_authorized = await self.connect()
File "/usr/local/lib/python3.10/site-packages/pyrogram/methods/auth/connect.py", line 40, in connect
await self.load_session()
File "/usr/local/lib/python3.10/site-packages/pyrogram/client.py", line 616, in load_session
await self.storage.open()
File "/usr/local/lib/python3.10/site-packages/pyrogram/storage/memory_storage.py", line 59, in open
dc_id, api_id, test_mode, auth_key, user_id, is_bot = struct.unpack(
struct.error: unpack requires a buffer of 271 bytes
root@59520408f719:~/Save-Restricted-Bot#

Am I doing something wrong? MessageEmpty

I have done everything, I have configured my session, token, hash id, api id, etc. But when I send the post link to my bot I get the following in the console:

pyrogram.errors.exceptions.bad_request_400.MessageEmpty: Telegram says: [400 MESSAGE_EMPTY] - The message sent is empty or contains invalid characters (caused by "messages.SendMessage")

It should be noted that the link I am sending is from a private group, but the session is from my account that is in the group, so I don't know if I am doing something wrong, if you could suggest something it would be great.

#Features Request

Please Add Custom Filters To Save Restricted Content

List Of Filters
Texts
Documents
Videos
Audios
Sticker
Gif or Animation

Thank You Sir.

I need help to get ID from bot message

Hi, I would like to know which client or tool I should use to get the ID of a message sent by a Telegram bot. I've heard that third party tools need to be used to conduct this procedure, but I don't know where to get them. Could someone please give me some pointers? Thank you in advance.

Help

Bro Some Private Video link not detect in bot..post only detected

Can't download private channel/group's media

Whenever I try to download from private channel/group, I got the below error
Error : Telegram says: [400 MESSAGE_EMPTY]
The message sent is empty or contains invalid characters (caused by "messages.SendMessages")

error R15

2024-02-13T15:06:16.406711+00:00 heroku[worker.1]: Error R12 (Exit timeout) -> At least one process failed to exit within 30 seconds of SIGTERM
2024-02-13T15:06:16.408693+00:00 heroku[worker.1]: Stopping remaining processes with SIGKILL
2024-02-13T15:06:16.471386+00:00 heroku[worker.1]: Process exited with status 137

Issue in downloading files

Sir everything works fine but the only problem happens when we try to download a file whose caption contain mention link of someone's id
If we try to download it stucks on upload

Problem only happen when there is other person's mention id
If the msg have our mention id then it works fine

As you can see in picture same msg when i mention someone else it can't download
But if i mention myself it downloaded.

Please solve this issue
Screenshot_2023-11-01-13-57-52-74_74594bd74a0419242537a8d02ba17993

Running main.py Error

Hi
I cant run the code becuase of below error ,
Whats the problem ?
Thanks

(savebot) C:\Save-Restricted-Bot>python main.py
Traceback (most recent call last):
File "main.py", line 22, in
acc.start()
File "C:\Save-Restricted-Bot\savebot\lib\site-packages\pyrogram\sync.py", line
66, in async_to_sync_wrap
return loop.run_until_complete(coroutine)
File "C:\python\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "C:\Save-Restricted-Bot\savebot\lib\site-packages\pyrogram\methods\utilit
ies\start.py", line 58, in start
is_authorized = await self.connect()
File "C:\Save-Restricted-Bot\savebot\lib\site-packages\pyrogram\methods\auth\c
onnect.py", line 40, in connect
await self.load_session()
File "C:\Save-Restricted-Bot\savebot\lib\site-packages\pyrogram\client.py", li
ne 616, in load_session
await self.storage.open()
File "C:\Save-Restricted-Bot\savebot\lib\site-packages\pyrogram\storage\memory
_storage.py", line 59, in open
dc_id, api_id, test_mode, auth_key, user_id, is_bot = struct.unpack(
struct.error: unpack requires a buffer of 271 bytes

Floodwait while batch processing

The codes you wrote for batch processing are throwing an error of floodwait, and there might be a chance of an account ban. Add 3-5 second time gap before proceeding to the next link.

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.