Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5c60925
📝 Add missing docs to .respond methods
ToothyDev Jan 9, 2026
cbcc245
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 9, 2026
fce0c58
Add overloads to type method properly (interaction)
ToothyDev Jan 10, 2026
75a338c
Add overloads to type method properly (ApplicationContext)
ToothyDev Jan 10, 2026
f0aabcc
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 10, 2026
ae1be07
Adjust typing and make it a transparent passthrough
ToothyDev Jan 10, 2026
8870c20
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 10, 2026
b725e9e
Add typing for args/kwargs
ToothyDev Jan 11, 2026
67127fd
Adjust changelog
ToothyDev Jan 11, 2026
cfb0e3a
Merge branch 'master' into fix/document_respond_parameters
ToothyDev Jan 11, 2026
638bbf6
🐛 Make optional params optional
ToothyDev Jan 11, 2026
49262c9
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 11, 2026
c2713db
Update changelog
ToothyDev Jan 13, 2026
573370d
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 13, 2026
28b161f
✨ Add new parameters initially
ToothyDev Jan 13, 2026
f4f76b2
style(pre-commit): auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 13, 2026
aed9ed0
📝 Fix up docs a bit
ToothyDev Jan 13, 2026
deb1611
Change overloads
ToothyDev Jan 14, 2026
50fa2a1
Apply code change requests
ToothyDev Jan 14, 2026
65adca3
Merge branch 'fix/document_respond_parameters' into feat/suppress_fla…
ToothyDev Jan 14, 2026
5200e8c
Add suppress kwargs where I forgot them
ToothyDev Jan 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ These changes are available on the `master` branch, but have not yet been releas

- Added `.extension` attribute to emojis to get their file extension.
([#3055](https://github.com/Pycord-Development/pycord/pull/3055))
- Added `silent` and `suppress_embeds` parameters to `ApplicationContext.respond`,
`Interaction.respond` and `InteractionResponse.send_message`.
([#3062](https://github.com/Pycord-Development/pycord/pull/3062))

### Changed

Expand All @@ -30,6 +33,12 @@ These changes are available on the `master` branch, but have not yet been releas
- Fixed `Interaction.channel` not being resolved with user-installed commands ran in
guilds which the bot is not a member of.
([#3047](https://github.com/Pycord-Development/pycord/pull/3047))
- Fixed `Interaction.respond` and `ApplicationContext.respond` methods to explicitly
list their accepted parameters.
([#3061](https://github.com/Pycord-Development/pycord/pull/3061))
- Fixed an issue where the optional parameters of `InteractionResponse.send_message`
weren't type hinted as optional.
([#3061](https://github.com/Pycord-Development/pycord/pull/3061))

### Deprecated

Expand Down
49 changes: 42 additions & 7 deletions discord/commands/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

from __future__ import annotations

from typing import TYPE_CHECKING, Any, TypeVar
from typing import TYPE_CHECKING, Any, TypeVar, overload

import discord.abc
from discord.interactions import Interaction, InteractionMessage, InteractionResponse
Expand All @@ -38,15 +38,19 @@

import discord

from .. import Bot
from .. import AllowedMentions, Bot
from ..client import ClientUser
from ..cog import Cog
from ..embeds import Embed
from ..file import File
from ..guild import Guild
from ..interactions import InteractionChannel
from ..member import Member
from ..message import Message
from ..permissions import Permissions
from ..poll import Poll
from ..state import ConnectionState
from ..ui import BaseView
from ..user import User
from ..voice_client import VoiceClient
from ..webhook import WebhookMessage
Expand Down Expand Up @@ -277,12 +281,43 @@ def attachment_size_limit(self) -> int:
def send_modal(self) -> Callable[..., Awaitable[Interaction]]:
return self.interaction.response.send_modal

@property
@overload
async def respond(
self,
content: Any | None = None,
embed: Embed | None = None,
view: BaseView | None = None,
tts: bool = False,
ephemeral: bool = False,
allowed_mentions: AllowedMentions | None = None,
file: File | None = None,
files: list[File] | None = None,
poll: Poll | None = None,
delete_after: float | None = None,
silent: bool = False,
suppress_embeds: bool = False,
) -> Interaction | WebhookMessage: ...

@overload
async def respond(
self,
content: Any | None = None,
embeds: list[Embed] | None = None,
view: BaseView | None = None,
tts: bool = False,
ephemeral: bool = False,
allowed_mentions: AllowedMentions | None = None,
file: File | None = None,
files: list[File] | None = None,
poll: Poll | None = None,
delete_after: float | None = None,
silent: bool = False,
suppress_embeds: bool = False,
) -> Interaction | WebhookMessage: ...

@discord.utils.copy_doc(Interaction.respond)
def respond(
self, *args, **kwargs
) -> Callable[..., Awaitable[Interaction | WebhookMessage]]:
return self.interaction.respond
async def respond(self, *args, **kwargs) -> Interaction | WebhookMessage:
return await self.interaction.respond(*args, **kwargs)

@property
@discord.utils.copy_doc(InteractionResponse.send_message)
Expand Down
85 changes: 76 additions & 9 deletions discord/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

import asyncio
import datetime
from typing import TYPE_CHECKING, Any, Coroutine, Union
from typing import TYPE_CHECKING, Any, Coroutine, Union, overload

from . import utils
from .channel import ChannelType, PartialMessageable, _threaded_channel_factory
Expand Down Expand Up @@ -699,12 +699,79 @@ async def delete_original_message(self, **kwargs):
"""
return await self.delete_original_response(**kwargs)

@overload
async def respond(
self,
content: Any | None = None,
embed: Embed | None = None,
view: BaseView | None = None,
tts: bool = False,
ephemeral: bool = False,
allowed_mentions: AllowedMentions | None = None,
file: File | None = None,
files: list[File] | None = None,
poll: Poll | None = None,
delete_after: float | None = None,
silent: bool = False,
suppress_embeds: bool = False,
) -> Interaction | WebhookMessage: ...

@overload
async def respond(
self,
content: Any | None = None,
embeds: list[Embed] | None = None,
view: BaseView | None = None,
tts: bool = False,
ephemeral: bool = False,
allowed_mentions: AllowedMentions | None = None,
file: File | None = None,
files: list[File] | None = None,
poll: Poll | None = None,
delete_after: float | None = None,
silent: bool = False,
suppress_embeds: bool = False,
) -> Interaction | WebhookMessage: ...

async def respond(self, *args, **kwargs) -> Interaction | WebhookMessage:
"""|coro|

Sends either a response or a message using the followup webhook determined by whether the interaction
has been responded to or not.

Parameters
----------
content: Optional[:class:`str`]
The content of the message to send.
embeds: List[:class:`Embed`]
A list of embeds to send with the content. Maximum of 10. This cannot
be mixed with the ``embed`` parameter.
embed: :class:`Embed`
The rich embed for the content to send. This cannot be mixed with
``embeds`` parameter.
tts: :class:`bool`
Indicates if the message should be sent using text-to-speech.
view: :class:`discord.ui.BaseView`
The view to send with the message.
ephemeral: :class:`bool`
Indicates if the message should only be visible to the user who started the interaction.
If a view is sent with an ephemeral message, and it has no timeout set then the timeout
is set to 15 minutes.
allowed_mentions: :class:`AllowedMentions`
Controls the mentions being processed in this message.
See :meth:`.abc.Messageable.send` for more information.
delete_after: :class:`float`
If provided, the number of seconds to wait in the background
before deleting the message we just sent.
file: :class:`File`
The file to upload.
files: List[:class:`File`]
A list of files to upload. Must be a maximum of 10.
poll: :class:`Poll`
The poll to send.

.. versionadded:: 2.6

Returns
-------
Union[:class:`discord.Interaction`, :class:`discord.WebhookMessage`]:
Expand Down Expand Up @@ -951,16 +1018,16 @@ async def send_message(
self,
content: Any | None = None,
*,
embed: Embed = None,
embeds: list[Embed] = None,
view: BaseView = None,
embed: Embed | None = None,
embeds: list[Embed] | None = None,
view: BaseView | None = None,
tts: bool = False,
ephemeral: bool = False,
allowed_mentions: AllowedMentions = None,
file: File = None,
files: list[File] = None,
poll: Poll = None,
delete_after: float = None,
allowed_mentions: AllowedMentions | None = None,
file: File | None = None,
files: list[File] | None = None,
poll: Poll | None = None,
delete_after: float | None = None,
) -> Interaction:
"""|coro|

Expand Down
14 changes: 14 additions & 0 deletions discord/webhook/async_.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ def handle_message_parameters(
previous_allowed_mentions: AllowedMentions | None = None,
suppress: bool = False,
thread_name: str | None = None,
silent: bool = False,
) -> ExecuteWebhookParameters:
if files is not MISSING and file is not MISSING:
raise TypeError("Cannot mix file and files keyword arguments.")
Expand All @@ -671,6 +672,7 @@ def handle_message_parameters(
flags = MessageFlags(
suppress_embeds=suppress,
ephemeral=ephemeral,
suppress_notifications=silent,
)

if view is not MISSING:
Expand Down Expand Up @@ -1706,6 +1708,8 @@ async def send(
applied_tags: list[Snowflake] = MISSING,
wait: bool = False,
delete_after: float = None,
silent: bool = False,
suppress_embeds: bool = False,
) -> WebhookMessage | None:
"""|coro|

Expand Down Expand Up @@ -1786,6 +1790,14 @@ async def send(
The poll to send.

.. versionadded:: 2.6
silent: :class:`bool`
Whether the message should trigger push and desktop notifications.

.. versionadded:: 2.8
suppress_embeds: :class:`bool`
Whether embeds for links will be suppressed from appearing.

.. versionadded:: 2.8

Returns
-------
Expand Down Expand Up @@ -1872,6 +1884,8 @@ async def send(
allowed_mentions=allowed_mentions,
previous_allowed_mentions=previous_mentions,
thread_name=thread_name,
silent=silent,
suppress=suppress_embeds,
)
adapter = async_context.get()
thread_id: int | None = None
Expand Down
Loading