Age and species fixes

This commit is contained in:
Mr. Stallion 2022-03-19 15:44:53 -07:00
parent f542bda6d2
commit f160b0f176
4 changed files with 30 additions and 12 deletions

View File

@ -1,5 +1,10 @@
# Changelog
## 1.18.0
* Upgraded to Electron 18
* Fixed MacOS M1 incompatibilities
* Improved age detection
## 1.17.1
* Fixes to smart filters

View File

@ -72,7 +72,7 @@ export class CacheManager {
return;
}
log.info('profile.cache.queue', { name, skipCacheCheck, channelId });
log.debug('profile.cache.queue', { name, skipCacheCheck, channelId });
if (!skipCacheCheck) {
const c = await this.profileCache.get(name);

View File

@ -447,7 +447,7 @@ export const likelyHuman: SpeciesMap = {
'male', 'female', 'shemale',
'dothraki', 'amazon', 'african[ -]?american', 'amazonian', 'latina', 'latino',
'aasimar', 'astartes', 'saiyan', 'echani', 'cathar', 'shikaisen', 'hyur', 'mid[ -]?lander', 'high[ -]?lander', 'arkanian',
'astartes', 'saiyan', 'echani', 'cathar', 'shikaisen', 'hyur', 'mid[ -]?lander', 'high[ -]?lander', 'arkanian',
'exalted', 'leftherian'
]
};
@ -469,8 +469,6 @@ export const speciesMapping: SpeciesMap = {
[Species.Human]: ['human', 'homo sapiens', 'human.*', 'homo[ -]?sapi[ea]ns?', 'woman', 'hy?[uo]+m[aie]n', 'humaine?',
'meat[ -]?popsicle',
// where should these go?
'angel', 'neph[ai]l[ei]m', 'arch[ -]?angel'
],
[Species.Elf]: ['drow', 'draenei', 'dunmer', 'draenai', 'blutelf[e]?', 'elf.*', 'drow.*', 'e[ -]l[ -]f', 'sin\'?dorei',
@ -538,7 +536,7 @@ export const speciesMapping: SpeciesMap = {
'vaporeon', 'reshiram', 'quilava', 'decidueye', 'marshadow', 'weavile', 'zubat', 'buizel', 'latias', 'nidorina',
'chandelur(e|ia)', 'sneasel', 'rockruff', 'lugia', 'komala', 'meowstic', 'leafeon', 'purrloin', 'pokemorph',
'houndour', 'zoroark', 'mightyena', 'mew', 'nidoqueen', 'zangoose', 'goodra', 'flygon', 'dialga', 'pansear',
'bibarel', 'charmeleon', 'lapras',
'bibarel', 'charmeleon', 'lapras', 'hatteren[ea]',
// digimon
'gatomon', 'impmon', 'guilmon'
@ -638,11 +636,12 @@ export const speciesMapping: SpeciesMap = {
'tengu', gen('(devil|demon)'), 'd[a]?emonette', 'cambion', 'amanojaku', 'tanar[\']?ri', 'balor', 'marilith', 'lilith', '.*demon',
'd[äa]mon([ie]n)?.*', 'ifrit', 'efree?t', 'afa?rit', 'demonic'],
[Species.Divinity]: ['god', 'goddess', 'divinity', 'demi[ -]?god', 'demi[ -]?goddess'],
[Species.Divinity]: ['god', 'goddess', 'divinity', 'demi[ -]?god', 'demi[ -]?goddess', 'angel', 'neph[ai]l[ei]m', 'arch[ -]?angel', 'seraph([ie]m)?', 'ophan([ie]m)?', 'cherub(im)?'],
[Species.Fae]: ['fairy', 'fae', 'imp', 'elemental', 'fey', 'pixie', 'nymph', 'faerie'],
[Species.Humanoid]: ['satyr', 'gnome', 'dwarf', 'halfling', 'havlin', 't[h]?(ie|ei)fling', 'dwarves', 'humanoid', 'yordle', 'hylian', 'lalafell',
'zwerg', 'draph', 'dryad', 'homunculus', 'githyanki'],
'zwerg', 'draph', 'dryad', 'homunculus', 'githyanki', 'tiefling', 'aasimar'],
[Species.Minotaur]: ['minotaur', 'tauren', 'minotaurus', 'm[iy]n[ao]t(uo|ou|o|u)ru?s?', 'minotaure'],

View File

@ -1242,13 +1242,27 @@ export class Matcher {
return null;
}
const ageStr = rawAge.string.toLowerCase().trim();
const ageStr = rawAge.string.toLowerCase().replace(/[,.]/g, '').trim();
if ((ageStr.indexOf('shota') >= 0) || (ageStr.indexOf('loli') >= 0) || (ageStr.indexOf('lolli') >= 0)) {
if ((ageStr.indexOf('shota') >= 0) || (ageStr.indexOf('loli') >= 0) || (ageStr.indexOf('lolli') >= 0) || (ageStr.indexOf('pup') >= 0)) {
return 10;
}
const age = parseInt(rawAge.string, 10);
let age: number | null = null;
const exactMatch = /^[0-9]+$/.exec(ageStr);
const rangeMatch = exactMatch ? null : ageStr.match(/^([0-9]+)-([0-9]+)$/);
if (exactMatch) {
// '18'
age = parseInt(rawAge.string, 10);
} else if (rangeMatch) {
// '18-22'
const v1 = parseInt(rangeMatch[1], 10);
const v2 = parseInt(rangeMatch[2], 10);
age = Math.min(v1, v2);
}
return age && !Number.isNaN(age) && Number.isFinite(age) ? age : null;
}
@ -1260,7 +1274,7 @@ export class Matcher {
return null;
}
const ageStr = rawAge.string.trim().toLowerCase();
const ageStr = rawAge.string.toLowerCase().replace(/[,.]/g, '').trim();
if (ageStr === '') {
return null;
@ -1283,7 +1297,7 @@ export class Matcher {
return { min: Math.min(v1, v2), max: Math.max(v1, v2) };
}
if ((ageStr.indexOf('shota') >= 0) || (ageStr.indexOf('loli') >= 0) || (ageStr.indexOf('lolli') >= 0)) {
if ((ageStr.indexOf('shota') >= 0) || (ageStr.indexOf('loli') >= 0) || (ageStr.indexOf('lolli') >= 0) || (ageStr.indexOf('pup') >= 0)) {
return { min: 10, max: 10 };
}