Skip to content

Instantly share code, notes, and snippets.

@epsilon-phase
Last active October 17, 2018 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save epsilon-phase/f6f9af002e4319509cda96ab862c6bd7 to your computer and use it in GitHub Desktop.
Save epsilon-phase/f6f9af002e4319509cda96ab862c6bd7 to your computer and use it in GitHub Desktop.
--- Paste this into the pattern match for the alias editor
--> ^/in ([0-9]+) (minutes|m|seconds|hours|h|s) do (.+)$
--- Then paste the rest into the code editor
local noseconds = tonumber(matches[2])
local timeunit = matches[3]
if timeunit == "minutes" or timeunit == "m" then
noseconds = noseconds * 60
elseif timeunit == "hours" or timeunit == "h" then
noseconds = noseconds * 3600
end
local command = matches[4]
cecho("<yellow>In " .. noseconds .. " seconds " .. "running " .. command .. '\n')
local myCss1 =
[[
border-width: 4px;
border-radius: 7;
border-color: red;
background-color: green;
]]
local myCss2 =
[[
border-width: 4px;
border-radius: 7;
border-color: green;
background-color: red;
]]
local atCount = 0
for _, timername in pairs(demonnic.anitimer.activeTimers) do
if string.find(timername, "At" .. atCount) then
atCount = atCount + 1
end
end
demonnic.anitimer:new(
"At" .. atCount,
{x = 0, y = 0 + 20 * atCount, height = 20, width = "25%"},
noseconds,
{
container = usefulContainer,
showTime = true,
timerCaption = command,
cssFront = myCss1,
cssBack = myCss2,
}
)
tempTimer(
noseconds,
function()
expandAlias(command)
end
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment