Skip to content

Commit

Permalink
Update script headers
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorAU committed Nov 18, 2020
1 parent 946e96a commit ebb783a
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 33 deletions.
32 changes: 22 additions & 10 deletions addon/pbo/fn_buildCfg.sqf
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
/*──────────────────────────────────────────────────────┐
│ Author: Connor │
│ Steam: https://steamcommunity.com/id/_connor │
│ Github: https://github.com/ConnorAU │
│ │
│ Please do not modify or remove this comment block │
└──────────────────────────────────────────────────────*/
/* ----------------------------------------------------------------------------
Project:
https://github.com/ConnorAU/SQFDiscordEmbedBuilder
Author:
ConnorAU - https://github.com/ConnorAU
Function:
DiscordEmbedBuilder_fnc_buildCfg
Description:
Builds a message from the config template provided
Information:
https://github.com/ConnorAU/SQFDiscordEmbedBuilder/wiki/Build-with-config-templates
Return:
BOOL - true if the message was sent to the extension
---------------------------------------------------------------------------- */

// The extension deserializer doesn't like empty strings, so this string is reserved as empty
#define EMPTY_STRING toString[1]
Expand All @@ -16,7 +28,7 @@ private _cfgDir = configFile >> "CfgDiscordEmbedBuilder" >> _template;
if (isNull _cfgDir) exitwith {false};

private _emptyString = { [EMPTY_STRING,_this] select (_this != ""); };
private _formatString = {
private _formatString = {
params [["_str","",[""]],["_replaceEmpty",true,[true]]];
private _str = format([_str]+_textParameters);
if _replaceEmpty then {_str call _emptyString} else {_str}
Expand All @@ -38,7 +50,7 @@ private ["_title","_description","_url","_color","_timestamp","_thumbnail","_ima
_timestamp = getNumber(_x >> "timestamp");
_thumbnail = getText(_x >> "thumbnail") call _emptyString;
_image = getText(_x >> "image") call _emptyString;

// tobool
_timestamp = _timestamp isEqualTo 1;

Expand Down Expand Up @@ -66,4 +78,4 @@ private ["_title","_description","_url","_color","_timestamp","_thumbnail","_ima
_embeds set [_forEachIndex,[_title,_description,_url,_color,_timestamp,_thumbnail,_image,_author,_footer,_fields]];
} foreach _embeds;

[_webhookurl,_message,_username,_avatar,_tts,_embeds] call DiscordEmbedBuilder_fnc_send;
[_webhookurl,_message,_username,_avatar,_tts,_embeds] call DiscordEmbedBuilder_fnc_send;
26 changes: 19 additions & 7 deletions addon/pbo/fn_buildSqf.sqf
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
/*──────────────────────────────────────────────────────┐
│ Author: Connor │
│ Steam: https://steamcommunity.com/id/_connor │
│ Github: https://github.com/ConnorAU │
│ │
│ Please do not modify or remove this comment block │
└──────────────────────────────────────────────────────*/
/* ----------------------------------------------------------------------------
Project:
https://github.com/ConnorAU/SQFDiscordEmbedBuilder
Author:
ConnorAU - https://github.com/ConnorAU
Function:
DiscordEmbedBuilder_fnc_buildSqf
Description:
Builds a message from the sqf provided
Information:
https://github.com/ConnorAU/SQFDiscordEmbedBuilder/wiki/Build-with-SQF
Return:
BOOL - true if the message was sent to the extension
---------------------------------------------------------------------------- */

/*
Example 1:
Expand Down
22 changes: 14 additions & 8 deletions addon/pbo/fn_init.sqf
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
/*──────────────────────────────────────────────────────┐
│ Author: Connor │
│ Steam: https://steamcommunity.com/id/_connor │
│ Github: https://github.com/ConnorAU │
│ │
│ Please do not modify or remove this comment block │
└──────────────────────────────────────────────────────*/
/* ----------------------------------------------------------------------------
Project:
https://github.com/ConnorAU/SQFDiscordEmbedBuilder
Author:
ConnorAU - https://github.com/ConnorAU
Function:
DiscordEmbedBuilder_fnc_init
Description:
Initialises the discord embed builder mod
---------------------------------------------------------------------------- */

with uiNamespace do {
DiscordEmbedBuilder_SessionKey = compileFinal str("DiscordEmbedBuilder" callExtension "init");
Expand All @@ -14,4 +20,4 @@ with uiNamespace do {
} else {
diag_log parseText "DiscordEmbedBuilder failed to load";
};
};
};
25 changes: 17 additions & 8 deletions addon/pbo/fn_send.sqf
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
/*──────────────────────────────────────────────────────┐
│ Author: Connor │
│ Steam: https://steamcommunity.com/id/_connor │
│ Github: https://github.com/ConnorAU │
│ │
│ Please do not modify or remove this comment block │
└──────────────────────────────────────────────────────*/
/* ----------------------------------------------------------------------------
Project:
https://github.com/ConnorAU/SQFDiscordEmbedBuilder
Author:
ConnorAU - https://github.com/ConnorAU
Function:
DiscordEmbedBuilder_fnc_send
Description:
Sends a built message to the extension to execute a discord webhook
Return:
BOOL - true if the message was sent to the extension
---------------------------------------------------------------------------- */

if !(uiNamespace getVariable ["DiscordEmbedBuilder_LoadSuccess",false]) exitwith {false};

Expand All @@ -19,4 +28,4 @@ params [

private _key = uiNamespace getVariable ["DiscordEmbedBuilder_SessionKey",{""}];
"DiscordEmbedBuilder" callExtension [call _key,[_webhookurl,_message,_username,_avatar,_tts,_embeds]];
true
true

0 comments on commit ebb783a

Please sign in to comment.