From 65bb5f34dac44252dfb67e2d12109746dc948a15 Mon Sep 17 00:00:00 2001 From: Cherry <78418245+Blossomical@users.noreply.github.com> Date: Sun, 20 Sep 2026 00:56:38 +0100 Subject: [PATCH] Allow users to Reply to a Message with a Clip (#1363) add message_reference so it can let people reply to a message instead of sending it directly to the channel Co-authored-by: Cherry <78418245+Cherif107@users.noreply.github.com> --- .../clipUpload.desktop/UploadClipFileModal.tsx | 8 ++++++-- src/equicordplugins/clipUpload.desktop/upload.ts | 8 +++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/equicordplugins/clipUpload.desktop/UploadClipFileModal.tsx b/src/equicordplugins/clipUpload.desktop/UploadClipFileModal.tsx index 640199871..f5552c7bc 100644 --- a/src/equicordplugins/clipUpload.desktop/UploadClipFileModal.tsx +++ b/src/equicordplugins/clipUpload.desktop/UploadClipFileModal.tsx @@ -9,7 +9,7 @@ import { Flex } from "@components/Flex"; import { Heading } from "@components/Heading"; import { Paragraph } from "@components/Paragraph"; import type { RenderModalProps } from "@vencord/discord-types"; -import { Checkbox, Modal, openModal, showToast, Toasts, useEffect, useState } from "@webpack/common"; +import { Checkbox, FluxDispatcher, MessageActions, Modal, openModal, PendingReplyStore, showToast, Toasts, useEffect, useState } from "@webpack/common"; import { ApplicationField, BooleanField, DateTimeField, getDateTimeLocalValue, ParticipantField, TextField } from "./fields"; import { abortActiveClipUploads, type ClipMetadata, getClipCreatedAt, getClipTitleFromName, getDefaultClipTitle, getDefaultFileName, getErrorMessage, getParticipantIds, getString, isValidDate, pickClipFile, uploadClipFile } from "./upload"; @@ -76,6 +76,9 @@ function UploadClipFileModal({ modalProps, channelId, clip }: { modalProps: Rend setUploading(true); + const reply = PendingReplyStore.getPendingReply(channelId); + if (reply) FluxDispatcher.dispatch({ type: "DELETE_PENDING_REPLY", channelId }); + const success = await uploadClipFile(file, { fileName: fileName.trim(), participants, @@ -88,7 +91,8 @@ function UploadClipFileModal({ modalProps, channelId, clip }: { modalProps: Rend channelId, applicationId: applicationId.trim() || undefined, remoteClipId: getString(clip?.remoteClipId), - eventsTimeline: clip?.eventsTimeline + eventsTimeline: clip?.eventsTimeline, + messageReference: reply ? MessageActions.getSendMessageOptionsForReply(reply)?.messageReference : null, }); if (success) { diff --git a/src/equicordplugins/clipUpload.desktop/upload.ts b/src/equicordplugins/clipUpload.desktop/upload.ts index f5440302e..b93fdef02 100644 --- a/src/equicordplugins/clipUpload.desktop/upload.ts +++ b/src/equicordplugins/clipUpload.desktop/upload.ts @@ -41,6 +41,11 @@ export interface ClipUploadOptions { applicationId?: string; remoteClipId?: string; eventsTimeline?: unknown; + messageReference?: { + message_id: string; + channel_id: string; + guild_id?: string; + }; } interface AttachmentUploadResponse { @@ -285,7 +290,8 @@ async function sendClipUpload(uploadFile: File, options: ClipUploadOptions) { clip_participant_ids: options.participants, clip_remote_id: options.remoteClipId, clip_events_timeline: options.eventsTimeline - }] + }], + message_reference: options.messageReference, } }) as RestResponse;