Plugin
VoiceDownload
Adds a download to voice messages. (Opens a new browser tab)
1
/*2
* FiveCord — a Discord client mod3
* Copyright (c) 2025 FiveCord4
* SPDX-License-Identifier: GPL-3.0-or-later5
*/6
7
import "./style.css";8
9
import { Devs } from "@utils/constants";10
import definePlugin from "@utils/types";11
12
export default definePlugin({13
name: "VoiceDownload",14
description: "Adds a download to voice messages. (Opens a new browser tab)",15
tags: ["Voice", "Media"],16
authors: [Devs.FiveCord],17
patches: [18
{19
find: "#{intl::VOICE_MESSAGES_PLAYBACK_RATE_LABEL}",20
replacement: {21
match: /(?<=onVolumeHide:\i\}\))/,22
replace: ",$self.renderDownload(arguments[0].src)"23
}24
}25
],26
27
renderDownload(src: string) {28
return (29
<a30
className="vc-voice-download"31
href={src}32
onClick={e => e.stopPropagation()}33
aria-label="Download voice message"34
{...IS_DISCORD_DESKTOP35
? { target: "_blank" } class="ts-cmt">// open externally36
: { download: "voice-message.ogg" } class="ts-cmt">// download directly (not supported on discord desktop)37
}38
>39
<this.Icon />40
</a>41
);42
},43
44
Icon: () => (45
<svg46
height="24"47
width="24"48
viewBox="0 0 24 24"49
fill="currentColor"50
>51
<path52
d="M12 2a1 1 0 0 1 1 1v10.59l3.3-3.3a1 1 0 1 1 1.4 1.42l-5 5a1 1 0 0 1-1.4 0l-5-5a1 1 0 1 1 1.4-1.42l3.3 3.3V3a1 1 0 0 1 1-1ZM3 20a1 1 0 1 0 0 2h18a1 1 0 1 0 0-2H3Z"53
/>54
</svg>55
),56
});57