mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-20 11:57:02 -04:00
feat(settings): add beforeSave check (#161)
This commit is contained in:
parent
e06ba68c40
commit
5e7c155f6e
2 changed files with 43 additions and 23 deletions
|
@ -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({...})
|
||||
|
@ -75,6 +77,11 @@ interface PluginDef {
|
|||
* Optionally provide settings that the user can configure in the Plugins tab of settings.
|
||||
*/
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue