First upload
This commit is contained in:
60
docs/reference/regex-and-games.md
Normal file
60
docs/reference/regex-and-games.md
Normal file
@@ -0,0 +1,60 @@
|
||||
# Regex detection code and games list
|
||||
|
||||
## Regex detection code (utils.js)
|
||||
|
||||
```javascript
|
||||
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
|
||||
Reference in New Issue
Block a user