The presence table that Discord expects:
---@class PresenceButton
---@field label string
---@field url string
---@class PresenceAssets
---@field large_image? string
---@field large_text? string
---@field small_image? string
---@field small_text? string
---@class PresenceTimestamps
---@field start? integer
---@field end? integer
---@class Presence
---@field state? string
---@field details? string
---@field timestamps? PresenceTimestamps
---@field assets? PresenceAssets
---@field buttons? PresenceButton[]
lua/deps/discord/types/activity.lua
We use PresenceMakers
to generate the Presence Table.
They are structured as the Presence Table.
Their fields can be a function that returns the expected value or it directly.
See declaration
---@class PresenceMakersAssets : PresenceAssets
---@field large_image? (fun(self: NekoVim): string)|string
---@field large_text? (fun(self: NekoVim): string)|string
---@field small_image? (fun(self: NekoVim): string)|string
---@field small_text? (fun(self: NekoVim): string)|string
---@class PresenceMakersTimestamps : PresenceTimestamps
---@field start? (fun(self: NekoVim): integer)|integer
---@field end? (fun(self: NekoVim): integer)|integer
---@class PresenceMakers : Presence
---@field state? (fun(self: NekoVim): string)|string
---@field details? (fun(self: NekoVim): string)|string
---@field timestamps PresenceMakersTimestamps
---@field assets? PresenceMakersAssets
---@field buttons? ((fun(self: NekoVim): PresenceButton)|PresenceButton)[]
lua/types/presence_makers.lua
The functions receive an instance of NekoVim because of:
NekoVim.buffers_props
Every time a new buffer is open we register its properties (BufferProps
)
in a table organizaed by ids (BuffersProps
).
---@class BufferPropsRepo
---@field owner string
---@field name string
---@class BufferProps
---@field mode 'n'|'i'|'v'|'c'|'R'|string
---@field repo BufferPropsRepo
---@field fileName string?
---@field filePath string?
---@field fileType string?
---@field fileExtension string?
---@class BuffersProps
---@field [number] BufferProps
lua/types/buffers_props.lua
NekoVim.presence_props
---@class PresenceProps
---@field startTimestamp integer
---@field idling boolean
lua/types/presence_props.lua
See more about idling
in WorkProps
.