diff options
author | megumin <megumin.bakaretsurie@gmail.com> | 2022-10-25 18:49:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-25 18:49:50 +0100 |
commit | 5e7c155f6e6be996a4a4c9aba99f18500032726a (patch) | |
tree | db5610f6442cb623cd0e11f6c5e331fff4bf8508 /src/utils | |
parent | e06ba68c40c55feb010598e0b0c4482962cc658e (diff) | |
download | Vencord-5e7c155f6e6be996a4a4c9aba99f18500032726a.tar.gz Vencord-5e7c155f6e6be996a4a4c9aba99f18500032726a.tar.bz2 Vencord-5e7c155f6e6be996a4a4c9aba99f18500032726a.zip |
feat(settings): add beforeSave check (#161)
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/types.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils/types.ts b/src/utils/types.ts index 1916f9b..41dd0c1 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -16,6 +16,8 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ +import { Promisable } from "type-fest"; + import { Command } from "../api/Commands"; // exists to export default definePlugin({...}) @@ -76,6 +78,11 @@ interface PluginDef { */ options?: Record<string, PluginOptionsItem>; /** + * Check that this returns true before allowing a save to complete. + * If a string is returned, show the error to the user. + */ + beforeSave?(options: Record<string, any>): Promisable<true | string>; + /** * Allows you to specify a custom Component that will be rendered in your * plugin's settings page */ |