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:
parent
abdfea15db
commit
ab2c9c57a8
2 changed files with 9 additions and 4 deletions
|
@ -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) {
|
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`);
|
logger.info(`Migrating setting ${setting} from ${pluginName} to list`);
|
||||||
if (SettingsStore.plain.plugins[pluginName][setting] === "") SettingsStore.plain.plugins[pluginName][setting] = [];
|
if (SettingsStore.plain.plugins[pluginName][setting] === "") SettingsStore.plain.plugins[pluginName][setting] = [];
|
||||||
else SettingsStore.plain.plugins[pluginName][setting] = SettingsStore.plain.plugins[pluginName][setting].split(stringSeparator);
|
else SettingsStore.plain.plugins[pluginName][setting] = SettingsStore.plain.plugins[pluginName][setting].split(stringSeparator);
|
||||||
|
|
|
@ -91,7 +91,12 @@ export function SettingArrayComponent({
|
||||||
if (!inputElement || inputElement.value === "") {
|
if (!inputElement || inputElement.value === "") {
|
||||||
return;
|
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]);
|
setItems([...items, inputElement.value]);
|
||||||
pluginSettings[id] = items;
|
pluginSettings[id] = items;
|
||||||
inputElement.value = "";
|
inputElement.value = "";
|
||||||
|
@ -149,7 +154,7 @@ export function SettingArrayComponent({
|
||||||
{/* Add a single input field */}
|
{/* Add a single input field */}
|
||||||
<TextInput
|
<TextInput
|
||||||
type="text"
|
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"}`}
|
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 */}
|
{/* Add a submit button */}
|
||||||
|
|
Loading…
Reference in a new issue