let suppress = false;

const aliases = {
  "<3": "❤",
  ":shrug:": "¯\\_(ツ)_/¯",
  ":tableflip:": "(╯°□°）╯︵ ┻━┻",
  ":cheer:": "\\(^o^)/",
  ":cry:": "(╥﹏╥)",
  ":cute:": "(｡◕‿‿◕｡)",
  ":dwi:": "(⌐■_■)",
  ":sad:": "(︶︹︶)",
  ":excited:": "(ﾉ◕ヮ◕)ﾉ*:・ﾟ✧",
  ":wtf:": "(⊙＿⊙')",
  ":rolleyes:": "(◔_◔)",
  ":lovebear:": "ʕ♥ᴥ♥ʔ",
  ":sniper:": "︻╦╤─ ҉ - -"
};

register("messageSent", (msg, event) => {
  if (suppress) {
    suppress = false;
    return;
  }

  let modified = msg;

  for (let key in aliases) {
    if (modified.includes(key)) {
      modified = modified.split(key).join(aliases[key]);
    }
  }

  if (modified === msg) return;

  cancel(event);
  suppress = true;
  ChatLib.say(modified);
});

