X
X
xis22482020-05-23 11:01:18
Python
xis2248, 2020-05-23 11:01:18

How do I make the discord bot write the name of a specific person that I entered?

@bot.command(pass_context=True)
async def kill(ctx):
await ctx.message.delete()
await ctx.send(" {}".format(ctx.message.author.mention))

5ec8d83a0c066347003766.png
5ec8d8349f9c1077451754.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dream, 2021-05-20
@dreameddd

If I understand you correctly, then:

@bot.command()
async def kill(ctx, member:discord.Member=None):
    if member != None: # если пользователь указан
        await ctx.message.delete() # удаляем наше сообщение
        await ctx.send(f"Пиу! {member.mention}") # отправляем сообщение
    else: # если пользователь не указан, выдаем сообщение
        await ctx.send("Ой! Ты не указал пользователя!")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question