From f22a74c388b574c1d698a1ad616aa6deab68d75b Mon Sep 17 00:00:00 2001 From: Musiker15 Date: Sun, 12 Feb 2023 17:21:56 +0100 Subject: [PATCH] Update v1.4.4 * Fixed MSK.AddWebhook --- VERSION | 2 +- fxmanifest.lua | 2 +- server.lua | 25 ++++++++++++++++++------- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/VERSION b/VERSION index 3c80e4f..e1df5de 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.4.3 \ No newline at end of file +1.4.4 \ No newline at end of file diff --git a/fxmanifest.lua b/fxmanifest.lua index 3c783c3..31d7bce 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -4,7 +4,7 @@ games { 'gta5' } author 'Musiker15 - MSK Scripts' name 'msk_core' description 'Core functions for MSK Scripts' -version '1.4.3' +version '1.4.4' lua54 'yes' diff --git a/server.lua b/server.lua index babd310..eb78b84 100644 --- a/server.lua +++ b/server.lua @@ -131,6 +131,8 @@ MSK.Notification = function(src, text) end MSK.AddWebhook = function(webhook, botColor, botName, botAvatar, title, description, fields, footer, time) + local content = {} + if footer then if time then footer = { @@ -145,13 +147,22 @@ MSK.AddWebhook = function(webhook, botColor, botName, botAvatar, title, descript end end - local content = {{ - ["title"] = title, - ["description"] = description, - ["color"] = botColor, - ["fields"] = fields, - ["footer"] = footer - }} + if fields then + content = {{ + ["title"] = title, + ["description"] = description, + ["color"] = botColor, + ["fields"] = fields, + ["footer"] = footer + }} + else + content = {{ + ["title"] = title, + ["description"] = description, + ["color"] = botColor, + ["footer"] = footer + }} + end PerformHttpRequest(webhook, function(err, text, headers) end, 'POST', json.encode({ username = botName,