-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Botcoins followup #66
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good, just one comment on the regex that I wasn't certain about, thanks for the PR 👍
@@ -36,9 +37,10 @@ const defaultEndFunction = (title, image, description) => async (m, e) => { | |||
m.channel.send({ embeds: [embed] }).catch((...args) => warn('Unable to post quiz answer', ...args)); | |||
}; | |||
const getPokemonByName = name => pokemonList.find(p => p.name == name); | |||
const pokemonNameNormalized = (name) => name.replace(/\s?\(.+\)$/, '').replace(/.*(Magikarp).*/, '$1').replace(/\W/g, '.?').replace(/(Valencian|Pinkan|Pink|Handout|Charity|Blessing|Crystal|Titan)\s*/gi, '($1)?').replace(/Noble\s*/g, '(Noble|Hisuian)?\\s*'); | |||
const pokemonNameNormalized = (name) => name.replace(/\s?\(.+\)$/, '').replace(/.*(Magikarp).*/, '$1').replace(/\W/g, '.?').replace(/.*((Segin|Schedar|Segin|Ruchbah|Caph)\.\?Starmobile).*/, '($1)|(Revavroom)').replace(/(Valencian|Pinkan|Pink|Handout|Charity|Blessing|Crystal|Titan)\s*/gi, '($1)?').replace(/Noble\s*/g, '(Noble|Hisuian)?\\s*'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this was intentional?
It's currently looking for a Pokémon with the name Caph.?Starmobile
as you've put a backslash before it, I'm presuming you want to replace anything that has Caph(any character here)Starmobile
though?
const pokemonNameNormalized = (name) => name.replace(/\s?\(.+\)$/, '').replace(/.*(Magikarp).*/, '$1').replace(/\W/g, '.?').replace(/.*((Segin|Schedar|Segin|Ruchbah|Caph)\.\?Starmobile).*/, '($1)|(Revavroom)').replace(/(Valencian|Pinkan|Pink|Handout|Charity|Blessing|Crystal|Titan)\s*/gi, '($1)?').replace(/Noble\s*/g, '(Noble|Hisuian)?\\s*'); | |
const pokemonNameNormalized = (name) => name.replace(/\s?\(.+\)$/, '').replace(/.*(Magikarp).*/, '$1').replace(/\W/g, '.?').replace(/.*((Segin|Schedar|Segin|Ruchbah|Caph).?Starmobile).*/, '($1)|(Revavroom)').replace(/(Valencian|Pinkan|Pink|Handout|Charity|Blessing|Crystal|Titan)\s*/gi, '($1)?').replace(/Noble\s*/g, '(Noble|Hisuian)?\\s*'); |
|
||
const title = `${levelEvolution.length > 0 ? 'Level' : ''}` + | ||
`${levelEvolution.length > 0 && itemEvolution.length > 0 ? ' or ' : ''}` + | ||
`${itemEvolution.length > 0 ? 'Item' : ''}`; | ||
const description = [`What ${title} is needed to evolve this Pokémon?`]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
@@ -639,12 +690,13 @@ const pokemonGymLeader = () => { | |||
const pokemon = pokemonList.find(p => p.name == pokemonName); | |||
const gyms = allGyms.filter(g => GymList[g].pokemons.find(p => p.name == pokemonName)); | |||
const leaders = gyms.map(g => GymList[g].leaderName); | |||
const leadersRegex = leaders.map(l => l.replace(/\W/g, '.?').replace(/(Cipher\.\?Admin)/gi, '($1)?')).join('|'); | |||
const leadersRegex = leaders.map(l => l.replace(/\d/g, '.?').replace(/\W/g, '.?').replace(/(Cipher\.\?Admin)/gi, '($1)?')).join('|'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -850,7 +902,7 @@ const selectWeightedOption = (options_array) => { | |||
const quizTypes = [ | |||
new WeightedOption(whosThatPokemon, 150), | |||
new WeightedOption(pokemonType, 85), | |||
new WeightedOption(howDoesThisPokemonEvole, 80), | |||
new WeightedOption(howDoesThisPokemonEvolve, 80), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did i never notice this 🤦
@@ -104,7 +106,52 @@ const whosThatPokemon = () => new Promise(resolve => { | |||
})(); | |||
}); | |||
|
|||
const howDoesThisPokemonEvole = () => new Promise(resolve => { | |||
const whatIsThatBerry = () => new Promise(resolve => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
A follow up of the previous PR.
Changes