Skip to content

How can I get the thread ID of a newly created thread? #153

@kass507

Description

@kass507

I am creating a thread and intend to send several responses to that newly created thread.

But I can't get the thread ID, even though the code successfully creates the thread.

Is there something I'm doing wrong? Or is it an unavailable function?

def discord(media_path, name):
    body = "Puedes apoyarme"
    try:
        webhook = DiscordWebhook(url=config['discord']['webhook_thread'], content=body, thread_name=f"Pestañas de la Tienda del dia: {kasstime}")
        temp_image_path = f"{name}_discord_resized.jpg"
        resize_image_discord(media_path, temp_image_path)

        with open(temp_image_path, "rb") as shopImage:
            webhook.add_file(file=shopImage.read(), filename='tienda.jpg')

        response = webhook.execute()
        print("Enviado con Éxito a Discord")
        print(webhook)
        print(webhook.thread_id)
        return webhook.thread_id
    except Exception as e:
        print(f"Error al enviar la tienda de objetos a Discord, {e}")
        return None
Enviado con Éxito a Discord
<discord_webhook.webhook.DiscordWebhook object at 0x106d9b500>
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions