mirror of
https://github.com/Equicord/Equicord.git
synced 2025-02-20 15:18:50 -05:00
Stumped for now
This commit is contained in:
parent
62d73e2ddc
commit
0bdc1f9aaf
2 changed files with 4 additions and 50 deletions
|
@ -6,14 +6,12 @@
|
|||
|
||||
import { addChatBarButton, removeChatBarButton } from "@api/ChatButtons";
|
||||
import { disableStyle, enableStyle } from "@api/Styles";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Devs, EquicordDevs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
import { findExportedComponentLazy } from "@webpack";
|
||||
import { FluxDispatcher } from "@webpack/common";
|
||||
|
||||
import { ChatBarIcon, LogIcon } from "./components/Icons";
|
||||
import { openSoundBoardLog } from "./components/SoundBoardLog";
|
||||
import { ChatBarIcon } from "./components/Icons";
|
||||
import settings from "./settings";
|
||||
import { updateLoggedSounds } from "./store";
|
||||
import styles from "./styles.css?managed";
|
||||
|
@ -21,31 +19,11 @@ import { getListeners } from "./utils";
|
|||
|
||||
const HeaderBarIcon = findExportedComponentLazy("Icon", "Divider");
|
||||
|
||||
function OpenSBLogsButton() {
|
||||
return (
|
||||
<HeaderBarIcon
|
||||
className="chatBarLogIcon"
|
||||
onClick={() => openSoundBoardLog()}
|
||||
tooltip={"Open SoundBoard Log"}
|
||||
icon={LogIcon}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default definePlugin({
|
||||
name: "SoundBoardLogger",
|
||||
authors: [Devs.Moxxie, EquicordDevs.Fres, Devs.echo, EquicordDevs.thororen],
|
||||
dependencies: ["ChatInputButtonAPI"],
|
||||
settings,
|
||||
patches: [
|
||||
{
|
||||
predicate: () => settings.store.IconLocation === "toolbar",
|
||||
find: "toolbar:function",
|
||||
replacement: {
|
||||
match: /(function \i\(\i\){)(.{1,200}toolbar.{1,100}mobileToolbar)/,
|
||||
replace: "$1$self.addSBIconToToolBar(arguments[0]);$2"
|
||||
}
|
||||
}
|
||||
],
|
||||
description: "Logs all soundboards that are played in a voice chat and allows you to download them",
|
||||
start() {
|
||||
enableStyle(styles);
|
||||
|
@ -54,25 +32,10 @@ export default definePlugin({
|
|||
await updateLoggedSounds(sound);
|
||||
getListeners().forEach(cb => cb());
|
||||
});
|
||||
if (settings.store.IconLocation === "chat") addChatBarButton("vc-soundlog-button", ChatBarIcon);
|
||||
addChatBarButton("vc-soundlog-button", ChatBarIcon);
|
||||
},
|
||||
stop() {
|
||||
disableStyle(styles);
|
||||
if (settings.store.IconLocation === "chat") removeChatBarButton("vc-soundlog-button");
|
||||
},
|
||||
addSBIconToToolBar(e: { toolbar: React.ReactNode[] | React.ReactNode; }) {
|
||||
if (Array.isArray(e.toolbar))
|
||||
return e.toolbar.push(
|
||||
<ErrorBoundary noop={true}>
|
||||
<OpenSBLogsButton />
|
||||
</ErrorBoundary>
|
||||
);
|
||||
|
||||
e.toolbar = [
|
||||
<ErrorBoundary noop={true}>
|
||||
<OpenSBLogsButton />
|
||||
</ErrorBoundary>,
|
||||
e.toolbar,
|
||||
];
|
||||
removeChatBarButton("vc-soundlog-button");
|
||||
}
|
||||
});
|
||||
|
|
|
@ -73,15 +73,6 @@ const settings = definePluginSettings({
|
|||
{ label: ".wav", value: ".wav" },
|
||||
],
|
||||
},
|
||||
IconLocation: {
|
||||
description: "choose where to show the SoundBoard Log icon (requires restart)",
|
||||
type: OptionType.SELECT,
|
||||
options: [
|
||||
{ label: "Toolbar", value: "toolbar", default: true },
|
||||
{ label: "Chat input", value: "chat" }
|
||||
],
|
||||
restartNeeded: true
|
||||
},
|
||||
OpenLogs: {
|
||||
type: OptionType.COMPONENT,
|
||||
description: "show the logs",
|
||||
|
|
Loading…
Add table
Reference in a new issue