📜  discord py 编辑消息 (1)

📅  最后修改于: 2023-12-03 14:40:44.654000             🧑  作者: Mango

'''python import discord

client = discord.Client()

@client.event async def on_message(message): if message.content.startswith('!edit'): new_content = "This is a new message content." new_embed = discord.Embed(title="New message", description="This is a new message description.", color=discord.Color.blue())

    await message.edit(content=new_content, embed=new_embed)
    await message.channel.send("The message has been edited!")

    # Return a markdown format
    markdown = f"""
    ## Edited Message

    ### Content
    ```
    {new_content}
    ```

    ### Embed
    ```
    Title: {new_embed.title}
    Description: {new_embed.description}
    ```
    """

    await message.channel.send(markdown)
    

client.run('your token here') '''