Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: local variable 'msg' referenced before assignment #103

Open
RuyeNet opened this issue Jul 3, 2023 · 10 comments
Open

Error: local variable 'msg' referenced before assignment #103

RuyeNet opened this issue Jul 3, 2023 · 10 comments

Comments

@RuyeNet
Copy link

RuyeNet commented Jul 3, 2023

I sent the bot a link, and the bot responded with the following:

Failed to save: https://t.me/********/********

Error: local variable 'msg' referenced before assignment

@RuyeNet
Copy link
Author

RuyeNet commented Jul 3, 2023

docker logs SaveRestrictedContentBot
starting Bot ~@DroneBots

@RuyeNet
Copy link
Author

RuyeNet commented Jul 3, 2023

@RuyeNet
Copy link
Author

RuyeNet commented Jul 6, 2023

#99

add the following code:

msg = await userbot.get_messages(chat, msg_id)

after

    if 't.me/c/' in msg_link: #...
    else:  
        edit = await client.edit_message_text(sender, edit_id, "Cloning.")  
        chat = msg_link.split("/")[-2]  
        # <add to here>  <<<
        try: # ...  

in main/plugins/pyroplug.py

@RanceZero
Copy link

@RuyeNet I am having the same error.

Why did you link that code? Did it fix it for you? For me it changes to this error with that code:
[WARNING/2023-07-12 02:29:41,987] pyrogram.types.messages_and_media.message: Empty messages cannot be copied.

@RuyeNet
Copy link
Author

RuyeNet commented Jul 12, 2023

@RuyeNet I am having the same error.

Why did you link that code? Did it fix it for you? For me it changes to this error with that code: [WARNING/2023-07-12 02:29:41,987] pyrogram.types.messages_and_media.message: Empty messages cannot be copied.

This is a different error.
It can only be used for channels, not groups.
The group's link displays empty messages.

@RanceZero
Copy link

I am sorry, you are correct. It worked for channels after the change you proposed.

@abdullayevich
Copy link

@RuyeNet I am having the same error.
Why did you link that code? Did it fix it for you? For me it changes to this error with that code: [WARNING/2023-07-12 02:29:41,987] pyrogram.types.messages_and_media.message: Empty messages cannot be copied.

This is a different error. It can only be used for channels, not groups. The group's link displays empty messages.

Did the bot work?

@timgahmencoding
Copy link

I sent the bot a link, and the bot responded with the following:

Failed to save: https://t.me/********/********

Error: local variable 'msg' referenced before assignment

I have the same error !

@RanceZero
Copy link

@RuyeNet I am having the same error.
Why did you link that code? Did it fix it for you? For me it changes to this error with that code: [WARNING/2023-07-12 02:29:41,987] pyrogram.types.messages_and_media.message: Empty messages cannot be copied.

This is a different error. It can only be used for channels, not groups. The group's link displays empty messages.

Did the bot work?

Yes, the bot did work after the changes proposed by RuyeNet.

@timgahmen
Copy link

timgahmen commented Sep 22, 2023

#99

add the following code:

msg = await userbot.get_messages(chat, msg_id)

after

    if 't.me/c/' in msg_link: #...
    else:  
        edit = await client.edit_message_text(sender, edit_id, "Cloning.")  
        chat = msg_link.split("/")[-2]  
        # <add to here>  <<<
        try: # ...  

in main/plugins/pyroplug.py

This solve the same problem from the post befor for me 👍👍👍

Should be implemented in the main code of the bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants