Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/ewei068/pokestar
Browse files Browse the repository at this point in the history
  • Loading branch information
ewei068 committed Dec 8, 2024
2 parents 8c5b600 + 5acd035 commit 7ce9ab0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default [
"no-return-await": "off", // deprecated
"no-restricted-syntax": "off", // TODO: enable but make better lol
"no-underscore-dangle": "off", // Needed for mongo _id
"no-restricted-globals": "off", // globals work differently
"guard-for-in": "off", // TODO: enable but make better lol
"no-continue": "off", // doesn't seem to work properly
"no-await-in-loop": "off", // TODO: use promise.all
Expand Down
2 changes: 1 addition & 1 deletion src/commands/battle/partyRemove.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const partyRemove = async (user, option) => {
const partyPokemon = trainer.data.party.pokemonIds;

// if option is a number convert to number and use as position
if (!Number.isNaN(option)) {
if (!isNaN(option)) {
const position = parseInt(option, 10);
const index = position - 1;

Expand Down
5 changes: 3 additions & 2 deletions src/commands/social/tradeAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const { getIdFromNameOrId } = require("../../services/pokemon");
* Adds the given pokemon via ID to the position in the given user's trade.
* @param user user required for getting specific user's data.
* @param pokemonId the Id of the pokemon the user wants to add to their trade
* @param money
* @returns Error or message to send.
*/
// tradeAdd sends off the relevent user, pokemonId and position to buildtradeAddSend from the trade.js dependency and waits for it to return.
Expand All @@ -30,7 +31,7 @@ const tradeAddMessageCommand = async (message) => {
let money = 0;
let pokemonId = null;
// if parseInt money is NaN, then it will return null
if (!Number.isNaN(option)) {
if (!isNaN(option)) {
money = parseInt(option, 10);
} else {
pokemonId = option;
Expand All @@ -49,7 +50,7 @@ const tradeAddSlashCommand = async (interaction) => {
let money = 0;
let pokemonId = null;
// if parseInt money is NaN, then it will return null
if (!Number.isNaN(option)) {
if (!isNaN(option)) {
money = parseInt(option, 10);
await interaction.deferReply();
} else {
Expand Down
5 changes: 3 additions & 2 deletions src/commands/social/tradeRemove.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const { getIdFromNameOrId } = require("../../services/pokemon");
* Adds the given pokemon via ID to the position in the given user's trade.
* @param user user required for getting specific user's data.
* @param pokemonId the Id of the pokemon the user wants to add to their trade
* @param money
* @returns Error or message to send.
*/
// tradeRemove sends off the relevent user, pokemonId and position to buildtradeRemoveSend from the trade.js dependency and waits for it to return.
Expand All @@ -32,7 +33,7 @@ const tradeRemoveMessageCommand = async (message) => {

if (option === "ALL") {
// pass
} else if (!Number.isNaN(option)) {
} else if (!isNaN(option)) {
// if parseInt money is NaN, then it will return null
money = parseInt(option, 10);
} else {
Expand All @@ -55,7 +56,7 @@ const tradeRemoveSlashCommand = async (interaction) => {
if (option === "ALL") {
// pass
await interaction.deferReply();
} else if (!Number.isNaN(option)) {
} else if (!isNaN(option)) {
// if parseInt money is NaN, then it will return null
money = parseInt(option, 10);
await interaction.deferReply();
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/commandHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ const validateArgs = (command, args) => {

// type check
if (argConfig.type === "int") {
if (Number.isNaN(providedArg)) {
if (isNaN(providedArg)) {
return false;
}
} else if (argConfig.type === "bool") {
Expand Down

0 comments on commit 7ce9ab0

Please sign in to comment.