Skip to content

Webhook.send() doesn't accept thread=None #10313

@LeviPesin

Description

@LeviPesin

Summary

Webhook.send() doesn't accept thread=None

Reproduction Steps

thread=None cannot be used in Webhook.send() method. It is useful when I want to send a message to a channel/thread (code doesn't know which one).

Minimal Reproducible Code

dst = some_channel
webhook = await (dst if not isinstance(dst, Thread) else dst.parent).create_webhook(name='webhook')
await webhook.send(content='something', thread=None if not isinstance(dst, Thread) else dst)

Expected Results

Works.

Actual Results

  File "/data/project/rv/pyvenv/lib/python3.13/site-packages/discord/webhook/async_.py", line 1898, in send
    thread_id = thread.id
                ^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'id'

Intents

N/A

System Information

N/A

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    unconfirmed bugA bug report that needs triaging

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions