#๐Ÿ”’ Error during unban_all_command: object async_generator can't be used in 'await' expression

8 messages ยท Page 1 of 1 (latest)

waxen epoch
#

Im making a discord bot and a command im making is unbanall and im keep getting an error and now i debugged and got this i don't understand why it isnt working ive tried almost everything i feel like can someone help. THe code is @bot.command(name="unbanall")
async def unban_all_command(ctx):
try:
banned_users = await ctx.guild.bans()
banned_users_list = list(banned_users)

    for ban_entry in banned_users_list:
        user = ban_entry.user
        await ctx.guild.unban(user, reason="Unban all")
light badgeBOT
#

@waxen epoch

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

waxen epoch
#

@bot.command(name="unbanall")
async def unban_all_command(ctx):
try:
banned_users = await ctx.guild.bans()
banned_users_list = list(banned_users)

    for ban_entry in banned_users_list:
        user = ban_entry.user
        await ctx.guild.unban(user, reason="Unban all") the code
#

Error during unban_all_command: object async_generator can't be used in 'await' expression
the error

#

Im expecting it to unban everyone incase of a server raid or if i do something on accident. But when I run it i get the error i showed

light badgeBOT
#

@waxen epoch

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.

#

๐Ÿ”’ Error during unban_all_command: object async_generator can't be used in 'await' expression