whatshard

Privateunrated

Content

21 lines
{=():}
{=(COMMENT):Get args into a separate variable for use later.}
{=(joinedargs):{join(~):{args}}}
{=(arg1):{list(0):{joinedargs}}}
{=(arg2):{list(1):{joinedargs}}}

{=(COMMENT):If there are no args, show the usage and stop execution}
{{if(=={arg1}):blacklist(Usage: `[p]whatshard <num shards> [server ID]`):{server(id)}}}

{=(COMMENT):Get a variable with shard count (from args) and server ID (from args, or current server if no arg)}
{=(shards):{arg1}}
{=(guild):{if(=={arg2}):{server(id)}|{arg2}}}

{=(COMMENT):Makes sure both arguments are numbers. Based on !tips isnum }
{{any({m:sgn({shards})}!=1|{m:sgn({guild})}!=1):blacklist(Invalid input.):{server(id)}}}

{=(COMMENT):This is where it does the math to get the shard. Based on discord developer docs.}
{=(result):{m:trunc(trunc({guild}/(2^22))%{shards})}}

{=(COMMENT):Send the output!}
Server `{guild}` is on shard **{result}/{shards}**.
Raw JSON
{
  "id": 640308,
  "created_at": "2021-02-28T03:36:59.000Z",
  "tag_name": "whatshard",
  "nsfw": false,
  "owner_id": "778231270748323850",
  "uses": 5,
  "description": null,
  "restricted": false,
  "shared": false,
  "deleted": false,
  "safe": "unrated",
  "hidden": false,
  "guild_id": "804541198113964073",
  "sharer": "778231270748323850",
  "content": "{=():}\n{=(COMMENT):Get args into a separate variable for use later.}\n{=(joinedargs):{join(~):{args}}}\n{=(arg1):{list(0):{joinedargs}}}\n{=(arg2):{list(1):{joinedargs}}}\n\n{=(COMMENT):If there are no args, show the usage and stop execution}\n{{if(=={arg1}):blacklist(Usage: `[p]whatshard <num shards> [server ID]`):{server(id)}}}\n\n{=(COMMENT):Get a variable with shard count (from args) and server ID (from args, or current server if no arg)}\n{=(shards):{arg1}}\n{=(guild):{if(=={arg2}):{server(id)}|{arg2}}}\n\n{=(COMMENT):Makes sure both arguments are numbers. Based on !tips isnum }\n{{any({m:sgn({shards})}!=1|{m:sgn({guild})}!=1):blacklist(Invalid input.):{server(id)}}}\n\n{=(COMMENT):This is where it does the math to get the shard. Based on discord developer docs.}\n{=(result):{m:trunc(trunc({guild}/(2^22))%{shards})}}\n\n{=(COMMENT):Send the output!}\nServer `{guild}` is on shard **{result}/{shards}**.",
  "embed": "{}",
  "last_fetched": "2026-10-20T15:27:31.545Z"
}