Skip to content

Commit

Permalink
fix: issues with displaying the idle status
Browse files Browse the repository at this point in the history
  • Loading branch information
vyfor committed Jun 13, 2024
1 parent 3c3b56f commit 0edce6f
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions lua/cord.lua
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ local function update_idle_presence(config)
) > 1
then
timer:stop()
enabled = false
end
else
discord.clear_presence()
end
return true
end

if
Expand All @@ -159,15 +159,18 @@ local function update_idle_presence(config)
discord.update_time()
end
if config.idle.show_status then
discord.update_presence(
ffi.new('PresenceArgs', '', 'Cord.idle', nil, 0, false)
)
if
discord.update_presence(
ffi.new('PresenceArgs', '', 'Cord.idle', nil, 0, false)
) > 1
then
timer:stop()
enabled = false
end
else
discord.clear_presence()
end
return true
end
return false
end

local function update_presence(config)
Expand Down Expand Up @@ -240,13 +243,14 @@ local function update_presence(config)
)
end

if status == 0 then
last_presence = current_presence
else
if status > 1 then timer:stop() end
last_presence = current_presence

if status > 1 then
timer:stop()
enabled = false
end
elseif not update_idle_presence(config) then
return
else
update_idle_presence(config)
end
end

Expand Down

0 comments on commit 0edce6f

Please sign in to comment.