1
0
Fork 1
mirror of https://github.com/Vendicated/Vencord.git synced 2025-01-10 09:56:24 +00:00

idek fixes or sum

This commit is contained in:
Elvy 2025-01-03 19:56:26 +01:00
parent abdfea15db
commit ab2c9c57a8
2 changed files with 9 additions and 4 deletions

View file

@ -220,9 +220,9 @@ export function migratePluginSettings(name: string, ...oldNames: string[]) {
}
}
export function migrateSettingsToArrays(pluginName: string, settings: Array<string>, stringSeparator: string = ",") {
export function migrateSettingsToArrays(pluginName: string, settings: string[], stringSeparator: string = ",") {
for (const setting of settings) {
if (typeof SettingsStore.plain.plugins[pluginName][setting] !== "string") continue;
if (SettingsStore.plain.plugins[pluginName] === undefined || typeof SettingsStore.plain.plugins[pluginName][setting] !== "string") continue;
logger.info(`Migrating setting ${setting} from ${pluginName} to list`);
if (SettingsStore.plain.plugins[pluginName][setting] === "") SettingsStore.plain.plugins[pluginName][setting] = [];
else SettingsStore.plain.plugins[pluginName][setting] = SettingsStore.plain.plugins[pluginName][setting].split(stringSeparator);

View file

@ -91,7 +91,12 @@ export function SettingArrayComponent({
if (!inputElement || inputElement.value === "") {
return;
}
// TODO add searching for users, channels, and guilds lol
// TODO add picker for users?
if (option.type !== OptionType.ARRAY && !(inputElement.value.length >= 18 && inputElement.value.length <= 19 && !isNaN(Number(inputElement.value)))) {
setError("Value is not a valid snowflake ID");
inputElement.value = "";
return;
}
setItems([...items, inputElement.value]);
pluginSettings[id] = items;
inputElement.value = "";
@ -149,7 +154,7 @@ export function SettingArrayComponent({
{/* Add a single input field */}
<TextInput
type="text"
placeholder="Add Item"
placeholder="Add Item (as ID)"
id={`vc-plugin-modal-input-${option.type === OptionType.CHANNELS ? "channel" : option.type === OptionType.GUILDS ? "guild" : option.type === OptionType.USERS ? "user" : "string"}`}
/>
{/* Add a submit button */}