Skip to content

Commit fc36d0e

Browse files
committed
fix: temperature can be zero sometimes
1 parent 8a9d42b commit fc36d0e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

luascripts/ping.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@ return {
99
subcommands = {},
1010
minimal_rights = "user",
1111
handle = function(request)
12+
local temperature = math.ceil(bot_get_temperature())
13+
local temperature_str = ""
14+
if temperature > 0 then
15+
temperature_str = " · Temperature: " .. tostring(temperature) .. "°C"
16+
end
1217
return request.sender.alias_name .. ": PotFriend Pong! " ..
1318
"Uptime: " .. time_humanize(bot_get_uptime()) ..
1419
" · Used memory: " .. math.ceil(bot_get_memory_usage() / 1024) ..
15-
"MB · Temperature: " ..
16-
tostring(math.ceil(bot_get_temperature())) .. "°C · Bot running on " .. bot_get_version() ..
20+
"MB" .. temperature_str .. " · Bot running on " .. bot_get_version() ..
1721
" (Last updated " .. time_humanize(time_current() - bot_get_compile_time()) .. " ago)"
1822
end
1923
}

0 commit comments

Comments
 (0)