From 25dc25c707fe6582a7aea1f5c5ccf68ef0b48987 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Thu, 26 Oct 2023 02:28:17 +0200 Subject: [PATCH] Fix VoiceMessages --- src/plugins/voiceMessages/VoicePreview.tsx | 4 ++-- src/plugins/voiceMessages/index.tsx | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/voiceMessages/VoicePreview.tsx b/src/plugins/voiceMessages/VoicePreview.tsx index 70830a920..912c55ae0 100644 --- a/src/plugins/voiceMessages/VoicePreview.tsx +++ b/src/plugins/voiceMessages/VoicePreview.tsx @@ -17,7 +17,7 @@ */ import { LazyComponent, useTimer } from "@utils/react"; -import { findByCode } from "@webpack"; +import { find } from "@webpack"; import { cl } from "./utils"; @@ -25,7 +25,7 @@ interface VoiceMessageProps { src: string; waveform: string; } -const VoiceMessage = LazyComponent(() => findByCode('["onVolumeChange","volume","onMute"]')); +const VoiceMessage = LazyComponent(() => find(m => m.type?.toString().includes("waveform:"))); export type VoicePreviewOptions = { src?: string; diff --git a/src/plugins/voiceMessages/index.tsx b/src/plugins/voiceMessages/index.tsx index 1b8d7a4e4..7c8a06943 100644 --- a/src/plugins/voiceMessages/index.tsx +++ b/src/plugins/voiceMessages/index.tsx @@ -25,7 +25,7 @@ import { ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, openModa import { useAwaiter } from "@utils/react"; import definePlugin from "@utils/types"; import { chooseFile } from "@utils/web"; -import { findByPropsLazy, findLazy, findStoreLazy } from "@webpack"; +import { findByPropsLazy, findStoreLazy } from "@webpack"; import { Button, FluxDispatcher, Forms, lodash, Menu, PermissionsBits, PermissionStore, RestAPI, SelectedChannelStore, showToast, SnowflakeUtils, Toasts, useEffect, useState } from "@webpack/common"; import { ComponentType } from "react"; @@ -35,7 +35,7 @@ import { cl } from "./utils"; import { VoicePreview } from "./VoicePreview"; import { VoiceRecorderWeb } from "./WebRecorder"; -const CloudUpload = findLazy(m => m.prototype?.uploadFileToCloud); +const CloudUtils = findByPropsLazy("CloudUpload"); const MessageCreator = findByPropsLazy("getSendMessageOptionsForReply", "sendMessage"); const PendingReplyStore = findStoreLazy("PendingReplyStore"); const OptionClasses = findByPropsLazy("optionName", "optionIcon", "optionLabel"); @@ -76,7 +76,7 @@ function sendAudio(blob: Blob, meta: AudioMetadata) { const reply = PendingReplyStore.getPendingReply(channelId); if (reply) FluxDispatcher.dispatch({ type: "DELETE_PENDING_REPLY", channelId }); - const upload = new CloudUpload({ + const upload = new CloudUtils.CloudUpload({ file: new File([blob], "voice-message.ogg", { type: "audio/ogg; codecs=opus" }), isClip: false, isThumbnail: false,