Class: EmbedParser
Defined in: tagscript-plugin-discord/src/lib/Parsers/Embed.ts:56
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
Defined in: tagscript-plugin-discord/src/lib/Parsers/Embed.ts:57
Returns
Overrides
BaseParser.constructor
Properties
acceptedNames
protected
acceptedNames: string
[]
Defined in: tagscript/dist/index.d.ts:381
Inherited from
BaseParser.acceptedNames
requiredParameter
protected
requiredParameter: boolean
Defined in: tagscript/dist/index.d.ts:382
Inherited from
BaseParser.requiredParameter
requiredPayload
protected
requiredPayload: boolean
Defined in: tagscript/dist/index.d.ts:383
Inherited from
BaseParser.requiredPayload
Methods
parse()
parse(ctx
): Promise
<string
>
Defined in: tagscript-plugin-discord/src/lib/Parsers/Embed.ts:61
Parses the given tag.
Parameters
ctx
Context
The context of the tag.
Returns
Promise
<string
>
Implementation of
IParser.parse
parseEmbedJSON()
protected
parseEmbedJSON(payload
): Awaitable
<APIEmbed
| EmbedData
>
Defined in: tagscript-plugin-discord/src/lib/Parsers/Embed.ts:96
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
>
toJSON()
toJSON(): object
Defined in: tagscript/dist/index.d.ts:386
Returns
object
acceptedNames
acceptedNames: string
[]
requiredParameter
requiredParameter: boolean
requiredPayload
requiredPayload: boolean
Inherited from
BaseParser.toJSON
willAccept()
willAccept(ctx
): boolean
Defined in: tagscript/dist/index.d.ts:385
Parameters
ctx
Context
Returns
boolean
Implementation of
IParser.willAccept
Inherited from
BaseParser.willAccept