aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorV <vendicated@riseup.net>2023-07-26 01:27:04 +0200
committerGitHub <noreply@github.com>2023-07-26 01:27:04 +0200
commit8620a1d86d302c23d51c1f6795f32cc8eb5e9207 (patch)
treed3144c2c84173c3d614499080505395f8b64352f /src/main
parent198b35ffdce1ca7ba316409774bc816ac5b58e57 (diff)
downloadVencord-8620a1d86d302c23d51c1f6795f32cc8eb5e9207.tar.gz
Vencord-8620a1d86d302c23d51c1f6795f32cc8eb5e9207.tar.bz2
Vencord-8620a1d86d302c23d51c1f6795f32cc8eb5e9207.zip
New plugin: VoiceMessages (#1380)
Co-authored-by: V <vendicated@riseup.net> Co-authored-by: Justice Almanzar <superdash993@gmail.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/ipcPlugins.ts18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/main/ipcPlugins.ts b/src/main/ipcPlugins.ts
index ac2f3d7..7ab4c25 100644
--- a/src/main/ipcPlugins.ts
+++ b/src/main/ipcPlugins.ts
@@ -17,8 +17,10 @@
*/
import { IpcEvents } from "@utils/IpcEvents";
-import { ipcMain } from "electron";
+import { app, ipcMain } from "electron";
+import { readFile } from "fs/promises";
import { request } from "https";
+import { join } from "path";
// #region OpenInApp
// These links don't support CORS, so this has to be native
@@ -44,3 +46,17 @@ ipcMain.handle(IpcEvents.OPEN_IN_APP__RESOLVE_REDIRECT, async (_, url: string) =
return getRedirect(url);
});
// #endregion
+
+
+// #region VoiceMessages
+ipcMain.handle(IpcEvents.VOICE_MESSAGES_READ_RECORDING, async () => {
+ const path = join(app.getPath("userData"), "module_data/discord_voice/recording.ogg");
+ try {
+ const buf = await readFile(path);
+ return new Uint8Array(buf.buffer);
+ } catch {
+ return null;
+ }
+});
+
+// #endregion