Skip to content

Commit

Permalink
chore: remove discordActivity/Presence
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpredator committed Dec 1, 2024
1 parent 5a9fd4c commit 54398ca
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,44 +171,6 @@ local placeHolders = {
end,
}

function Adjustments:PresencePlaceholders()
local presence = Config.DiscordActivity.presence

for placeholder, cb in pairs(placeHolders) do
local success, result = pcall(cb)

if not success then
error(("Failed to execute presence placeholder: ^5%s^7"):format(placeholder))
error(result)
return "Unknown"
end

presence = presence:gsub(("{%s}"):format(placeholder), result)
end

return presence
end

function Adjustments:DiscordPresence()
if Config.DiscordActivity.appId ~= 0 then
CreateThread(function()
while true do
SetDiscordAppId(Config.DiscordActivity.appId)
SetDiscordRichPresenceAsset(Config.DiscordActivity.assetName)
SetDiscordRichPresenceAssetText(Config.DiscordActivity.assetText)

for i = 1, #Config.DiscordActivity.buttons do
local button = Config.DiscordActivity.buttons[i]
SetDiscordRichPresenceAction(i - 1, button.label, button.url)
end

SetRichPresence(self:PresencePlaceholders())
Wait(Config.DiscordActivity.refresh)
end
end)
end
end

function Adjustments:WantedLevel()
if not Config.EnableWantedLevel then
ClearPlayerWantedLevel(ESX.playerId)
Expand Down Expand Up @@ -236,7 +198,6 @@ function Adjustments:Load()
self:DispatchServices()
self:NPCScenarios()
self:LicensePlates()
self:DiscordPresence()
self:WantedLevel()
self:DisableRadio()
end
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,3 @@ Config.RemoveHudComponents = {
--Any other character will lead to said character being emitted.
-- A string shorter than 8 characters will be padded on the right.
Config.CustomAIPlates = "........" -- Custom plates for AI vehicles

--[[
PlaceHolders:
{server_name} - Server Display Name
{server_endpoint} - Server IP:Server Port
{server_players} - Current Player Count
{server_maxplayers} - Max Player Count
{player_name} - Player Name
{player_rp_name} - Player RP Name
{player_id} - Player ID
{player_street} - Player Street Name
]]

Config.DiscordActivity = {
appId = 0, -- Discord Application ID,
assetName = "LargeIcon", --image name for the "large" icon.
assetText = "{server_name}", -- Text to display on the asset
buttons = {
{ label = "Join Server", url = "fivem://connect/{server_endpoint}" },
{ label = "Discord", url = "https://discord.esx-framework.org" },
},
presence = "{player_name} [{player_id}] | {server_players}/{server_maxplayers}",
refresh = 1 * 60 * 1000, -- 1 minute
}

0 comments on commit 54398ca

Please sign in to comment.