Skip to content
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

Merged
merged 12 commits into from
Nov 3, 2024
Merged

Botcoins followup #66

merged 12 commits into from
Nov 3, 2024

Conversation

RedzepR
Copy link
Contributor

@RedzepR RedzepR commented Oct 29, 2024

A follow up of the previous PR.

Changes

  • Bug fixes regarding questions
  • Wording regarding questions
  • Bug fix regarding /pokemon
  • New Question

Copy link
Owner

@RedSparr0w RedSparr0w left a 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*');
Copy link
Owner

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?

Suggested change
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*');

Comment on lines +179 to +183

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?`];
Copy link
Owner

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('|');
Copy link
Owner

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),
Copy link
Owner

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 => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@RedSparr0w RedSparr0w merged commit 7619648 into RedSparr0w:v14 Nov 3, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants