Depending if you are using the rewrite or the old async version of discord.py I would recommend the following :
Discord.py async (0.16.x) :
@client.event
async def on_message(self, message):
if message.content.startswith('!quiz'):
quizMsg = 'Question of the quiz'
msg = await client.say(f"{quizMsg}\n\n{secs}s left !")
secs = 30
while secs > 0:
await asyncio.sleep(1)
await client.edit_message(msg, f"{quizMsg}\n\n{secs}s left !")
secs--
await client.say("Time is up ! The answer was...")
Discord.py rewrite (1.0.x) :
@commands.command(name="quiz", aliases=["q"])
async def quiz():
quizMsg = 'Question of the quiz'
msg = await ctx.send(f"{quizMsg}\n\n{secs}s left !")
secs = 30
while secs > 0:
await asyncio.sleep(1)
await msg.edit(content = f"{quizMsg}\n\n{secs}s left !")
secs--
await ctx.send("Time is up ! The answer was...")
Mind the difference between the two methods