Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ game "gta5"
name "DiscordAPI"
description "An all one in solution for Discord API, that controls chat tags, permissions."
author "ricky"
version "v2.2.2"
version "2.2.2"

lua54 "yes"

Expand All @@ -15,6 +15,7 @@ client_scripts {
server_scripts {
"sv_config.lua",
"sv_utility.lua",
"sv_main.lua",
"sv_discord_api.lua",
"sv_ace_perms.lua",
"sv_chat_tags.lua",
Expand Down
38 changes: 38 additions & 0 deletions sv_main.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Citizen.CreateThread(function()
local name = GetCurrentResourceName()
local version = tostring(GetResourceMetadata(name, "version", 0))
local principal = "resource." .. name

if name ~= "DiscordAPI" then
Log("^1WARNING: The resource name is not DiscordAPI. Unless this is intentional, please change the resource name to DiscordAPI.")
end

if not IsPrincipalAceAllowed(principal, "command.add_principal") then
Log("^1WARNING: DiscordAPI is missing the 'command.add_principal' permission. The resource may not function as intended. Please grant this permission in the server.cfg.")
end

if not IsPrincipalAceAllowed(principal, "command.add_ace") then
Log("^1WARNING: DiscordAPI is missing the 'command.add_ace' permission. The resource may not function as intended. PPlease grant this permission in the server.cfg.")
end

if not IsPrincipalAceAllowed(principal, "command.remove_principal") then
Log("^1WARNING: DiscordAPI is missing the 'command.remove_principal' permission. The resource may not function as intended. Please grant this permission in the server.cfg.")
end

if not IsPrincipalAceAllowed(principal, "command.remove_ace") then
Log("^1WARNING: DiscordAPI is missing the 'command.remove_ace' permission. The resource may not function as intended. Please grant this permission in the server.cfg.")
end

PerformHttpRequest("https://raw.githubusercontent.com/RickyBhatti/DiscordAPI/refs/heads/main/version.txt", function(code, text, _)
if code ~= 200 then
Log("^1WARNING: DiscordAPI was unable to check for updates. Please ensure you have an active internet connection.")
return
end

if version ~= tostring(text) then
Log("^1WARNING: Your version of DiscordAPI doesn't match the latest version.")
Log("^1WARNING: Your version: ^7" .. version)
Log("^1WARNING: Latest version: ^7" .. text)
end
end)
end)