feat(server): include content filter in search messages handler

- Added content parameter to searchMessagesHandler
- Updated URLSearchParams to append content if provided
This commit is contained in:
Sooty 2025-10-15 16:37:50 +01:00
parent 457b1e11f3
commit 70c4843d9e
1 changed files with 2 additions and 1 deletions

View File

@ -9,7 +9,7 @@ export async function searchMessagesHandler(
args: unknown, args: unknown,
context: ToolContext context: ToolContext
): Promise<ToolResponse> { ): Promise<ToolResponse> {
const { guildId, authorId, mentions, has, maxId, minId, channelId, pinned, authorType, sortBy, sortOrder, limit, offset } = SearchMessagesSchema.parse(args); const { guildId, content, authorId, mentions, has, maxId, minId, channelId, pinned, authorType, sortBy, sortOrder, limit, offset } = SearchMessagesSchema.parse(args);
try { try {
if (!context.client.isReady()) { if (!context.client.isReady()) {
return { return {
@ -30,6 +30,7 @@ export async function searchMessagesHandler(
// This requires direct API calls or using a library that supports it. // This requires direct API calls or using a library that supports it.
// Here we will construct the API request using context.client.rest // Here we will construct the API request using context.client.rest
const params = new URLSearchParams(); const params = new URLSearchParams();
if (content) params.append('content', content);
if (authorId) params.append('author_id', authorId); if (authorId) params.append('author_id', authorId);
if (mentions) params.append('mentions', mentions); if (mentions) params.append('mentions', mentions);
if (has) params.append('has', has); if (has) params.append('has', has);