Skip to content

Commit

Permalink
fix: prevent sending identical activity updates
Browse files Browse the repository at this point in the history
  • Loading branch information
vyfor committed Apr 26, 2024
1 parent b527bef commit 62ffb46
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions lua/cord.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ local function update_presence(config, initial)
problem_count = problem_count
}

if current_presence.type == '' then
if current_presence.name == '' then
current_presence.type = 'Cord.new'
else
current_presence.type = 'Cord.unknown'
end
end

if should_update_presence(current_presence) then
force_idle = false
last_updated = os.clock()
Expand All @@ -148,18 +156,11 @@ local function update_presence(config, initial)
end
local cursor_pos = config.display.show_cursor_position and (current_presence.cursor_line .. ':' .. current_presence.cursor_col) or nil

if current_presence.type == '' then
if current_presence.name == '' then
current_presence.type = 'Cord.new'
else
current_presence.type = 'Cord.unknown'
end
end
local icon, name = utils.get_icon(config, current_presence.name, current_presence.type)
local success
if icon then
success = discord.update_presence_with_assets(
current_presence.name,
current_presence.name or nil,
current_presence.type,
icon.name or name,
type(icon) == 'string' and icon or icon.icon,
Expand Down

0 comments on commit 62ffb46

Please sign in to comment.