0
votes

Hello I try to delete a message when my bot finish his job but I don't kwon how do that ! Can you help me ? pls This is my code :

@client.command(pass_context=True)
async def chiant(ctx, *args):

    phrase = ""
    if args == None:
        await client.say("Aie tu as oublié de mettre une phrase !")
    elif len(args) != 0:
        for e in args:
            phrase = phrase +" "+ e
        #await client.say(phrase)
    else:
        await client.say("Aie tu as oublié de mettre une phrase !")

    await client.say(phrase, tts=True)

    await client.delete_message(ctx.message)
1
What is exactly that is stopping you from implementing this? Are you encountering an error or a weird behaviour? If it is so, please, provide us with the error message/description of the behaviour. - sjaustirni

1 Answers

0
votes

I fix my problem with :

@client.command(pass_context=True)
async def chiant(ctx, *args):

    phrase = ""
    if args == None:
        await client.say("Aie tu as oublié de mettre une phrase !")
    elif len(args) != 0:
        for e in args:
            phrase = phrase +" "+ e
        #await client.say(phrase)
    else:
        await client.say("Aie tu as oublié de mettre une phrase !")

    message = await client.say(phrase, tts=True) #This line fix ALL !

    await client.delete_message(message)