mirror of
https://github.com/Equicord/Equicord.git
synced 2025-02-21 15:48:52 -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 { addChatBarButton, removeChatBarButton } from "@api/ChatButtons";
|
||||||
import { disableStyle, enableStyle } from "@api/Styles";
|
import { disableStyle, enableStyle } from "@api/Styles";
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
|
||||||
import { Devs, EquicordDevs } from "@utils/constants";
|
import { Devs, EquicordDevs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
import { findExportedComponentLazy } from "@webpack";
|
import { findExportedComponentLazy } from "@webpack";
|
||||||
import { FluxDispatcher } from "@webpack/common";
|
import { FluxDispatcher } from "@webpack/common";
|
||||||
|
|
||||||
import { ChatBarIcon, LogIcon } from "./components/Icons";
|
import { ChatBarIcon } from "./components/Icons";
|
||||||
import { openSoundBoardLog } from "./components/SoundBoardLog";
|
|
||||||
import settings from "./settings";
|
import settings from "./settings";
|
||||||
import { updateLoggedSounds } from "./store";
|
import { updateLoggedSounds } from "./store";
|
||||||
import styles from "./styles.css?managed";
|
import styles from "./styles.css?managed";
|
||||||
|
@ -21,31 +19,11 @@ import { getListeners } from "./utils";
|
||||||
|
|
||||||
const HeaderBarIcon = findExportedComponentLazy("Icon", "Divider");
|
const HeaderBarIcon = findExportedComponentLazy("Icon", "Divider");
|
||||||
|
|
||||||
function OpenSBLogsButton() {
|
|
||||||
return (
|
|
||||||
<HeaderBarIcon
|
|
||||||
className="chatBarLogIcon"
|
|
||||||
onClick={() => openSoundBoardLog()}
|
|
||||||
tooltip={"Open SoundBoard Log"}
|
|
||||||
icon={LogIcon}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "SoundBoardLogger",
|
name: "SoundBoardLogger",
|
||||||
authors: [Devs.Moxxie, EquicordDevs.Fres, Devs.echo, EquicordDevs.thororen],
|
authors: [Devs.Moxxie, EquicordDevs.Fres, Devs.echo, EquicordDevs.thororen],
|
||||||
|
dependencies: ["ChatInputButtonAPI"],
|
||||||
settings,
|
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",
|
description: "Logs all soundboards that are played in a voice chat and allows you to download them",
|
||||||
start() {
|
start() {
|
||||||
enableStyle(styles);
|
enableStyle(styles);
|
||||||
|
@ -54,25 +32,10 @@ export default definePlugin({
|
||||||
await updateLoggedSounds(sound);
|
await updateLoggedSounds(sound);
|
||||||
getListeners().forEach(cb => cb());
|
getListeners().forEach(cb => cb());
|
||||||
});
|
});
|
||||||
if (settings.store.IconLocation === "chat") addChatBarButton("vc-soundlog-button", ChatBarIcon);
|
addChatBarButton("vc-soundlog-button", ChatBarIcon);
|
||||||
},
|
},
|
||||||
stop() {
|
stop() {
|
||||||
disableStyle(styles);
|
disableStyle(styles);
|
||||||
if (settings.store.IconLocation === "chat") removeChatBarButton("vc-soundlog-button");
|
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,
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -73,15 +73,6 @@ const settings = definePluginSettings({
|
||||||
{ label: ".wav", value: ".wav" },
|
{ 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: {
|
OpenLogs: {
|
||||||
type: OptionType.COMPONENT,
|
type: OptionType.COMPONENT,
|
||||||
description: "show the logs",
|
description: "show the logs",
|
||||||
|
|
Loading…
Add table
Reference in a new issue