@@ -2,6 +2,7 @@ local logger = require 'cord.api.log'
22local mappings = require ' cord.internal.activity.mappings'
33local icons = require ' cord.api.icon'
44local config = require ' cord.api.config'
5+ local async = require ' cord.core.async'
56
67local function get_custom_asset (config , filename , filetype )
78 if not config .assets then return end
@@ -50,11 +51,11 @@ local function get_option(option, args)
5051 function () return ' config.get: variable ${' .. var .. ' } = ' .. tostring (arg ) end
5152 )
5253 if type (arg ) == ' function' then
53- local result = tostring (arg (args ))
54+ local result = async . is_async (arg ) and arg (args ): get () or arg ( args )
5455 logger .trace (
55- function () return ' config.get: function variable ${' .. var .. ' } = ' .. result end
56+ function () return ' config.get: function variable ${' .. var .. ' } = ' .. tostring ( result ) end
5657 )
57- return result
58+ return tostring ( result )
5859 elseif arg ~= nil then
5960 return tostring (arg )
6061 end
@@ -66,7 +67,9 @@ local function get_option(option, args)
6667 logger .trace (function () return ' config.get: final string: ' .. tostring (option ) end )
6768 end
6869
69- local result = ty == ' function' and option (args ) or option
70+ local result = ty == ' function'
71+ and (async .is_async (option ) and option (args ):get () or option (args ))
72+ or option
7073 logger .trace (function () return ' config.get: returning ' .. tostring (type (result )) end )
7174 return result
7275end
@@ -102,8 +105,8 @@ local function build_activity(opts)
102105 opts .text = get_option (custom_icon .text , opts )
103106 opts .filetype = override_type or opts .filetype
104107 opts .icon = get_option (custom_icon .icon , opts )
105- or (custom_icon .type and icons .get (mappings .get_default_icon (custom_icon .type )))
106- or opts .icon
108+ or (custom_icon .type and icons .get (mappings .get_default_icon (custom_icon .type )))
109+ or opts .icon
107110 end
108111 end
109112
0 commit comments