Moar Fixes

This commit is contained in:
thororen1234 2025-01-23 12:53:42 -05:00
parent 149fc67090
commit 663c43e84f
7 changed files with 15 additions and 12 deletions

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { ChatBarButton } from "@api/ChatButtons"; import { ChatBarButton, ChatBarButtonFactory } from "@api/ChatButtons";
import { classes } from "@utils/misc"; import { classes } from "@utils/misc";
import { Button, ButtonLooks, ButtonWrapperClasses, Tooltip } from "@webpack/common"; import { Button, ButtonLooks, ButtonWrapperClasses, Tooltip } from "@webpack/common";
@ -58,7 +58,7 @@ export function IconWithTooltip({ text, icon, onClick }) {
</Tooltip>; </Tooltip>;
} }
export const ChatBarIcon: ChatBarButton = () => { export const ChatBarIcon: ChatBarButtonFactory = () => {
return ( return (
<ChatBarButton tooltip="Open SoundBoard Log" <ChatBarButton tooltip="Open SoundBoard Log"
onClick={openSoundBoardLog}> onClick={openSoundBoardLog}>

View file

@ -16,15 +16,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { addChatBarButton, ChatBarButton, removeChatBarButton } from "@api/ChatButtons"; import { addChatBarButton, ChatBarButton, ChatBarButtonFactory, removeChatBarButton } from "@api/ChatButtons";
import { addMessagePreSendListener, removeMessagePreSendListener, SendListener } from "@api/MessageEvents"; import { addMessagePreSendListener, MessageSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
import { EquicordDevs } from "@utils/constants"; import { EquicordDevs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
import { React, useEffect, useState } from "@webpack/common"; import { React, useEffect, useState } from "@webpack/common";
let lastState = false; let lastState = false;
const ReverseMessageToggle: ChatBarButton = ({ isMainChat }) => { const ReverseMessageToggle: ChatBarButtonFactory = ({ isMainChat }) => {
const [enabled, setEnabled] = useState(lastState); const [enabled, setEnabled] = useState(lastState);
function setEnabledValue(value: boolean) { function setEnabledValue(value: boolean) {
@ -34,7 +34,7 @@ const ReverseMessageToggle: ChatBarButton = ({ isMainChat }) => {
} }
useEffect(() => { useEffect(() => {
const listener: SendListener = async (_, message) => { const listener: MessageSendListener = async (_, message) => {
if (enabled && message.content) message.content = message.content.split("").reverse().join(""); if (enabled && message.content) message.content = message.content.split("").reverse().join("");
}; };

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { addMessagePreSendListener, removeMessagePreSendListener, SendListener } from "@api/MessageEvents"; import { addMessagePreSendListener, MessageSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
import { definePluginSettings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import { Devs, EquicordDevs } from "@utils/constants"; import { Devs, EquicordDevs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
@ -19,7 +19,7 @@ const settings = definePluginSettings(
} }
); );
const presendObject: SendListener = (_, msg) => { const presendObject: MessageSendListener = (_, msg) => {
const sentences = msg.content.split(/(?<=\w\.)\s/); const sentences = msg.content.split(/(?<=\w\.)\s/);
const blockedWordsArray: string[] = settings.store.blockedWords.split(", "); const blockedWordsArray: string[] = settings.store.blockedWords.split(", ");

View file

@ -171,7 +171,6 @@ const settings = definePluginSettings({
idsList: { idsList: {
type: OptionType.COMPONENT, type: OptionType.COMPONENT,
description: "", description: "",
default: "",
onChange(newValue: string) { onChange(newValue: string) {
const ids = new Set(newValue.split(",").map(id => id.trim()).filter(Boolean)); const ids = new Set(newValue.split(",").map(id => id.trim()).filter(Boolean));
settings.store.idsList = Array.from(ids).join(", "); settings.store.idsList = Array.from(ids).join(", ");
@ -212,7 +211,8 @@ const settings = definePluginSettings({
ignoredActivities: { ignoredActivities: {
type: OptionType.CUSTOM, type: OptionType.CUSTOM,
default: [] as IgnoredActivity[], default: [] as IgnoredActivity[],
onChange: recalculateActivities onChange: recalculateActivities,
description: "",
} }
}); });

View file

@ -76,7 +76,6 @@ function createTagCommand(tag: Tag) {
const settings = definePluginSettings({ const settings = definePluginSettings({
clyde: { clyde: {
name: "Clyde message on send",
description: "If enabled, clyde will send you an ephemeral message when a tag was used.", description: "If enabled, clyde will send you an ephemeral message when a tag was used.",
type: OptionType.BOOLEAN, type: OptionType.BOOLEAN,
default: true default: true
@ -84,6 +83,7 @@ const settings = definePluginSettings({
tagsList: { tagsList: {
type: OptionType.CUSTOM, type: OptionType.CUSTOM,
default: {} as Record<string, Tag>, default: {} as Record<string, Tag>,
description: "",
} }
}); });

View file

@ -59,7 +59,8 @@ export const settings = definePluginSettings({
}, },
userBasedCategoryList: { userBasedCategoryList: {
type: OptionType.CUSTOM, type: OptionType.CUSTOM,
default: {} as Record<string, Category[]> default: {} as Record<string, Category[]>,
description: "",
} }
}); });

View file

@ -67,10 +67,12 @@ const settings = definePluginSettings({
stringRules: { stringRules: {
type: OptionType.CUSTOM, type: OptionType.CUSTOM,
default: makeEmptyRuleArray(), default: makeEmptyRuleArray(),
description: "",
}, },
regexRules: { regexRules: {
type: OptionType.CUSTOM, type: OptionType.CUSTOM,
default: makeEmptyRuleArray(), default: makeEmptyRuleArray(),
description: "",
} }
}); });