Last edit: @jkrause in #[IM @jkrause] 1 year ago - Slack Archive

{lua}
-- Please do not touch this factoid or it's configuration maps, 
-- as this is a preventative measure against spamming.  
-- If you need help, contact @jkrause on slack.
local ftoid = argv[1];
local jobj = fmap.cooldowns["cd_" .. ftoid];
local timeobj = fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"];
if jobj == nil then
  print("No such cooldown configuration found!\n")
  print(ftoid)
  return "0"
end
local obj = json.load(jobj);
if obj["bypass_" .. user.id] ~= nil then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  return "1"
elseif user.is_admin then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  return "1"
elseif timeobj == nil then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  return "1"
elseif (bot.now() - timeobj) >= obj.cooldown then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  return "1"
else
  return "0"
end

History

Revision: 2337 by @jkrause in #[IM @jkrause] 1 year agoSlack Archive

{lua}
-- Please do not touch this factoid or it's configuration maps, 
-- as this is a preventative measure against spamming.  
-- If you need help, contact @jkrause on slack.
local ftoid = argv[1];
local jobj = fmap.cooldowns["cd_" .. ftoid];
local timeobj = fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"];
if jobj == nil then
  print("No such cooldown configuration found!\n")
  print(ftoid)
  return "0"
end
local obj = json.load(jobj);
if obj["bypass_" .. user.id] ~= nil then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  return "1"
elseif user.is_admin then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  return "1"
elseif timeobj == nil then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  return "1"
elseif (bot.now() - timeobj) >= obj.cooldown then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  return "1"
else
  return "0"
end

Revision: 1889 by @jkrause in #[IM @jkrause] 2 years agoSlack Archive

{lua}
-- Please do not touch this factoid or it's configuration maps, 
-- as this is a preventative measure against spamming.  
-- If you need help, contact @jkrause on slack.
local ftoid = argv[1];
local jobj = fmap.cooldowns["cd_" .. ftoid];
local timeobj = fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"];
if jobj == nil then
  print("No such cooldown configuration found!\n")
  print(ftoid)
  return "0"
end
local obj = json.load(jobj);
if obj["bypass_" .. user.id] ~= nil then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  return "1"
elseif timeobj == nil then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  return "1"
elseif (bot.now() - timeobj) >= obj.cooldown then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  return "1"
else
  return "0"
end

Revision: 1888 (deleted) by @jkrause in #[IM @jkrause] 2 years agoSlack Archive

{lua}
-- Please do not touch this factoid or it's configuration maps, 
-- as this is a preventative measure against spamming.  
-- If you need help, contact @jkrause on slack.
local ftoid = argv[1];
local jobj = fmap.cooldowns["cd_" .. ftoid];
local timeobj = fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"];
if jobj == nil then
  print("No such cooldown configuration found!\n")
  print(ftoid)
  return "0"
end
local obj = json.load(jobj);
if obj["bypass_" .. user.id] ~= nil then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  return "1"
elseif timeobj == nil then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  return "1"
elseif (bot.now() - timeobj) >= obj.cooldown then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  return "1"
else
  return "0"
end

Revision: 1884 (deleted) by @jkrause in #[IM @jkrause] 2 years agoSlack Archive

{lua}
-- Please do not touch this factoid or it's configuration maps, 
-- as this is a preventative measure against spamming.  
-- If you need help, contact @jkrause on slack.
local ftoid = argv[1];
local jobj = fmap.cooldowns["cd_" .. ftoid];
local timeobj = fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"];
if jobj == nil then
  print("No such cooldown configuration found!\n")
  print(ftoid)
  return
end
local obj = json.load(jobj);
if obj["bypass_" .. user.id] ~= nil then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  print(factoid[ftoid]())
elseif timeobj == nil then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  print(factoid[ftoid]())
elseif (bot.now() - timeobj) >= obj.cooldown then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  print(factoid[ftoid]())
else
  return ""
end

Revision: 1883 (deleted) by @jkrause in #[IM @jkrause] 2 years agoSlack Archive

{lua}
-- Please do not touch this factoid or it's configuration maps, 
-- as this is a preventative measure against spamming.  
-- If you need help, contact @jkrause on slack.
local ftoid = argv[1];
local jobj = fmap.cooldowns["cd_" .. ftoid];
local timeobj = fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"];
if jobj == nil then
  print("No such cooldown configuration found!\n")
  print(ftoid)
  return
end
local obj = json.load(jobj);
if obj["bypass_" .. user.id] ~= nil then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  print(factoid[ftoid]())
elseif timeobj == nil then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  print(factoid[ftoid]())
elseif (bot.now() - timeobj) >= obj.cooldown then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  print(factoid[ftoid]())
else
  return ""
end

Revision: 1882 (deleted) by @jkrause in #[IM @jkrause] 2 years agoSlack Archive

{lua}
-- Please do not touch this factoid or it's configuration maps, 
-- as this is a preventative measure against spamming.  
-- If you need help, contact @jkrause on slack.
local ftoid = argv[1];
local jobj = fmap.cooldowns["cd_" .. ftoid];
local timeobj = fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"];
if jobj == nil then
  print("No such cooldown configuration found!\n")
  print(ftoid)
  return
end
local obj = json.load(jobj);
if obj["bypass_" .. user.id] ~= nil then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  print(factoid[ftoid]())
elseif timeobj == nil then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  print(factoid[ftoid]())
elseif (bot.now() - timeobj) >= obj.cooldown then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  print(factoid[ftoid]())
else
  print("")
end

Revision: 1881 (deleted) by @jkrause in #[IM @jkrause] 2 years agoSlack Archive

{lua}
-- Please do not touch this factoid or it's configuration maps, 
-- as this is a preventative measure against spamming.  
-- If you need help, contact @jkrause on slack.
local ftoid = argv[1];
local jobj = fmap.cooldowns["cd_" .. ftoid];
local timeobj = fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"];
if jobj == nil then
  print("No such cooldown configuration found!\n")
  print(ftoid)
  return
end
local obj = json.load(jobj);
if obj["bypass_" .. user.id] ~= nil then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  print(factoid[ftoid]())
elseif timeobj == nil then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  print(factoid[ftoid]())
elseif (bot.now() - timeobj) >= obj.cooldown then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  print(factoid[ftoid]())
else
  print("")
end

Revision: 1880 (deleted) by @jkrause in #[IM @jkrause] 2 years agoSlack Archive

{lua}
-- Please do not touch this factoid or it's configuration maps, 
-- as this is a preventative measure against spamming.  
-- If you need help, contact @jkrause on slack.
local ftoid = argv[1];
local jobj = fmap.cooldowns["cd_" .. ftoid];
local timeobj = fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"];
if jobj == nil then
  print("No such cooldown configuration found!\n")
  print(ftoid)
  return
end
local obj = json.load(jobj);
if obj["bypass_" .. user.id] ~= nil then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  print(factoid[ftoid]())
elseif timeobj == nil then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  print(factoid[ftoid]())
elseif (bot.now() - timeobj) >= obj.cooldown then
  fdata["cd_" .. channel.id .. "_" .. ftoid .. "_time"] = bot.now();
  print(factoid[ftoid]())
else
  return
end