diff --git a/src/suncordplugins/soundBoardLogger/components/CloneSoundModal.tsx b/src/suncordplugins/soundBoardLogger/components/CloneSoundModal.tsx
index 3f4e3945..fcd10f03 100644
--- a/src/suncordplugins/soundBoardLogger/components/CloneSoundModal.tsx
+++ b/src/suncordplugins/soundBoardLogger/components/CloneSoundModal.tsx
@@ -1,32 +1,20 @@
/*
- * Vencord, a modification for Discord's desktop app
+ * Vencord, a Discord client mod
* Copyright (c) 2023 Vendicated and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
-*/
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
import { Flex } from "@components/Flex";
import { Margins } from "@utils/margins";
import { classes } from "@utils/misc";
-import { closeModal, ModalCloseButton, ModalContent, ModalHeader, ModalRoot, openModal } from "@utils/modal";
+import { closeModal, ModalCloseButton,ModalContent, ModalHeader, ModalRoot, openModal } from "@utils/modal";
import { LazyComponent } from "@utils/react";
import { find, findByPropsLazy } from "@webpack";
import { Button, Clickable, Forms, GuildStore, PermissionsBits, PermissionStore, Popout, SearchableSelect, showToast, Text, TextInput, Toasts, useMemo, UserStore, useState } from "@webpack/common";
import { Guild } from "discord-types/general";
import { HtmlHTMLAttributes } from "react";
-import { cl, getEmojiUrl, SoundEvent } from "../utils";
+import { cl, getEmojiUrl,SoundEvent } from "../utils";
export function openCloneSoundModal(item) {
const key = openModal(props =>
diff --git a/src/suncordplugins/soundBoardLogger/components/Icons.tsx b/src/suncordplugins/soundBoardLogger/components/Icons.tsx
index 99fa9432..fe67ccfe 100644
--- a/src/suncordplugins/soundBoardLogger/components/Icons.tsx
+++ b/src/suncordplugins/soundBoardLogger/components/Icons.tsx
@@ -1,20 +1,8 @@
/*
- * Vencord, a modification for Discord's desktop app
+ * Vencord, a Discord client mod
* Copyright (c) 2023 Vendicated and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
-*/
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
import { ChatBarButton } from "@api/ChatButtons";
import { classes } from "@utils/misc";
diff --git a/src/suncordplugins/soundBoardLogger/components/MoreUsersModal.tsx b/src/suncordplugins/soundBoardLogger/components/MoreUsersModal.tsx
index 81075e2b..01181892 100644
--- a/src/suncordplugins/soundBoardLogger/components/MoreUsersModal.tsx
+++ b/src/suncordplugins/soundBoardLogger/components/MoreUsersModal.tsx
@@ -1,27 +1,15 @@
/*
- * Vencord, a modification for Discord's desktop app
+ * Vencord, a Discord client mod
* Copyright (c) 2023 Vendicated and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
-*/
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
import ErrorBoundary from "@components/ErrorBoundary";
import { Flex } from "@components/Flex";
import { closeModal, ModalContent, ModalRoot, openModal } from "@utils/modal";
import { Clickable, Forms } from "@webpack/common";
-import { cl, getEmojiUrl, SoundLogEntry, User } from "../utils";
+import { cl, getEmojiUrl,SoundLogEntry, User } from "../utils";
export function openMoreUsersModal(item: SoundLogEntry, users: User[], onClickUser: Function) {
const key = openModal(props => (
diff --git a/src/suncordplugins/soundBoardLogger/components/SoundBoardLog.tsx b/src/suncordplugins/soundBoardLogger/components/SoundBoardLog.tsx
index a0cca593..e824ef5c 100644
--- a/src/suncordplugins/soundBoardLogger/components/SoundBoardLog.tsx
+++ b/src/suncordplugins/soundBoardLogger/components/SoundBoardLog.tsx
@@ -1,20 +1,8 @@
/*
- * Vencord, a modification for Discord's desktop app
+ * Vencord, a Discord client mod
* Copyright (c) 2023 Vendicated and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
-*/
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
import ErrorBoundary from "@components/ErrorBoundary";
import { Flex } from "@components/Flex";
diff --git a/src/suncordplugins/soundBoardLogger/components/UserModal.tsx b/src/suncordplugins/soundBoardLogger/components/UserModal.tsx
index 1b079d9f..5fd47c22 100644
--- a/src/suncordplugins/soundBoardLogger/components/UserModal.tsx
+++ b/src/suncordplugins/soundBoardLogger/components/UserModal.tsx
@@ -1,20 +1,8 @@
/*
- * Vencord, a modification for Discord's desktop app
+ * Vencord, a Discord client mod
* Copyright (c) 2023 Vendicated and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
-*/
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
import { Flex } from "@components/Flex";
import { CopyIcon } from "@components/Icons";
@@ -23,6 +11,7 @@ import { Margins } from "@utils/margins";
import { classes, copyWithToast } from "@utils/misc";
import { closeModal, ModalContent, ModalRoot, openModal } from "@utils/modal";
import { Clickable, Forms, Text, Timestamp } from "@webpack/common";
+import moment from "moment";
import { AvatarStyles, cl, downloadAudio, getEmojiUrl, playSound, SoundLogEntry, User, UserSummaryItem } from "../utils";
import { DownloadIcon, IconWithTooltip, PlayIcon } from "./Icons";
@@ -64,7 +53,7 @@ export default function UserModal({ item, user, sounds, closeModal }: { item: So
{item.soundId}
Played {currentUser.plays.length} {currentUser.plays.length === 1 ? "time" : "times"}.
- Last played:
+ Last played:
diff --git a/src/suncordplugins/soundBoardLogger/index.tsx b/src/suncordplugins/soundBoardLogger/index.tsx
index 92ed0db3..64262085 100644
--- a/src/suncordplugins/soundBoardLogger/index.tsx
+++ b/src/suncordplugins/soundBoardLogger/index.tsx
@@ -1,28 +1,16 @@
/*
- * Vencord, a modification for Discord's desktop app
- * Copyright (c) 2023 Vendicated and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
-*/
+ * Vencord, a Discord client mod
+ * Copyright (c) 2024 Vendicated and contributors
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+import { addChatBarButton, removeChatBarButton } from "@api/ChatButtons";
import { disableStyle, enableStyle } from "@api/Styles";
-import ErrorBoundary from "@components/ErrorBoundary";
-import { Devs } from "@utils/constants";
+import { Devs, SuncordDevs } from "@utils/constants";
import definePlugin from "@utils/types";
import { FluxDispatcher } from "@webpack/common";
-import { IconWithTooltip, LogIcon } from "./components/Icons";
+import { ChatBarIcon, IconWithTooltip, LogIcon } from "./components/Icons";
import { openSoundBoardLog } from "./components/SoundBoardLog";
import settings from "./settings";
import { updateLoggedSounds } from "./store";
@@ -32,26 +20,13 @@ import { getListeners } from "./utils";
export default definePlugin({
name: "SoundBoardLogger",
authors: [
- {
- id: 712653921692155965n,
- name: "Moxxie",
- },
- {
- id: 843448897737064448n,
- name: "Fres",
- },
- Devs.echo
+ Devs.Moxxie,
+ Devs.Fres,
+ Devs.echo,
+ SuncordDevs.thororen
],
settings,
patches: [
- {
- predicate: () => settings.store.IconLocation === "chat",
- find: "ChannelTextAreaButtons",
- replacement: {
- match: /(\i)\.push.{1,30}disabled:(\i),.{1,20}\},"gift"\)\)/,
- replace: "$&,(()=>{try{$2||$1.push($self.chatBarIcon(arguments[0]))}catch{}})()",
- }
- },
{
predicate: () => settings.store.IconLocation === "toolbar",
find: ".iconBadge}):null",
@@ -69,15 +44,12 @@ export default definePlugin({
await updateLoggedSounds(sound);
getListeners().forEach(cb => cb());
});
+ if (settings.store.IconLocation === "chat") addChatBarButton("vc-soundlog-button", ChatBarIcon);
},
stop() {
disableStyle(styles);
+ if (settings.store.IconLocation === "chat") removeChatBarButton("vc-soundlog-button");
},
- chatBarIcon: (slateProps: any) => (
-
- } onClick={openSoundBoardLog} />
-
- ),
toolbarPatch: obj => {
if (!obj?.props?.children) return obj;
obj.props.children = [} onClick={openSoundBoardLog} />, ...obj.props.children];
diff --git a/src/suncordplugins/soundBoardLogger/settings.tsx b/src/suncordplugins/soundBoardLogger/settings.tsx
index 76ea7334..0f5638c1 100644
--- a/src/suncordplugins/soundBoardLogger/settings.tsx
+++ b/src/suncordplugins/soundBoardLogger/settings.tsx
@@ -1,20 +1,8 @@
/*
- * Vencord, a modification for Discord's desktop app
+ * Vencord, a Discord client mod
* Copyright (c) 2023 Vendicated and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
-*/
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
import { definePluginSettings } from "@api/Settings";
import { OptionType } from "@utils/types";
@@ -76,6 +64,15 @@ const settings = definePluginSettings({
}
},
+ FileType: {
+ description: "the format that you want to save your file",
+ type: OptionType.SELECT,
+ options: [
+ { label: ".ogg", value: ".ogg", default: true },
+ { label: ".mp3", value: ".mp3" },
+ { label: ".wav", value: ".wav" },
+ ],
+ },
IconLocation: {
description: "choose where to show the SoundBoard Log icon (requires restart)",
type: OptionType.SELECT,
diff --git a/src/suncordplugins/soundBoardLogger/store.tsx b/src/suncordplugins/soundBoardLogger/store.tsx
index 118c39bb..4532e1f4 100644
--- a/src/suncordplugins/soundBoardLogger/store.tsx
+++ b/src/suncordplugins/soundBoardLogger/store.tsx
@@ -1,20 +1,8 @@
/*
- * Vencord, a modification for Discord's desktop app
+ * Vencord, a Discord client mod
* Copyright (c) 2023 Vendicated and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
-*/
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
import { DataStore } from "@api/index";
diff --git a/src/suncordplugins/soundBoardLogger/styles.css b/src/suncordplugins/soundBoardLogger/styles.css
index ce367102..fbe2c341 100644
--- a/src/suncordplugins/soundBoardLogger/styles.css
+++ b/src/suncordplugins/soundBoardLogger/styles.css
@@ -16,7 +16,7 @@
text-align: center;
margin-top: 10px;
padding-left: 10px;
- padding-right: 10px;
+ padding-right: 10px
}
.vc-soundlog-more-user-profile,
@@ -37,6 +37,7 @@
flex: 2;
}
+
.vc-soundlog-sound-emoji {
width: 24px;
height: 24px;
@@ -55,8 +56,7 @@
width: fit-content;
}
-/* stylelint-disable-next-line selector-class-pattern */
-.vc-soundlog-more-soundId,
+.vc-soundlog-more-soundid,
.vc-soundlog-user-name {
text-transform: none;
flex-grow: 0;
@@ -69,8 +69,7 @@
text-wrap: nowrap;
}
-/* stylelint-disable-next-line selector-class-pattern */
-.vc-soundlog-more-soundId {
+.vc-soundlog-more-soundid {
background: unset;
}
@@ -86,6 +85,7 @@
top: 0;
}
+
.vc-soundlog-more-emoji,
.vc-soundlog-user-avatar {
height: 32px;
diff --git a/src/suncordplugins/soundBoardLogger/utils.ts b/src/suncordplugins/soundBoardLogger/utils.ts
index 23c946a8..f7e99e2b 100644
--- a/src/suncordplugins/soundBoardLogger/utils.ts
+++ b/src/suncordplugins/soundBoardLogger/utils.ts
@@ -1,20 +1,8 @@
/*
- * Vencord, a modification for Discord's desktop app
- * Copyright (c) 2022 Vendicated and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
-*/
+ * Vencord, a Discord client mod
+ * Copyright (c) 2023 Vendicated and contributors
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
import { classNameFactory } from "@api/Styles";
import { proxyLazy } from "@utils/lazy";
@@ -23,6 +11,8 @@ import { saveFile } from "@utils/web";
import { findByCode, findByProps, findByPropsLazy } from "@webpack";
import type { User } from "discord-types/general";
+import settings from "./settings";
+
export { User };
export interface SoundEvent {
@@ -60,16 +50,13 @@ export const playSound = id => {
audio.play();
};
-const saveFileModule = findByPropsLazy("saveFile");
-
export async function downloadAudio(id: string): Promise {
- const filename = id + ".ogg";
- const uri = `https://cdn.discordapp.com/soundboard-sounds/${id}`;
- const data = await fetch(uri).then(e => e.arrayBuffer());
+ const filename = id + settings.store.FileType;
+ const data = await fetch(`https://cdn.discordapp.com/soundboard-sounds/${id}`).then(e => e.arrayBuffer());
if (IS_DISCORD_DESKTOP) {
- saveFileModule.saveFile(uri, filename);
+ DiscordNative.fileManager.saveWithDialog(data, filename);
} else {
saveFile(new File([data], filename, { type: "audio/ogg" }));
}
@@ -92,4 +79,3 @@ export function removeListener(fn): void {
// Taken from https://github.com/Vendicated/Vencord/blob/86e94343cca10b950f2dc8d18d496d6db9f3b728/src/components/PluginSettings/PluginModal.tsx#L45
export const UserSummaryItem = LazyComponent(() => findByCode("defaultRenderUser", "showDefaultAvatarsForNullUsers"));
export const AvatarStyles = findByPropsLazy("moreUsers", "emptyUser", "avatarContainer", "clickableAvatar");
-// a