pyrogram icon indicating copy to clipboard operation
pyrogram copied to clipboard

problems with create_channel

Open Marcosalen opened this issue 3 years ago • 0 comments

Checklist

  • [X] I am sure the error is coming from Pyrogram's code and not elsewhere
  • [X] I have searched in the issue tracker for similar bug reports, including closed ones
  • [X] I ran pip3 install -U https://github.com/pyrogram/pyrogram/archive/master.zip and reproduced the issue using the latest development version

Description

When creating channels, in some executions I'm getting the following message: [my_account] Waiting for 5 seconds before continuing (required by "channels.CreateChannel"). then creates two identical channels.

how could i solve this problem?

Steps to reproduce

1.2.3

Code example

api_id = credentials.api_id
api_hash = credentials.api_hash
user_ids = credentials.id_chat


title = ''
description = ''
chat_id = ''
app = Client("my_account", credentials.api_id, credentials.api_hash)

def create_channel(title, description):
    with app:
        return_chat = app.create_channel(title=input('name channel: '), description='hi!')
        chat_id = return_chat.id
        return_chat = app.add_chat_members(chat_id, user_ids)

        privileges_config = types.ChatPrivileges(
            can_change_info=True,
            can_post_messages=True,
            can_edit_messages=True,
            # can_delete_messages=True,
            # can_promote_members=True,
        )
        return_chat = app.promote_chat_member(chat_id, user_ids, privileges_config)

    # return chat_id
create_channel(title, description)

Logs

No response

Marcosalen avatar Aug 11 '22 11:08 Marcosalen