@@ -268,6 +268,8 @@ async def _handle_message_search(
268268 after : SnowflakeTime = MISSING ,
269269 include_nsfw : bool = MISSING ,
270270 content : str = MISSING ,
271+ contents : Sequence [str ] = MISSING ,
272+ slop : int = 0 ,
271273 channels : Collection [Snowflake ] = MISSING ,
272274 authors : Collection [Snowflake ] = MISSING ,
273275 author_types : Collection [MessageSearchAuthorType ] = MISSING ,
@@ -280,7 +282,8 @@ async def _handle_message_search(
280282 link_hostnames : Collection [str ] = MISSING ,
281283 attachment_filenames : Collection [str ] = MISSING ,
282284 attachment_extensions : Collection [str ] = MISSING ,
283- application_commands : Collection [Snowflake ] = MISSING ,
285+ application_command_id : Optional [Snowflake ] = MISSING ,
286+ application_command_name : Optional [str ] = MISSING ,
284287 oldest_first : bool = MISSING ,
285288 most_relevant : bool = False ,
286289) -> AsyncIterator [Message ]:
@@ -295,6 +298,11 @@ async def _handle_message_search(
295298 if offset < 0 :
296299 raise ValueError ('offset must be greater than or equal to 0' )
297300
301+ if application_command_id and not application_command_name :
302+ raise TypeError ('application_command_name must be specified if application_command_id is specified' )
303+ if application_command_name and not application_command_id :
304+ raise TypeError ('application_command_id must be specified if application_command_name is specified' )
305+
298306 _channels = {c .id : c for c in channels } if channels else {}
299307
300308 # Guild channels must go through the guild search endpoint
@@ -350,6 +358,10 @@ def _resolve_channel(message: PartialMessagePayload, /):
350358 payload ['include_nsfw' ] = str (include_nsfw ).lower ()
351359 if content :
352360 payload ['content' ] = content
361+ if contents :
362+ payload ['contents' ] = list (contents )
363+ if slop :
364+ payload ['slop' ] = slop
353365 if channels :
354366 payload ['channel_id' ] = [c .id for c in channels ]
355367 if authors :
@@ -374,8 +386,10 @@ def _resolve_channel(message: PartialMessagePayload, /):
374386 payload ['attachment_filename' ] = list (attachment_filenames )
375387 if attachment_extensions :
376388 payload ['attachment_extension' ] = list (attachment_extensions )
377- if application_commands :
378- payload ['command_id' ] = [c .id for c in application_commands ]
389+ if application_command_id :
390+ payload ['command_id' ] = application_command_id .id
391+ if application_command_name :
392+ payload ['command_name' ] = application_command_name
379393 if oldest_first :
380394 payload ['sort_order' ] = 'asc'
381395 if most_relevant :
@@ -2401,6 +2415,8 @@ def search(
24012415 self ,
24022416 content : str = MISSING ,
24032417 * ,
2418+ contents : Sequence [str ] = MISSING ,
2419+ slop : int = MISSING ,
24042420 limit : Optional [int ] = 25 ,
24052421 offset : int = 0 ,
24062422 before : SnowflakeTime = MISSING ,
@@ -2416,7 +2432,8 @@ def search(
24162432 link_hostnames : Collection [str ] = MISSING ,
24172433 attachment_filenames : Collection [str ] = MISSING ,
24182434 attachment_extensions : Collection [str ] = MISSING ,
2419- application_commands : Collection [Snowflake ] = MISSING ,
2435+ application_command_id : Snowflake = MISSING ,
2436+ application_command_name : str = MISSING ,
24202437 oldest_first : bool = MISSING ,
24212438 most_relevant : bool = False ,
24222439 ) -> AsyncIterator [Message ]:
@@ -2453,6 +2470,10 @@ def search(
24532470 -----------
24542471 content: :class:`str`
24552472 The message content to search for.
2473+ contents: List[:class:`str`]
2474+ Tokenized message contents to search for. Must be prefixed with ``0|`` for exact match or ``2|`` for fuzzy match.
2475+ slop: :class:`int`
2476+ The slop for message content token matching from 0 to 100. Defaults to 2.
24562477 limit: Optional[:class:`int`]
24572478 The number of messages to retrieve.
24582479 If ``None``, retrieves every message in the results. Note, however,
@@ -2492,13 +2513,15 @@ def search(
24922513 The attachment filenames to filter by.
24932514 attachment_extensions: List[:class:`str`]
24942515 The attachment extensions to filter by (e.g. txt).
2495- application_commands: List[:class:`~discord.abc.ApplicationCommand`]
2496- The used application commands to filter by.
2516+ application_command_id: :class:`int`
2517+ The application command ID to filter by. Must be used with ``application_command_name``.
2518+ application_command_name: :class:`str`
2519+ The application command name to filter by. Must be used with ``application_command_id``.
24972520 oldest_first: :class:`bool`
24982521 Whether to return the oldest results first. Defaults to ``True`` if
24992522 ``after`` is specified, otherwise ``False``. Ignored when ``most_relevant`` is set.
25002523 most_relevant: :class:`bool`
2501- Whether to sort the results by relevance. Limits pagination to 9975 entries.
2524+ Whether to sort the results by relevance. Limits pagination to 10,000 entries.
25022525
25032526 Raises
25042527 ------
@@ -2508,6 +2531,7 @@ def search(
25082531 Provided both ``before`` and ``after`` when ``most_relevant`` is set.
25092532 ValueError
25102533 Could not resolve the channel's guild ID.
2534+ Did not provide both ``application_command_id`` and ``application_command_name``.
25112535
25122536 Yields
25132537 -------
@@ -2521,6 +2545,8 @@ def search(
25212545 before = before ,
25222546 after = after ,
25232547 content = content ,
2548+ contents = contents ,
2549+ slop = slop ,
25242550 authors = authors ,
25252551 author_types = author_types ,
25262552 mentions = mentions ,
@@ -2532,7 +2558,8 @@ def search(
25322558 link_hostnames = link_hostnames ,
25332559 attachment_filenames = attachment_filenames ,
25342560 attachment_extensions = attachment_extensions ,
2535- application_commands = application_commands ,
2561+ application_command_id = application_command_id ,
2562+ application_command_name = application_command_name ,
25362563 oldest_first = oldest_first ,
25372564 most_relevant = most_relevant ,
25382565 )
0 commit comments