/Give card command should let you add multiple at once #359
Labels
No labels
blocked
duplicate
high priority
needs
approval
needs
criteria
needs
estimate
needs
tests
question
step
doing
step
review
step
testing
step
todo
step
uat
type
admin
type
alert
type
bug
type
change
type
defect
type
dependencies
type
development
type/documentation
type
epic
type
idea
type
incident
type
investigation
type
spike
type
story
type
tests
wontfix
No project
No assignees
2 participants
Notifications
Total time spent: 21 seconds
Due date
Smithy-bot
21 seconds
No due date set.
Dependencies
No dependencies set
Reference
External/card-drop#359
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
User story
As a whitelisted bot admin, I want to grant multiple copies of a card in one
/give cardinvocation so I can correct inventories faster when the bot breaks.Current behaviour
/give cardaccepts a single requiredcardnumberanduser; each run adds one copy to inventory (src/commands/give.ts).BOT_ADMINS, with existing sync/safe-mode checks unchanged./give currencyis unchanged by this issue.Acceptance criteria
GIVEN I am a whitelisted admin and drops are allowed
WHEN I run
/give cardwith a target user, a valid card number, and an optionalquantity(default 1)THEN that many copies are added to the user's inventory in a single command execution
AND the bot replies with the card name, amount added, and the new inventory total.
GIVEN I omit
quantityWHEN I run
/give cardTHEN behaviour matches today (exactly one copy is granted).
GIVEN I am not whitelisted, or drops are blocked (sync/safe mode), or the card number is invalid
WHEN I run
/give cardTHEN behaviour matches today's error handling (no inventory changes).
GIVEN
quantityis less than 1WHEN I run
/give cardTHEN the command is rejected and no inventory changes are made.
Subtasks
quantitynumber option to/give card(setMinValue(1), default 1)Inventory.AddQuantity/ constructor initial quantityNotes
/sacrificeand/effects buy./give currencyout of scope.Planning — needs/criteria
Reviewed
src/commands/give.ts:/give cardcurrently takes onecardnumberand always increments quantity by 1.To finish acceptance criteria, please confirm:
What should “multiple at once” mean?
#123), and/or#123,#456,#789to the same user), and/orIf multiple card numbers are supported, what is the maximum per invocation (Discord option limits may apply)?
Partial failure: if one card number is invalid, should the command fail entirely with no inventory changes, or apply the valid cards and report which failed?
Reply format: is a single summary message listing each card name, amount added, and new inventory total acceptable?
Once you reply, I’ll lock the criteria and move the ticket to needs/estimate.
@Smithy-bot wrote in #359 (comment):
Planning — criteria locked
Confirmed from owner reply:
quantityon one card (not multiple card numbers)Implementation plan
File:
src/commands/give.tsonly for behaviour; addtests/commands/give.test.ts.cardsubcommand, add optional number optionquantitywith.setMinValue(1)and description like sacrifice/effects (The amount to give (default 1)).const quantity = Number(interaction.options.get("quantity")?.value ?? 1); reject if< 1(belt-and-braces if Discord client skips min).new Inventory(userId, cardId, quantity)inventory.AddQuantity(quantity)(align with claim/multidrop; replaceSetQuantity(+1))Card {name} x{quantity} given to {username}, they now have {Quantity}.BOT_ADMINS, sync/AllowDrops, safemode, invalid-card errors,/give currency.tests/commands/drop.test.tsmocks: default quantity 1, explicit quantity N, non-admin / sync / safemode / missing card (no save).Moved to needs/estimate.
Planning — needs/estimate
Story points: 3
give.ts, optionalquantityoption, reply text/sacrificeand/effects buyquantity UX; inventory viaAddQuantity/ constructorgivecommand tests (default 1, explicit N, existing guard paths)Rationale: slightly more than a 1-point tweak because of test coverage and touching inventory grant logic, but well-bounded and no cross-cutting changes.
Moving to needs/tests.
Planning — needs/tests → needs/approval
QA scripts mapped to the acceptance criteria in the issue description. Run on a branch with the implementation merged or deployed to stage; unit-test rows can run locally via
yarn test.Preconditions
BOT_ADMINSand a non-admin user for guard checks.yarn test(targettests/commands/give.test.tsor equivalent).AC1 — Grant multiple copies in one invocation (default quantity behaviour when set)
/give cardwithuser, validcardnumber,quantity= 5Inventoryrow created with quantity 5AC2 — Omit
quantity→ exactly one copy (unchanged from today)/give cardwithuserandcardnumber, noquantityoptionAC3 — Existing guards unchanged (no inventory changes on failure)
/give card(any quantity)AllowDropsfalse)cardnumberquantity> 1AC4 —
quantityless than 1 rejectedquantity= 0 (if reachable past Discord min)quantityoption hassetMinValue(1)Unit tests (subtasks)
yarn test— give command suitequantity= Nsave/ no quantity change (mirrordrop.test.tspatterns)Regression / scope
/give currencysubcommandSign-off checklist
Moving to needs/approval for your review before implementation. @Vylpes