Skip to content
This repository was archived by the owner on May 16, 2022. It is now read-only.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

4 Commits

Repository files navigation

discord-embed-validator

joi schema for validating Discord Embed Objects.

The official documentation for the Embed Object can be found here, and its limits here.

Install

npm install discord-embed-validator

Usage examples

Valid Embed

constvalidator=require('discord-embed-validator')constembed={title: 'This is my valid embed!',fields: [{name: 'It has a field',value: 'And the field has a value!'}]}validator.validate(embed)// { value: { title: 'This is my valid embed!', fields: [ [Object] ] }}

Invalid Embed

constvalidator=require('discord-embed-validator')constinvalidEmbed={title: 'This one is invalid',fields: [{'title': 'Because this field uses "title" instead of "name", and is missing its value!'}]}validator.validate(invalidEmbed)/*{ value: { title: 'This one is invalid', fields: [ [Object] ] }, error: [Error [ValidationError]: "fields[0].name" is required] { _original: { title: 'This one is invalid', fields: [Array] }, details: [ [Object] ] }}*/

About

joi schema for validating Discord Embed Objects

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages