New plugin: VoiceMessages (#1380)

Co-authored-by: V <vendicated@riseup.net>
Co-authored-by: Justice Almanzar <superdash993@gmail.com>
This commit is contained in:
V 2023-07-26 01:27:04 +02:00 committed by GitHub
parent 198b35ffdc
commit 8620a1d86d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 660 additions and 37 deletions

View file

@ -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