Refactor settings layout and add NSFW warning dialog for KonoChan
This commit is contained in:
parent
0e7bb55c46
commit
bfb9a4e454
2 changed files with 63 additions and 48 deletions
|
|
@ -37,7 +37,7 @@ export default function Settings() {
|
||||||
<ScrollView style={{ flex: 1 }}>
|
<ScrollView style={{ flex: 1 }}>
|
||||||
<Stack spacing={8}>
|
<Stack spacing={8}>
|
||||||
{/* Facts Commands Settings */}
|
{/* Facts Commands Settings */}
|
||||||
<TableRowGroup title="Facts Settings">
|
<TableRowGroup title="Facts Commands">
|
||||||
<TableSwitchRow
|
<TableSwitchRow
|
||||||
label="Send as Reply"
|
label="Send as Reply"
|
||||||
subLabel="Send facts as a reply to the command message"
|
subLabel="Send facts as a reply to the command message"
|
||||||
|
|
@ -58,38 +58,6 @@ export default function Settings() {
|
||||||
forceRerender();
|
forceRerender();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</TableRowGroup>
|
|
||||||
|
|
||||||
{/* Plugin List Settings */}
|
|
||||||
<TableRowGroup title="Plugin List Settings">
|
|
||||||
<TableSwitchRow
|
|
||||||
label="Always Send Detailed List"
|
|
||||||
subLabel="Always use detailed mode when listing plugins"
|
|
||||||
icon={getAssetIDByName("ic_message_copy")}
|
|
||||||
value={storage.listSettings.pluginListAlwaysDetailed}
|
|
||||||
onValueChange={(v: boolean) => {
|
|
||||||
storage.listSettings.pluginListAlwaysDetailed = v;
|
|
||||||
forceRerender();
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</TableRowGroup>
|
|
||||||
|
|
||||||
{/* Theme List Settings */}
|
|
||||||
<TableRowGroup title="Theme List Settings">
|
|
||||||
<TableSwitchRow
|
|
||||||
label="Always Send Detailed List"
|
|
||||||
subLabel="Always use detailed mode when listing themes"
|
|
||||||
icon={getAssetIDByName("ic_theme")}
|
|
||||||
value={storage.listSettings.themeListAlwaysDetailed}
|
|
||||||
onValueChange={(v: boolean) => {
|
|
||||||
storage.listSettings.themeListAlwaysDetailed = v;
|
|
||||||
forceRerender();
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</TableRowGroup>
|
|
||||||
|
|
||||||
{/* Commands Overview */}
|
|
||||||
<TableRowGroup title="Available Commands">
|
|
||||||
<TableSwitchRow
|
<TableSwitchRow
|
||||||
label="/catfact"
|
label="/catfact"
|
||||||
subLabel="Get random cat facts"
|
subLabel="Get random cat facts"
|
||||||
|
|
@ -111,12 +79,29 @@ export default function Settings() {
|
||||||
value={true}
|
value={true}
|
||||||
disabled={true}
|
disabled={true}
|
||||||
/>
|
/>
|
||||||
|
</TableRowGroup>
|
||||||
|
|
||||||
|
{/* List Commands Settings */}
|
||||||
|
<TableRowGroup title="List Commands">
|
||||||
<TableSwitchRow
|
<TableSwitchRow
|
||||||
label="/petpet"
|
label="Always Send Detailed Plugin List"
|
||||||
subLabel="Create pet-pet GIF of a user"
|
subLabel="Always use detailed mode when listing plugins"
|
||||||
icon={getAssetIDByName("ic_image")}
|
icon={getAssetIDByName("ic_message_copy")}
|
||||||
value={true}
|
value={storage.listSettings.pluginListAlwaysDetailed}
|
||||||
disabled={true}
|
onValueChange={(v: boolean) => {
|
||||||
|
storage.listSettings.pluginListAlwaysDetailed = v;
|
||||||
|
forceRerender();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<TableSwitchRow
|
||||||
|
label="Always Send Detailed Theme List"
|
||||||
|
subLabel="Always use detailed mode when listing themes"
|
||||||
|
icon={getAssetIDByName("ic_theme")}
|
||||||
|
value={storage.listSettings.themeListAlwaysDetailed}
|
||||||
|
onValueChange={(v: boolean) => {
|
||||||
|
storage.listSettings.themeListAlwaysDetailed = v;
|
||||||
|
forceRerender();
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<TableSwitchRow
|
<TableSwitchRow
|
||||||
label="/plugin-list"
|
label="/plugin-list"
|
||||||
|
|
@ -132,9 +117,31 @@ export default function Settings() {
|
||||||
value={true}
|
value={true}
|
||||||
disabled={true}
|
disabled={true}
|
||||||
/>
|
/>
|
||||||
|
</TableRowGroup>
|
||||||
|
|
||||||
|
{/* Image Commands */}
|
||||||
|
<TableRowGroup title="Image Commands">
|
||||||
<TableSwitchRow
|
<TableSwitchRow
|
||||||
label="/konoself, /konosend"
|
label="/petpet"
|
||||||
subLabel="Get random images from KonoChan"
|
subLabel="Create pet-pet GIF of a user"
|
||||||
|
icon={getAssetIDByName("ic_image")}
|
||||||
|
value={true}
|
||||||
|
disabled={true}
|
||||||
|
/>
|
||||||
|
</TableRowGroup>
|
||||||
|
|
||||||
|
{/* KonoChan Commands */}
|
||||||
|
<TableRowGroup title="KonoChan Commands">
|
||||||
|
<TableSwitchRow
|
||||||
|
label="/konoself"
|
||||||
|
subLabel="Get random image from KonoChan (private)"
|
||||||
|
icon={getAssetIDByName("ic_image")}
|
||||||
|
value={true}
|
||||||
|
disabled={true}
|
||||||
|
/>
|
||||||
|
<TableSwitchRow
|
||||||
|
label="/konosend"
|
||||||
|
subLabel="Send random image from KonoChan to channel"
|
||||||
icon={getAssetIDByName("ic_image")}
|
icon={getAssetIDByName("ic_image")}
|
||||||
value={true}
|
value={true}
|
||||||
disabled={true}
|
disabled={true}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { findByProps } from "@vendetta/metro";
|
import { findByProps } from "@vendetta/metro";
|
||||||
|
import { alerts } from "@vendetta/ui";
|
||||||
import { sendMessage } from "../utils/messages";
|
import { sendMessage } from "../utils/messages";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -37,6 +38,17 @@ const nsfwOption = {
|
||||||
displayDescription: "Include NSFW content?",
|
displayDescription: "Include NSFW content?",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const showNSFWWarning = () => {
|
||||||
|
return alerts.showConfirmationAlert({
|
||||||
|
title: "NSFW Content Warning",
|
||||||
|
content: "NSFW content can only be sent in NSFW channels!",
|
||||||
|
confirmText: "Okay",
|
||||||
|
cancelText: null,
|
||||||
|
confirmColor: "brand",
|
||||||
|
isDismissable: true,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
export const konoSelfCommand = {
|
export const konoSelfCommand = {
|
||||||
name: "konoself",
|
name: "konoself",
|
||||||
displayName: "konoself",
|
displayName: "konoself",
|
||||||
|
|
@ -49,10 +61,8 @@ export const konoSelfCommand = {
|
||||||
|
|
||||||
// Check if channel is NSFW for NSFW content
|
// Check if channel is NSFW for NSFW content
|
||||||
if (isNSFW && !ctx.channel.nsfw) {
|
if (isNSFW && !ctx.channel.nsfw) {
|
||||||
return sendMessage(
|
showNSFWWarning();
|
||||||
ctx.channel.id,
|
return { type: 4 };
|
||||||
"❌ NSFW content can only be sent in NSFW channels!",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const imageUrl = await fetchImage(isNSFW);
|
const imageUrl = await fetchImage(isNSFW);
|
||||||
|
|
@ -81,10 +91,8 @@ export const konoSendCommand = {
|
||||||
|
|
||||||
// Check if channel is NSFW for NSFW content
|
// Check if channel is NSFW for NSFW content
|
||||||
if (isNSFW && !ctx.channel.nsfw) {
|
if (isNSFW && !ctx.channel.nsfw) {
|
||||||
return sendMessage(
|
showNSFWWarning();
|
||||||
ctx.channel.id,
|
return { type: 4 };
|
||||||
"❌ NSFW content can only be sent in NSFW channels!",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const imageUrl = await fetchImage(isNSFW);
|
const imageUrl = await fetchImage(isNSFW);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue