[Python] How to copy, edit and replace a message in discord.py

Discussão em 'Python' iniciado por Stack, Dezembro 26, 2024.

  1. Stack

    Stack Membro Participativo

    I'm trying to make a discord bot that will take a twitter link posted by a user, copy it, add VX and posts it so it embeds properly, and deletes the original message.

    I cant seem to figure out the best way to have the bot copy the text, add "vx" before "twitter" and posting that. Like so https://twitter.com/i/status/xxxx > https://vxtwitter.com/i/status/xxxx

    This is what I have

    @bot.event
    async def on_message(message):
    if message.content == 'https://twitter.com':
    messages=await message.channel.send("https://vxtwitter.com")
    await asyncio.sleep(INT)
    await messages.edit(content="https://vxtwitter.com")


    I also cant seem to get ctx to work in my code, I'm not sure if it would help me to get it working. Any help is appreciated thanks in advance.

    Continue reading...

Compartilhe esta Página