@Nyxoy

Allban дискорд пайтон. В чем ошибка?

Мой код:
@client.command()
async def allban(ctx):
    for member in guild.fetch_members(limit=None):
        await member.ban(reason=None)
        print(member)


Ошибка:
Ignoring exception in command allban:
Traceback (most recent call last):
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\Admin\Desktop\bethce\anti-lavan-new.py", line 37, in allban
    for member in guild.fetch_members(limit=None):
NameError: name 'guild' is not defined

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'guild' is not defined
  • Вопрос задан
  • 82 просмотра
Решения вопроса 1
SoreMix
@SoreMix
yellow
async for member in ctx.guild.fetch_members(limit=None):
Ответ написан
Пригласить эксперта
Ответы на вопрос 1
@Dzhigit
Начинающий прогер
@client.command()
async def allban(ctx):
    for member in guild.fetch_members(limit=None):
        await member.ban(reason=None)
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы