Wolfery Text Emotes

Adds a whole bunch of useful texte emotes.

Terá de instalar uma extensão como Tampermonkey, Greasemonkey ou Violentmonkey para instalar este script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

Terá de instalar uma extensão como Tampermonkey ou Violentmonkey para instalar este script.

Terá de instalar uma extensão como Tampermonkey ou Userscripts para instalar este script.

Terá de instalar uma extensão como Tampermonkey para instalar este script.

Terá de instalar uma extensão de gestão de scripts de utilizador para instalar este script.

(Já tenho um gestor de scripts de utilizador, deixe-me instalá-lo!)

Terá de instalar uma extensão como Stylus para instalar este estilo.

Terá de instalar uma extensão como Stylus para instalar este estilo.

Terá de instalar uma extensão como Stylus para instalar este estilo.

Terá de instalar uma extensão de gestão de estilos de utilizador para instalar este estilo.

Terá de instalar uma extensão de gestão de estilos de utilizador para instalar este estilo.

Terá de instalar uma extensão de gestão de estilos de utilizador para instalar este estilo.

(Já tenho um gestor de estilos de utilizador, deixe-me instalá-lo!)

// ==UserScript==
// @name        Wolfery Text Emotes
// @namespace   https://shinyuu.net
// @match       https://wolfery.com/*
// @grant       none
// @version     1.0
// @author      Shinyuu Wolfy
// @description Adds a whole bunch of useful texte emotes.
// @license     Apache-2.0
// ==/UserScript==

function waitForElm(selector) {
    return new Promise(resolve => {
        if (document.querySelector(selector)) {
            return resolve(document.querySelector(selector));
        }

        const observer = new MutationObserver(mutations => {
            if (document.querySelector(selector)) {
                observer.disconnect();
                resolve(document.querySelector(selector));
            }
        });

        observer.observe(document.body, {
            childList: true,
            subtree: true
        });
    });
}

function fixPronouns(char, msg) {
  const about = char.about;
  const matches = about.match(/.*`pronouns: (\w+)\/(\w+)`.*/);
  if (!matches) {
    return msg;
  }
  return msg.replaceAll('their', matches[2]);
}

waitForElm('.console-editor').then(async () => {
  COMMANDS = {
    applaud: `gives a round of applause.`,
    blush: `blushes.`,
    bounce: `bounces around.`,
    bow: `bows deeply.`,
    burp: `burps loudly.`,
    cackle: `throws back their head, cackling with insane glee!`,
    chuckle: `chuckles politely.`,
    clap: `claps their hands together, showing approval.`,
    cough: `coughs loudly.`,
    cry: `starts sobbing, and then bursts into tears.`,
    curtsey: `curtseys gracefully.`,
    dance: `spins around in a fiery dance.`,
    daydream: `looks absent-minded, staring through people.`,
    fart: `rrrrrrrrips a stinky one.`,
    frown: `frowns.`,
    gasp: `gasps in astonishment.`,
    giggle: `giggles.`,
    glare: `glares around with a heavy gaze.`,
    grin: `grins, showing their teeth.`,
    groan: `groans loudly.`,
    grovel: `grovels in the dirt.`,
    growl: `growls angrily, like a fierce animal.`,
    hmm: `hmms, pondering.`,
    peer: `peers around, squinting their eyes.`,
    point: `points in all directions, seemingly confused.`,
    ponder: `sinks into their own thoughts.`,
    puke: `pukes their breakfast out.`,
    purr: `purrs contendly.`,
    scream: `screams loudly!`,
    shake: `shakes their head.`,
    shiver: `shivers uncomfortably.`,
    shrug: `shrugs, without elaborating further.`,
    sigh: `sighs loudly.`,
    smirk: `smirks. They think a whole lot about themselves.`,
    smile: `smiles happily.`,
    snap: `snaps their fingers.`,
    snarl: `snarls like a cornered, vicious animal.`,
    sneeze: `sneezes.`,
    snicker: `snickers softly.`,
    snore: `snores loudly.`,
    spit: `spits over their shoulder.`,
    stare: `stares at the sky.`,
    sulk: `sulks in the corner.`,
    tackle: `starts running around in a desperate attempt to tackle the air.`,
    twiddle: `patiently twiggles their thumbs.`,
    wave: `waves happily.`,
    whine: `whiles pitifully about the whole thing.`,
    whistle: `whistles appreciatively.`,
    wag: `wags their tail.`,
    wiggle: `wiggles their bottom.`,
    wink: `winks suggestively.`,
  };

  for (const [key, value] of Object.entries(COMMANDS)) {
    app.getModule('cmd').addCmd({
      key: key,
      value: async (ctx) => {
        await ctx.char.call('pose', { msg: fixPronouns(ctx.char, value) });
      }
    });
  };
});