Files
broccolini-bot/docs/reference/regex-and-games.md
2026-02-17 21:49:58 -06:00

1.0 KiB

Regex detection code and games list

Regex detection code (utils.js)

function escapeRegex(str) {
  return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}

const detectGame = (subject, body) => {
  const txt = `${subject} ${body}`.toLowerCase();

  for (const game of GAME_NAMES) {
    const g = game.toLowerCase();
    const re = new RegExp(`\\b${escapeRegex(g)}\\b`, 'i');
    if (re.test(txt)) return game;
  }

  for (const [alias, fullName] of Object.entries(GAME_ALIASES)) {
    const a = alias.toLowerCase();
    const re = new RegExp(`\\b${escapeRegex(a)}\\b`, 'i');
    if (re.test(txt)) return fullName;
  }

  return 'Not Mentioned';
};

Games list

  • 7 Days to Die
  • Abiotic Factor
  • ARK: Survival Evolved
  • Conan Exiles
  • Core Keeper
  • Counter-Strike 2
  • DayZ
  • ECO
  • Enshrouded
  • Factorio
  • FiveM
  • The Front
  • Garry's Mod
  • Hytale
  • ICARUS
  • Minecraft
  • Necesse
  • Palworld
  • Project Zomboid
  • Rust
  • Satisfactory
  • Sons of the Forest
  • Soulmask
  • Star Rupture
  • Terraria
  • Valheim
  • VEIN
  • Vintage Story
  • Voyagers of Nera
  • V Rising