Skip to content

Commit

Permalink
Update v1.1
Browse files Browse the repository at this point in the history
* Fixed if fields = false
  • Loading branch information
Musiker15 committed Mar 17, 2023
1 parent 188004c commit 7b7999c
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 32 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0
1.1
2 changes: 1 addition & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ games { 'gta5' }
author 'Musiker15 - MSK Scripts'
name 'msk_webhook'
description 'Send Discord Webhooks'
version '1.0'
version '1.1'

lua54 'yes'

Expand Down
73 changes: 43 additions & 30 deletions server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ if Config.testCommand.enable then
end

exports('sendDiscordLog', function(webhook, botColor, botName, botAvatar, title, description, fields, footer, time)
local content = {}

if footer then
if time then
footer = {
Expand All @@ -28,13 +30,22 @@ exports('sendDiscordLog', function(webhook, botColor, botName, botAvatar, title,
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,
Expand All @@ -45,27 +56,29 @@ exports('sendDiscordLog', function(webhook, botColor, botName, botAvatar, title,
})
end)

---- GitHub Updater ----
function GetCurrentVersion()
return GetResourceMetadata( GetCurrentResourceName(), "version" )
end

local CurrentVersion = GetCurrentVersion()
local resourceName = "^4["..GetCurrentResourceName().."]^0"
GithubUpdater = function()
GetCurrentVersion = function()
return GetResourceMetadata( GetCurrentResourceName(), "version" )
end
local CurrentVersion = GetCurrentVersion()
local resourceName = "^4["..GetCurrentResourceName().."]^0"

if Config.VersionChecker then
PerformHttpRequest('https://raw.githubusercontent.com/MSK-Scripts/msk_webhook/main/VERSION', function(Error, NewestVersion, Header)
print("###############################")
if CurrentVersion == NewestVersion then
print(resourceName .. '^2 ✓ Resource is Up to Date^0 - ^5Current Version: ^2' .. CurrentVersion .. '^0')
elseif CurrentVersion ~= NewestVersion then
print(resourceName .. '^1 ✗ Resource Outdated. Please Update!^0 - ^5Current Version: ^1' .. CurrentVersion .. '^0')
print('^5Newest Version: ^2' .. NewestVersion .. '^0 - ^6Download here: ^9https://github.com/MSK-Scripts/msk_webhook/releases/tag/v'.. NewestVersion .. '^0')
end
print("###############################")
end)
else
print("###############################")
print(resourceName .. '^2 ✓ Resource loaded^0')
print("###############################")
end
if Config.VersionChecker then
PerformHttpRequest('https://raw.githubusercontent.com/MSK-Scripts/msk_webhook/main/VERSION', function(Error, NewestVersion, Header)
print("###############################")
if CurrentVersion == NewestVersion then
print(resourceName .. '^2 ✓ Resource is Up to Date^0 - ^5Current Version: ^2' .. CurrentVersion .. '^0')
elseif CurrentVersion ~= NewestVersion then
print(resourceName .. '^1 ✗ Resource Outdated. Please Update!^0 - ^5Current Version: ^1' .. CurrentVersion .. '^0')
print('^5Newest Version: ^2' .. NewestVersion .. '^0 - ^6Download here:^9 https://github.com/MSK-Scripts/msk_webhook/releases/tag/v'.. NewestVersion .. '^0')
end
print("###############################")
end)
else
print("###############################")
print(resourceName .. '^2 ✓ Resource loaded^0')
print("###############################")
end
end
GithubUpdater()

0 comments on commit 7b7999c

Please sign in to comment.