vd-plugins/plugins/Commands/settings/settings.tsx

234 lines
8.2 KiB
TypeScript
Raw Normal View History

import { storage } from "@vendetta/plugin";
import { useProxy } from "@vendetta/storage";
import { React } from "@vendetta/metro/common";
import { NavigationNative } from "@vendetta/metro/common";
import { alerts } from "@vendetta/ui";
import {
ScrollView,
Stack,
TableRowGroup,
TableRow,
} from "./components/TableComponents";
import Header from "./components/Header";
import FactsSettingsPage from "./pages/FactsSettingsPage";
import ListSettingsPage from "./pages/ListSettingsPage";
import ImageSettingsPage from "./pages/ImageSettingsPage";
import GaryAPIPage from "./pages/GaryAPIPage";
import SpotifySettingsPage from "./pages/SpotifySettingsPage";
import AliucordPage from "./pages/AliucordPage";
import OtherSettingsPage from "./pages/OtherSettingsPage";
import HiddenSettingsPage from "./pages/HiddenSettingsPage";
import CreditsPage from "./pages/CreditsPage";
if (storage.factSettings == null) {
storage.factSettings = {
sendAsReply: true,
includeCitation: false,
};
}
if (storage.listSettings == null) {
storage.listSettings = {
pluginListAlwaysDetailed: false,
themeListAlwaysDetailed: false,
};
}
if (storage.garySettings == null) {
storage.garySettings = {
imageSource: "gary",
};
}
if (storage.enabledCommands == null) {
storage.enabledCommands = {
catfact: true,
dogfact: true,
useless: true,
petpet: true,
pluginList: true,
themeList: true,
konoself: true,
konosend: true,
firstmessage: true,
sysinfo: true,
spotifyTrack: true,
spotifyAlbum: true,
spotifyArtists: true,
spotifyCover: true,
gary: true,
ip: true,
lovefemboys: false,
nekoslife: false,
friendInviteCreate: true,
friendInviteView: true,
friendInviteRevoke: true,
};
}
if (storage.pendingRestart == null) {
storage.pendingRestart = false;
}
if (storage.hiddenSettings == null) {
storage.hiddenSettings = {
enabled: false,
visible: false,
konochanBypassNsfw: false,
};
}
if (storage.sidebarEnabled == null) {
storage.sidebarEnabled = true;
}
export default function Settings() {
2026-05-09 10:20:55 +02:00
useProxy(storage);
const navigation = NavigationNative.useNavigation();
2026-05-09 10:20:55 +02:00
React.useEffect(() => {
return () => {
if (storage.pendingRestart) {
storage.pendingRestart = false;
alerts.showConfirmationAlert({
title: "Restart Required",
content:
"You have made changes to commands. Please restart Discord to apply these changes.",
2026-05-09 10:20:55 +02:00
confirmText: "Okay",
cancelText: null,
onConfirm: () => {},
});
}
2026-05-09 10:20:55 +02:00
};
}, []);
const garySourceLabel =
storage.garySettings.imageSource === "gary"
? "Gary API"
: storage.garySettings.imageSource === "catapi"
? "Cat API"
: storage.garySettings.imageSource === "minker"
? "Minker API"
: storage.garySettings.imageSource === "goober"
? "Goober API"
: "Gary API";
return (
<ScrollView style={{ flex: 1 }} contentContainerStyle={{ padding: 10 }}>
<Header />
<Stack spacing={12}>
<TableRowGroup title="Command Categories">
<TableRow
2026-05-09 10:20:55 +02:00
label="Facts Commands"
subLabel="Cat facts, dog facts, and useless facts"
trailing={<TableRow.Arrow />}
2026-05-09 10:20:55 +02:00
onPress={() =>
navigation.push("VendettaCustomPage", {
title: "Facts Commands",
render: FactsSettingsPage,
})
}
/>
<TableRow
2026-05-09 10:20:55 +02:00
label="List Commands"
subLabel="Plugin lists and theme lists"
trailing={<TableRow.Arrow />}
2026-05-09 10:20:55 +02:00
onPress={() =>
navigation.push("VendettaCustomPage", {
title: "List Commands",
render: ListSettingsPage,
})
}
/>
<TableRow
2026-05-09 10:20:55 +02:00
label="Image Commands"
subLabel="PetPet, KonoChan, and image utilities"
trailing={<TableRow.Arrow />}
2026-05-09 10:20:55 +02:00
onPress={() =>
navigation.push("VendettaCustomPage", {
title: "Image Commands",
render: ImageSettingsPage,
})
}
/>
<TableRow
2026-05-09 10:20:55 +02:00
label="Gary Commands"
subLabel={`Gary images - Current: ${garySourceLabel}`}
trailing={<TableRow.Arrow />}
2026-05-09 10:20:55 +02:00
onPress={() =>
navigation.push("VendettaCustomPage", {
title: "Gary Commands",
render: GaryAPIPage,
})
}
/>
<TableRow
2026-05-09 10:20:55 +02:00
label="Spotify Commands"
subLabel="Share your Spotify activity"
trailing={<TableRow.Arrow />}
2026-05-09 10:20:55 +02:00
onPress={() =>
navigation.push("VendettaCustomPage", {
title: "Spotify Commands",
render: SpotifySettingsPage,
})
}
/>
<TableRow
2026-05-09 10:20:55 +02:00
label="Aliucord Commands"
subLabel="Commands from Aliucord"
trailing={<TableRow.Arrow />}
2026-05-09 10:20:55 +02:00
onPress={() =>
navigation.push("VendettaCustomPage", {
title: "Aliucord",
render: AliucordPage,
})
}
/>
<TableRow
2026-05-09 10:20:55 +02:00
label="Other Commands"
subLabel="Utility and system commands"
trailing={<TableRow.Arrow />}
2026-05-09 10:20:55 +02:00
onPress={() =>
navigation.push("VendettaCustomPage", {
title: "Other Commands",
render: OtherSettingsPage,
})
}
/>
</TableRowGroup>
2026-05-09 10:20:55 +02:00
{storage.hiddenSettings?.visible && (
<TableRowGroup title="Hidden Settings">
<TableRow
2026-05-09 10:20:55 +02:00
label="Hidden Commands"
subLabel="Access to experimental and NSFW commands"
trailing={<TableRow.Arrow />}
2026-05-09 10:20:55 +02:00
onPress={() =>
navigation.push("VendettaCustomPage", {
title: "Hidden Settings",
render: HiddenSettingsPage,
})
}
/>
</TableRowGroup>
2026-05-09 10:20:55 +02:00
)}
<TableRowGroup title="Other">
<TableRow
2026-05-09 10:20:55 +02:00
label="Credits"
subLabel="View original authors of the plugins"
trailing={<TableRow.Arrow />}
2026-05-09 10:20:55 +02:00
onPress={() =>
navigation.push("VendettaCustomPage", {
title: "Credits",
render: CreditsPage,
})
}
/>
</TableRowGroup>
</Stack>
</ScrollView>
2026-05-09 10:20:55 +02:00
);
}