"formatMilliseconds" Funktion
This commit is contained in:
parent
4fa5abe1e4
commit
5a990bf663
@ -573,8 +573,8 @@ function unescape(str)
|
||||
str = string.gsub(str, "Ü", "Ü")
|
||||
str = string.gsub(str, "ü", "ü")
|
||||
str = string.gsub(str, "Ü", "Ü")
|
||||
str = string.gsub( str, '&#(%d+);', function(n) return string.char(n) end )
|
||||
str = string.gsub( str, '&#x(%d+);', function(n) return string.char(tonumber(n,16)) end )
|
||||
--str = string.gsub( str, '&#(%d+);', function(n) return string.char(n) end )
|
||||
--str = string.gsub( str, '&#x(%d+);', function(n) return string.char(tonumber(n,16)) end )
|
||||
str = string.gsub( str, '&', '&' ) -- Be sure to do this after all others
|
||||
return str
|
||||
end
|
||||
@ -796,6 +796,25 @@ function makeHumanTime(totalseconds)
|
||||
end
|
||||
end
|
||||
|
||||
function formatMilliseconds(milliseconds)
|
||||
local totalseconds = math.floor( milliseconds / 1000 )
|
||||
milliseconds = milliseconds % 1000
|
||||
local seconds = totalseconds % 60
|
||||
local minutes = math.floor( totalseconds / 60 )
|
||||
local hours = math.floor( minutes / 60 )
|
||||
local days = math.floor( hours / 24 )
|
||||
minutes = minutes % 60
|
||||
hours = hours % 24
|
||||
--return string.format( "%03d:%02d:%02d:%02d:%03d", days, hours, minutes, seconds, milliseconds )
|
||||
if minutes == 00 and hours == 00 then
|
||||
return seconds..' Sekunden'
|
||||
elseif hours == 00 and minutes ~= 00 then
|
||||
return string.format("%02d:%02d", minutes, seconds)..' Minuten'
|
||||
elseif hours ~= 00 then
|
||||
return string.format("%02d:%02d:%02d", hours, minutes, seconds)..' Stunden'
|
||||
end
|
||||
end
|
||||
|
||||
function is_blacklisted(msg)
|
||||
_blacklist = redis:smembers("telegram:img_blacklist")
|
||||
local var = false
|
||||
|
Reference in New Issue
Block a user