Skip to content

Commit

Permalink
feat(discord): add toggle for rich presence (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddoucethollett committed Dec 27, 2023
1 parent 5499200 commit a717d1e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion client/discord.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
local maxPlayers = GlobalState.MaxPlayers
local discord = require 'config.client'.discord

AddStateBagChangeHandler('PlayerCount', nil, function(bagName, _, value)
if not discord.enabled then return end

AddStateBagChangeHandler('PlayerCount', '', function(bagName, _, value)
if bagName == 'global' and value then
local players = 'Players %s/' .. maxPlayers
SetRichPresence((players):format(value))
Expand Down
2 changes: 2 additions & 0 deletions config/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ return {
},

discord = {
enabled = true, -- This will enable or disable the built in discord rich presence.

appId = '', -- This is the Application ID (Replace this with you own)

largeIcon = { -- To set this up, visit https://forum.cfx.re/t/how-to-updated-discord-rich-presence-custom-image/157686
Expand Down

0 comments on commit a717d1e

Please sign in to comment.