house

Sharedunrated

Content

83 lines
{=(COMMENT):Your preferred server prefix, and this tag's name}
{=(prefix):!}
{=(tagname):house}

{=(COMMENT):Prefix URL of the Fandom Wiki. Will be used for a bunch of fields later in the code.}
{=(wikiPrefix):https://harrypotter.fandom.com/wiki/}

{=(Format):roleid~name~founder~colors~animal~element~traits~imgURL~hex}
{=(Gryffindor):847876750259388428~Gryffindor~Godric Gryffindor~Scarlet and gold~Lion~Fire~Courage Bravery Determination Daring Nerve Chivalry~https://static.wikia.nocookie.net/harrypotter/images/b/b1/Gryffindor_ClearBG.png~#BA120D}
{=(Slytherin):847876788477624387~Slytherin~Salazar Slytherin~Green and silver~Serpent~Water~Resourcefulness Determination Pride Cunning Ambition Self-preservation~https://static.wikia.nocookie.net/harrypotter/images/0/00/Slytherin_ClearBG.png~#228E20}
{=(Hufflepuff):847876809190408204~Hufflepuff~Helga Hufflepuff~Yellow and black~Badger~Earth~Hard-working Patience Fairness Just Loyalty Modesty~https://static.wikia.nocookie.net/harrypotter/images/0/06/Hufflepuff_ClearBG.png~#DDB10B}
{=(Ravenclaw):847876880262889523~Ravenclaw~Rowena Ravenclaw~Blue and bronze~Eagle~Air~Wit Learning Wisdom Acceptance Intelligence Creativity~https://static.wikia.nocookie.net/harrypotter/images/7/71/Ravenclaw_ClearBG.png~#0690B6}

{=(COMMENT):House Roles IDs next to each other.}
{=(hrl):{Gryffindor(1):~} {Slytherin(1):~} {Hufflepuff(1):~} {Ravenclaw(1):~}}

{=(COMMENT):House names, next to each other.}
{=(hn):Gryffindor Slytherin Hufflepuff Ravenclaw}

{=(ur):{user(roleids)}}

{=(COMMENT):Index house roles}
{=(idxhrl):{index({hrl(1)}):{ur}} {index({hrl(2)}):{ur}} {index({hrl(3)}):{ur}} {index({hrl(4)}):{ur}}}

{=(COMMENT):Returns something like "false true false false"}
{=(ins):{in({hrl(1)}):{ur}} {in({hrl(2)}):{ur}} {in({hrl(3)}):{ur}} {in({hrl(4)}):{ur}}}
{=(houseidx):{index(true):0 {ins}}}

{=(r):replace}

{=(COMMENT):Returns "true" if the user *doesn't* have a House role. "false" if they do.}
{=(needsHouseRole):{in(ZZZZ):{join():{{r}(-1,Z):{idxhrl}}}}}

{=(COMMENT):This part is just to the "change" or "switch" subcommand looks for substring matching. Meaning that if they type "sw", it will still know they meant "switch" and work.}
{=(l1):{lower:{1}}}
{=(kw):switch change}
{=(inkw):{if(!={1}):{in({l1}):{kw(1)}} {in({l1}):{kw(2)}}}}

{=(wantsToSwitch):{in(true):{inkw}}}

{=(shouldReroll):{or({needsHouseRole}==true|{wantsToSwitch}==true):true|false}}

{=(COMMENT):Randomly generates a new house role for the user and actually gives it to them, when they ask to switch house.}
{=():}
{=(jhn):{join(,):{hn}}}
{{if({shouldReroll}==true):=(rHouse):{#:{and({wantsToSwitch}==true|{needsHouseRole}==false):{join():{{r}({hn({houseidx})},):{jhn}}|{jhn}}}}}}
{{if({shouldReroll}==true):c:role c {user(id)} +{{rHouse}(1):~} -{join( -):{join( ):{{r}({{rHouse}(1):~},):{hrl}}}}}}
{override}{silent}

{=(COMMENT):--- Output Management ---}
{=(COMMENT):Returns the name of the house that the user is in.}
{=(house):{if({shouldReroll}==true):{rHouse}|{hn({houseidx})}}}
{=(house.role):{{house}(1):~}}

{=(house.founder):{{house}(3):~}}
{=(house.founder.hl):[{house.founder}]({wikiPrefix}{join(_):{house.founder}} "{house}'s Founder Wiki Page")}

{=(house.colors):{{house}(4):~}}

{=(house.animal):{{house}(5):~}}
{=(house.animal.hl):[{house.animal}]({wikiPrefix}{house.animal} "{house}'s Animal Wiki Page")}

{=(house.element):{{house}(6):~}}

{=(house.traits):{{house}(7):~}}
{=(COMMENT):Formatted House Traits, for better readability in the output.}
{=(house.traits.f):{join(, ):{house.traits(+-1)}}, and {house.traits(0)}}

{=(house.image):{{house}(8):~}}

{=(house.hex):{{house}(9):~}}

{=(house.url):{wikiPrefix}{house}}

{=(em.name):{if({shouldReroll}==true):And you are sorted to...}}
{=(em.icon):{if({shouldReroll}==true):https://static.wikia.nocookie.net/harrypotter/images/6/62/Sorting_Hat.png}}
{=(em.title):{house}!}
{=(em.desc):{if({shouldReroll}==true):Welcome to <@&{house.role}>, {mention}!|Information about <@&{house.role}>, {mention}}}

{=(em.footer):Unsatisfied with your House? ─ {prefix}{tagname} [switch|change]}

{embed(URL):{house.url}}
{embed(color):#{replace(#,):{house.hex}}}

Embed

1 line
{"color": 5198940, "title": "{em.title}", "author": {"name": "{em.name}", "icon_url": "{em.icon}"}, "fields": [{"name": "Founder", "value": "{house.founder.hl}", "inline": true}, {"name": "Colours", "value": "{house.colors}", "inline": true}, {"name": "Animal", "value": "{house.animal.hl}", "inline": true}, {"name": "Traits", "value": "{house.traits.f}", "inline": true}, {"name": "Element", "value": "{house.element}", "inline": true}], "footer": {"text": "{em.footer}"}, "thumbnail": {"url": "{house.image}"}, "description": "{em.desc}"}
Raw JSON
{
  "id": 854400,
  "created_at": "2021-05-28T16:45:37.000Z",
  "tag_name": "house",
  "nsfw": false,
  "owner_id": "149926720114262016",
  "uses": 90,
  "description": null,
  "restricted": false,
  "shared": true,
  "deleted": false,
  "safe": "unrated",
  "hidden": false,
  "guild_id": "314660900302749696",
  "sharer": "149926720114262016",
  "content": "{=(COMMENT):Your preferred server prefix, and this tag's name}\n{=(prefix):!}\n{=(tagname):house}\n\n{=(COMMENT):Prefix URL of the Fandom Wiki. Will be used for a bunch of fields later in the code.}\n{=(wikiPrefix):https://harrypotter.fandom.com/wiki/}\n\n{=(Format):roleid~name~founder~colors~animal~element~traits~imgURL~hex}\n{=(Gryffindor):847876750259388428~Gryffindor~Godric Gryffindor~Scarlet and gold~Lion~Fire~Courage Bravery Determination Daring Nerve Chivalry~https://static.wikia.nocookie.net/harrypotter/images/b/b1/Gryffindor_ClearBG.png~#BA120D}\n{=(Slytherin):847876788477624387~Slytherin~Salazar Slytherin~Green and silver~Serpent~Water~Resourcefulness Determination Pride Cunning Ambition Self-preservation~https://static.wikia.nocookie.net/harrypotter/images/0/00/Slytherin_ClearBG.png~#228E20}\n{=(Hufflepuff):847876809190408204~Hufflepuff~Helga Hufflepuff~Yellow and black~Badger~Earth~Hard-working Patience Fairness Just Loyalty Modesty~https://static.wikia.nocookie.net/harrypotter/images/0/06/Hufflepuff_ClearBG.png~#DDB10B}\n{=(Ravenclaw):847876880262889523~Ravenclaw~Rowena Ravenclaw~Blue and bronze~Eagle~Air~Wit Learning Wisdom Acceptance Intelligence Creativity~https://static.wikia.nocookie.net/harrypotter/images/7/71/Ravenclaw_ClearBG.png~#0690B6}\n\n{=(COMMENT):House Roles IDs next to each other.}\n{=(hrl):{Gryffindor(1):~} {Slytherin(1):~} {Hufflepuff(1):~} {Ravenclaw(1):~}}\n\n{=(COMMENT):House names, next to each other.}\n{=(hn):Gryffindor Slytherin Hufflepuff Ravenclaw}\n\n{=(ur):{user(roleids)}}\n\n{=(COMMENT):Index house roles}\n{=(idxhrl):{index({hrl(1)}):{ur}} {index({hrl(2)}):{ur}} {index({hrl(3)}):{ur}} {index({hrl(4)}):{ur}}}\n\n{=(COMMENT):Returns something like \"false true false false\"}\n{=(ins):{in({hrl(1)}):{ur}} {in({hrl(2)}):{ur}} {in({hrl(3)}):{ur}} {in({hrl(4)}):{ur}}}\n{=(houseidx):{index(true):0 {ins}}}\n\n{=(r):replace}\n\n{=(COMMENT):Returns \"true\" if the user *doesn't* have a House role. \"false\" if they do.}\n{=(needsHouseRole):{in(ZZZZ):{join():{{r}(-1,Z):{idxhrl}}}}}\n\n{=(COMMENT):This part is just to the \"change\" or \"switch\" subcommand looks for substring matching. Meaning that if they type \"sw\", it will still know they meant \"switch\" and work.}\n{=(l1):{lower:{1}}}\n{=(kw):switch change}\n{=(inkw):{if(!={1}):{in({l1}):{kw(1)}} {in({l1}):{kw(2)}}}}\n\n{=(wantsToSwitch):{in(true):{inkw}}}\n\n{=(shouldReroll):{or({needsHouseRole}==true|{wantsToSwitch}==true):true|false}}\n\n{=(COMMENT):Randomly generates a new house role for the user and actually gives it to them, when they ask to switch house.}\n{=():}\n{=(jhn):{join(,):{hn}}}\n{{if({shouldReroll}==true):=(rHouse):{#:{and({wantsToSwitch}==true|{needsHouseRole}==false):{join():{{r}({hn({houseidx})},):{jhn}}|{jhn}}}}}}\n{{if({shouldReroll}==true):c:role c {user(id)} +{{rHouse}(1):~} -{join( -):{join( ):{{r}({{rHouse}(1):~},):{hrl}}}}}}\n{override}{silent}\n\n{=(COMMENT):--- Output Management ---}\n{=(COMMENT):Returns the name of the house that the user is in.}\n{=(house):{if({shouldReroll}==true):{rHouse}|{hn({houseidx})}}}\n{=(house.role):{{house}(1):~}}\n\n{=(house.founder):{{house}(3):~}}\n{=(house.founder.hl):[{house.founder}]({wikiPrefix}{join(_):{house.founder}} \"{house}'s Founder Wiki Page\")}\n\n{=(house.colors):{{house}(4):~}}\n\n{=(house.animal):{{house}(5):~}}\n{=(house.animal.hl):[{house.animal}]({wikiPrefix}{house.animal} \"{house}'s Animal Wiki Page\")}\n\n{=(house.element):{{house}(6):~}}\n\n{=(house.traits):{{house}(7):~}}\n{=(COMMENT):Formatted House Traits, for better readability in the output.}\n{=(house.traits.f):{join(, ):{house.traits(+-1)}}, and {house.traits(0)}}\n\n{=(house.image):{{house}(8):~}}\n\n{=(house.hex):{{house}(9):~}}\n\n{=(house.url):{wikiPrefix}{house}}\n\n{=(em.name):{if({shouldReroll}==true):And you are sorted to...}}\n{=(em.icon):{if({shouldReroll}==true):https://static.wikia.nocookie.net/harrypotter/images/6/62/Sorting_Hat.png}}\n{=(em.title):{house}!}\n{=(em.desc):{if({shouldReroll}==true):Welcome to <@&{house.role}>, {mention}!|Information about <@&{house.role}>, {mention}}}\n\n{=(em.footer):Unsatisfied with your House? ─ {prefix}{tagname} [switch|change]}\n\n{embed(URL):{house.url}}\n{embed(color):#{replace(#,):{house.hex}}}",
  "embed": "{\"color\": 5198940, \"title\": \"{em.title}\", \"author\": {\"name\": \"{em.name}\", \"icon_url\": \"{em.icon}\"}, \"fields\": [{\"name\": \"Founder\", \"value\": \"{house.founder.hl}\", \"inline\": true}, {\"name\": \"Colours\", \"value\": \"{house.colors}\", \"inline\": true}, {\"name\": \"Animal\", \"value\": \"{house.animal.hl}\", \"inline\": true}, {\"name\": \"Traits\", \"value\": \"{house.traits.f}\", \"inline\": true}, {\"name\": \"Element\", \"value\": \"{house.element}\", \"inline\": true}], \"footer\": {\"text\": \"{em.footer}\"}, \"thumbnail\": {\"url\": \"{house.image}\"}, \"description\": \"{em.desc}\"}",
  "last_fetched": "2026-10-21T01:38:03.835Z"
}