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

Fixed handling one word item name on buy/sell #1693

Merged
merged 1 commit into from
Feb 17, 2024

Conversation

nikviktorovich
Copy link
Contributor

Fixed invalid handling one word item names (e.g. Maul) on !buy or !sell. As of now, it parses the item name from !buy 5 Maul as 5 Maul instead of Maul.

Basically, the change is:

if (... && args.length > 2) { ... }

to

if (... && args.length > 1) { ... }

, but for testing purposes parsing logic moved to a separate function parseItemAndAmountFromMessage.

Apparently, the function getItemAndAmount(...) used to accept message with command included, but now all references use it as follows:
getItemAndAmount(steamID, CommandParser.removeCommand(message), this.bot, prefix);
, so the command is not included anymore.

The syntax below used instead of unpacking to make linter happy:

const name = parsedMessage.name;
let amount = parsedMessage.amount;

Fixes #1692

Copy link
Member

@idinium96 idinium96 left a comment

Choose a reason for hiding this comment

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

Thank you very much, and I am sorry it takes so long for me to look into this.

@idinium96 idinium96 merged commit 88410a7 into TF2Autobot:development Feb 17, 2024
@idinium96 idinium96 mentioned this pull request Feb 17, 2024
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