otter
Privateunrated
Content
73 lines{=(COMMENT):Input example, just for myself.}
{=(input):!command <@user> <3d> <Reason here>}
{=(prefix):!}
{=(tagname):otter}
{=(role.warn):745025424119169109}
{=(default.duration):7d}
{=(COMMENT):Lowers the second argument, so it can't be case sensitive.}
{=(l2):{lower:{list(1):{join(,):{args}}}}}
{=(COMMENT):Adds a space between each character in the second argument.}
{=(l2r):{replace(, ):{l2}}}
{=(COMMENT):Splits the number and the last character/letter of the second argument, to perform the proper checks later.}
{=(split):{join():{l2r(+-2)}} {l2r(-1)}}
{=(COMMENT):Simply puts the number, up until the letter into a variable to reuse later.}
{=(number):{split(1)}}
{=(ch):├}
{=(COMMENT):Replaces each valid time letter with one special character (can be anything really) to check for its presence later.}
{=(letter):{replace(s,{ch}):{replace(m,{ch}):{replace(h,{ch}):{replace(d,{ch}):{replace(mo,{ch}):{replace(w,{ch}):{replace(y,{ch}):{split(2)}}}}}}}}}
{=(COMMENT):Returns 1 if the "number" variable is a positive number (above 0).}
{=(num.sgn):{m:sgn({number})}}
{=(COMMENT):Checks if the "number" variable actually is a number (so returns 1).}
{=(check.Num):{if({num.sgn}==1):true|false}}
{=(COMMENT):Returns "true" if the last letter has/is the special character we used in "ch", meaning it does contain a valid time letter.}
{=(check.Letter):{contains({letter}):{ch}}}
{=(COMMENT):Checks if the user specified a target along with the command.}
{=(check.Target):{if({user(id)}!={target(id)}):true|false}}
{=(COMMENT):Puts the two above checks into one, so if this is true, then the full time specified is valid, both the number and the letter.}
{=(check.Full):{and({check.Num}==true|{check.Letter}==true|{check.Target}==true):true|false}}
{=(COMMENT):Conditional duration and reason, depending on if it's a valid one or not. Sets the duration to the default duration if not.}
{=(duration):{if({check.Full}==true):{l2}|{default.duration}}}
{=(reason):{if({check.Full}==true):{args(3+)}|{args(2+)}}}
{silence}
{=():}
{{if({check.Target}==false):delete}}
{{if({check.Target}==true):c:warn {target(id)} {reason}}}
{{if({check.Target}==true):c:temprole {target(id)} {duration} {role.warn}}}
{=(COMMENT):Outputs}
{=(success):{target(mention)} has been warned for **{duration}**.
__Reason:__ {if({reason}==):Not specified.|{reason}}}
{=(error):Please mention a user along with the command!
__Usage Example:__ `{prefix}{tagname} @user (Optional time) (Optional Reason)`}
{=(output):{if({check.Target}==true):{success}|{error}}}
{output}
{=(COMMENT):Just a debug variable in which I call some variables to see their content. Only used to troubleshoot and see what's going on.}
{=(debug):__Debug:__
l2: `{l2}`
l2r: `{l2r}`
Duration: `{duration}`
Reason: `{reason}`
split: `{split}`
number: `{number}`
letter: `{letter}`
checkNum: `{check.Num}`
checkLetter: `{check.Letter}`
checkTarget: `{check.Target}`
checkFull: `{check.Full}`
}Raw JSON
{
"id": 342338,
"created_at": "2020-09-22T15:00:51.000Z",
"tag_name": "otter",
"nsfw": false,
"owner_id": "149926720114262016",
"uses": 13,
"description": null,
"restricted": false,
"shared": false,
"deleted": false,
"safe": "unrated",
"hidden": false,
"guild_id": "728777576348254258",
"sharer": "149926720114262016",
"content": "{=(COMMENT):Input example, just for myself.}\n{=(input):!command <@user> <3d> <Reason here>}\n\n{=(prefix):!}\n{=(tagname):otter}\n\n{=(role.warn):745025424119169109}\n{=(default.duration):7d}\n\n{=(COMMENT):Lowers the second argument, so it can't be case sensitive.}\n{=(l2):{lower:{list(1):{join(,):{args}}}}}\n{=(COMMENT):Adds a space between each character in the second argument.}\n{=(l2r):{replace(, ):{l2}}}\n{=(COMMENT):Splits the number and the last character/letter of the second argument, to perform the proper checks later.}\n{=(split):{join():{l2r(+-2)}} {l2r(-1)}}\n\n{=(COMMENT):Simply puts the number, up until the letter into a variable to reuse later.}\n{=(number):{split(1)}}\n\n{=(ch):├}\n{=(COMMENT):Replaces each valid time letter with one special character (can be anything really) to check for its presence later.}\n{=(letter):{replace(s,{ch}):{replace(m,{ch}):{replace(h,{ch}):{replace(d,{ch}):{replace(mo,{ch}):{replace(w,{ch}):{replace(y,{ch}):{split(2)}}}}}}}}}\n\n{=(COMMENT):Returns 1 if the \"number\" variable is a positive number (above 0).}\n{=(num.sgn):{m:sgn({number})}}\n{=(COMMENT):Checks if the \"number\" variable actually is a number (so returns 1).}\n{=(check.Num):{if({num.sgn}==1):true|false}}\n\n{=(COMMENT):Returns \"true\" if the last letter has/is the special character we used in \"ch\", meaning it does contain a valid time letter.}\n{=(check.Letter):{contains({letter}):{ch}}}\n\n{=(COMMENT):Checks if the user specified a target along with the command.}\n{=(check.Target):{if({user(id)}!={target(id)}):true|false}}\n\n{=(COMMENT):Puts the two above checks into one, so if this is true, then the full time specified is valid, both the number and the letter.}\n{=(check.Full):{and({check.Num}==true|{check.Letter}==true|{check.Target}==true):true|false}}\n\n{=(COMMENT):Conditional duration and reason, depending on if it's a valid one or not. Sets the duration to the default duration if not.}\n{=(duration):{if({check.Full}==true):{l2}|{default.duration}}}\n{=(reason):{if({check.Full}==true):{args(3+)}|{args(2+)}}}\n\n{silence}\n{=():}\n{{if({check.Target}==false):delete}}\n{{if({check.Target}==true):c:warn {target(id)} {reason}}}\n{{if({check.Target}==true):c:temprole {target(id)} {duration} {role.warn}}}\n\n{=(COMMENT):Outputs}\n{=(success):{target(mention)} has been warned for **{duration}**.\n__Reason:__ {if({reason}==):Not specified.|{reason}}}\n{=(error):Please mention a user along with the command!\n__Usage Example:__ `{prefix}{tagname} @user (Optional time) (Optional Reason)`}\n\n{=(output):{if({check.Target}==true):{success}|{error}}}\n{output}\n\n{=(COMMENT):Just a debug variable in which I call some variables to see their content. Only used to troubleshoot and see what's going on.}\n{=(debug):__Debug:__\nl2: `{l2}`\nl2r: `{l2r}`\n\nDuration: `{duration}`\nReason: `{reason}`\n\nsplit: `{split}`\nnumber: `{number}`\nletter: `{letter}`\n\ncheckNum: `{check.Num}`\ncheckLetter: `{check.Letter}`\ncheckTarget: `{check.Target}`\ncheckFull: `{check.Full}`\n}",
"embed": "{}",
"last_fetched": "2026-10-20T22:34:34.668Z"
}