-
Notifications
You must be signed in to change notification settings - Fork 8
Build with config templates
Connor edited this page Mar 1, 2019
·
2 revisions
The config is where you design message templates. The idea with templates is you can write up the structure of your message in the config, and use that structure in multiple scripts. There are quite a few settings for the each message which are explained below.
-
webhook
- CfgDiscordEmbedWebhooks identifier. -
message
- The text content of your message. This example usesThis is an example message
.
-
username
- The name of the bot when it sends the message. If this is not set Discord will use the name set in the webhook settings. -
avatar
- The avatar of the bot when it sends the message. If this is not set Discord will use the image set in the webhook settings. -
tts
- Text to speech.
That's all you need to send a simple text message, however there are more settings to configure embeds.
Messages can contain up to 10 embeds. These embeds must be defined inside the Embeds
subclass.
CfgDiscordEmbedTemplate
Example2.cpp
-
title
- Embed title text. -
description
- Description text, located under the title. -
url
- Link opened when you click the title text. -
color
- RGB color code. eg: Red FF0000. -
timestamp
- Show timestamp in the embed footer. -
thumbnail
- Image shown in the top right corner of the embed. -
image
- Full embed width image shown at the bottom of the embed under all fields. -
fields
- Array of embed fields. Maximum of 25 fields per embed.
-
name
- Author name, located above the title text. -
url
- Link opened when you click the author name. -
image
- Tiny image shown to the left of the author name.
-
text
- Footer text, shown to the left of the timestamp (if enabled). -
image
- Small image shown to the left of the footer text.
When using config templates, the only sqf you need to use is this:
[type,parameters] call DiscordEmbedBuilder_fnc_buildCfg;
- Type: STRING - The name of the config class in
CfgDiscordEmbedBuilder
you wish to use. - Parameters: ARRAY (optional) - Any value you want to use in the embed.
Parameters are used in message
, username
, embed title
, embed description
, author name
, footer text
, field name
and field content
with the format
command:
format([string]+parameters);