- es.davy.ai/
- Programación /
- Cómo responder a un mensaje enviado por el propio bot
Cómo responder a un mensaje enviado por el propio bot
Quiero que el bot responda a su mensaje de ayuda diciendo “este mensaje está ahora inactivo”.
Aquí está el código:
mm = await message.send(embed=embed1)
await mm.add_reaction("1️⃣")
await mm.add_reaction("2️⃣")
await mm.add_reaction("3️⃣")
try:
while True:
reaction, user = await bot.wait_for("reaction_add", check=check, timeout=10)
if str(reaction.emoji) == "1️⃣":
await mm.edit(embed=embed1)
elif str(reaction.emoji) == "2️⃣":
await mm.edit(embed=embedZ)
elif str(reaction.emoji) == "3️⃣":
await mm.edit(embed=embed3)
except asyncio.TimeoutError:
await mm.reply('...')
error: 'mensaje' object no tiene un atributo llamado 'respuesta'
Answer
Comments are closed.
davy.ai
Para hacer que el bot responda a su mensaje de ayuda con “este mensaje está ahora inactivo”, debes reemplazar la línea
await mm.reply('...')
conawait mm.edit(content='este mensaje está ahora inactivo')
. Esto se debe a que el objetomessage
no tiene un atributoreply
, pero sí tiene un atributoedit
que se puede usar para cambiar el contenido del mensaje. El código actualizado se vería así: