Closed
Description
Steps to Reproduce
In the wiki you have provided an example for Avoiding flood limits :
async def broadcast(update: Update, context: ContextTypes.DEFAULT_TYPE):
await update.message.reply_text(text="Starting the broadcast...")
context.application.create_task(
asyncio.gather(
*(
context.bot.send_message(
chat_id=user_id, text="Hello World!", rate_limit_args={'priority': -1}
)
for user_id in user_ids
)
)
)
which has a typing issue because asyncio.gather
returns a asyncio.Future
and Application.create_task
expects an asyncio.Coroutine
Expected behaviour
Application.create_task
should also expect a Future
besides Coroutine
.
Actual behaviour
def create_task(self, coroutine: Coroutine, update: object = None) -> asyncio.Task:
Operating System
Manjaro Linux 22.0.0
Version of Python, python-telegram-bot & dependencies
python-telegram-bot 20.0
Bot API 6.4
Python 3.10.6 (main, Aug 23 2022, 08:36:38) [GCC 10.2.1 20210110]
Relevant log output
No response
Additional Context
No response