Skip to content
Advertisement

hey im making a giveaway command but it throws a error “‘async_generator’ object has no attribute ‘flatten'”

so im making a giveaway command for my bot in discord.py v2 but it throws this error: ‘async_generator’ object has no attribute ‘flatten’

here is an image: getting the error

my code –

JavaScript

i know that flatten has been removed in discord.py v2 but i dont know how to implement the new one im confused any type of help will be appreciated!

Advertisement

Answer

The discord.Reaction.users were changed to return an async generator (PEP 525) and have to be turned into a list in your use case. You can easily do it using list comprehension like:

JavaScript

Instead of:

JavaScript

The example of this can be found in discord.py discord.Reaction.users document.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement