I
I
Ivan2021-10-24 23:18:25
Python
Ivan, 2021-10-24 23:18:25

Is it possible to ban a member if they are not present on the server, discord.py?

It seems that I know that it is possible to ban a member if he is not present on the server, but my bot does not want to ban, even if the member is in the ban he does not want to ban once

Code

@bot.command()
@commands.has_permissions(ban_members = True)
async def ban(ctx, member: discord.Member, *, reason):
    await member.ban(reason = reason)
    await ctx.send(f"{member} был забронирован на сервере модератором {ctx.author}") 


Mistake
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "nutella" is not found
Ignoring exception in command ban:
Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/discord/ext/commands/core.py", line 855, in invoke
    await self.prepare(ctx)
  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/discord/ext/commands/core.py", line 789, in prepare
    await self._parse_arguments(ctx)
  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/discord/ext/commands/core.py", line 697, in _parse_arguments
    transformed = await self.transform(ctx, param)
  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/discord/ext/commands/core.py", line 552, in transform
    return await self.do_conversion(ctx, converter, argument, param)
  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/discord/ext/commands/core.py", line 505, in do_conversion
    return await self._actual_conversion(ctx, converter, argument, param)
  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/discord/ext/commands/core.py", line 451, in _actual_conversion
    ret = await instance.convert(ctx, argument)
  File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/discord/ext/commands/converter.py", line 195, in convert
    raise MemberNotFound(argument)
discord.ext.commands.errors.MemberNotFound: Member "898811322861506560" not found.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
JiMoon, 2021-12-26
@Jimoon

I am translating the error:
Member "898811322861506560" is not found
That is, no member - no blocking

A
asd111, 2015-01-12
@WooDFox

Article
https://developer.mozilla.org/en-US/docs/Web/Guide...
Sample
https://developer.mozilla.org/samples/cssref/anima...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question