Class: EmbedParser
An embed tag will send an embed in the tag response. There are two ways to use the embed tag, either by using properly formatted embed JSON or manually inputting the accepted embed properties.
Embed can be used either by using a json string or by using the embed properties.
Examples
Using JSON
Using properties
Developers need to construct the embed builder themselves with the output of the tag.
Remarks
The return type depends on user's input. So it might not be EmbedData | APIEmbed
. So use a typeguard to check.
Extends
BaseParser
Implements
IParser
Constructors
new EmbedParser()
new EmbedParser(): EmbedParser
Returns
Overrides
BaseParser.constructor
Defined in
tagscript-plugin-discord/src/lib/Parsers/Embed.ts:57
Properties
acceptedNames
protected
acceptedNames: string
[]
Inherited from
BaseParser.acceptedNames
Defined in
tagscript/dist/index.d.ts:381
requiredParameter
protected
requiredParameter: boolean
Inherited from
BaseParser.requiredParameter
Defined in
tagscript/dist/index.d.ts:382
requiredPayload
protected
requiredPayload: boolean
Inherited from
BaseParser.requiredPayload
Defined in
tagscript/dist/index.d.ts:383
Methods
parse()
parse(ctx
): Promise
<string
>
Parses the given tag.
Parameters
ctx
Context
The context of the tag.
Returns
Promise
<string
>
Implementation of
IParser.parse
Defined in
tagscript-plugin-discord/src/lib/Parsers/Embed.ts:61
parseEmbedJSON()
protected
parseEmbedJSON(payload
): Awaitable
<APIEmbed
| EmbedData
>
This method is protected so that anyone can extend the embed json parser to allow urls
Parameters
payload
string
The payload to parse
Returns
Awaitable
<APIEmbed
| EmbedData
>
Defined in
tagscript-plugin-discord/src/lib/Parsers/Embed.ts:96
toJSON()
toJSON(): object
Returns
object
acceptedNames
acceptedNames: string
[]
requiredParameter
requiredParameter: boolean
requiredPayload
requiredPayload: boolean
Inherited from
BaseParser.toJSON
Defined in
tagscript/dist/index.d.ts:386
willAccept()
willAccept(ctx
): boolean
Parameters
ctx
Context
Returns
boolean
Implementation of
IParser.willAccept
Inherited from
BaseParser.willAccept
Defined in
tagscript/dist/index.d.ts:385