mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
no comment still working on it
This commit is contained in:
1 parent
cea0014e18
commit
e11fca151c
87 files changed
+5710
-10182
No files matched your search
+28
-29
@@ -1,44 +1,43 @@
|
||||
/**
|
||||
* @file runnables.mjs — Runnable validators — server-side validation functions for settings values (prefix, volume, 24/7 mode, etc.)
|
||||
* @module settings.runnables
|
||||
* @module settings/runnables
|
||||
* @description Validation runnables for settings values.
|
||||
* Each function is called with (value, context) and returns an error string or null.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Validate a prefix setting value.
|
||||
* @param {*} value - The value to validate.
|
||||
* @param {object} ctx - Command context (unused but provided by the settings system).
|
||||
* @returns {string|null} Error message if invalid, or null if valid.
|
||||
*/
|
||||
export default {
|
||||
/**
|
||||
* Validate a prefix setting value.
|
||||
* @param {string} value - The proposed prefix
|
||||
* @param {object} _data - Additional context (reserved for future use)
|
||||
* @returns {true|string} True if valid, error message string if invalid
|
||||
*/
|
||||
prefix(value, _data) {
|
||||
if (!value || typeof value !== "string") return "Prefix must be a non-empty string.";
|
||||
if (value.length > 10) return "Prefix must be 10 characters or fewer.";
|
||||
if (/\s/.test(value)) return "Prefix must not contain whitespace.";
|
||||
return true;
|
||||
prefix(value) {
|
||||
if (!value || typeof value !== 'string') return 'Prefix must be a non-empty string.';
|
||||
if (value.length > 5) return 'Prefix must be 5 characters or fewer.';
|
||||
if (/\s/.test(value)) return 'Prefix must not contain whitespace.';
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Validate a profile picture setting value.
|
||||
* @param {string} value - The proposed pfp value
|
||||
* @param {object} _data - Additional context (reserved for future use)
|
||||
* @returns {true|string} True if valid, error message string if invalid
|
||||
* Validate a pfp (profile picture) setting value.
|
||||
* Only 'default' is accepted on Fluxer.
|
||||
* @param {*} value - The value to validate.
|
||||
* @returns {string|null} Error message if invalid, or null if valid.
|
||||
*/
|
||||
pfp(value, _data) {
|
||||
if (value !== "default") {
|
||||
return "Profile picture customisation is not supported on Fluxer.";
|
||||
pfp(value) {
|
||||
if (value !== 'default') {
|
||||
return 'Profile picture customisation is not supported on Fluxer.';
|
||||
}
|
||||
return true;
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Validate the 24/7 stay mode setting.
|
||||
* @param {string|boolean} value - The proposed stay_247 value
|
||||
* @param {object} _data - Additional context (reserved for future use)
|
||||
* @returns {true|string} True if valid, error message string if invalid
|
||||
* Validate stay_247 setting. Always valid — the 24/7 system manages
|
||||
* this value internally via the toggle command.
|
||||
* @param {*} value - The value (ignored).
|
||||
* @returns {string|null} Always null (no error).
|
||||
*/
|
||||
stay_247(value, _data) {
|
||||
if (value === true || value === false || value === "true" || value === "false") return true;
|
||||
if (typeof value === "string" && value.length > 0) return true;
|
||||
return "Invalid value for 24/7 mode.";
|
||||
stay_247(value) {
|
||||
return null;
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user