From 845dbfdfb64528de56e3396569f494fdc17e1980 Mon Sep 17 00:00:00 2001 From: Samuel Hernandez Date: Sat, 13 Jul 2024 15:41:31 -0400 Subject: [PATCH] api: allow searching DMs --- api/search.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/api/search.go b/api/search.go index a0956d08..b9da350e 100644 --- a/api/search.go +++ b/api/search.go @@ -35,3 +35,15 @@ func (c *Client) Search(guildID discord.GuildID, data SearchData) (SearchRespons httputil.WithSchema(c, data), ) } + +// SearchDirectMessages searches through a direct message channel. +// SearchData.ChannelID must be a valid channel ID. +func (c *Client) SearchDirectMessages(data SearchData) (SearchResponse, error) { + var resp SearchResponse + + return resp, c.RequestJSON( + &resp, "GET", + EndpointChannels+data.ChannelID.String()+"/messages/search", + httputil.WithSchema(c, data), + ) +}