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>
This commit is contained in:
parent
957307d5f0
commit
65bb5f34da
2 changed files with 13 additions and 3 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue