Skip to content

Commit

Permalink
Do not send a kmail if it would have no items
Browse files Browse the repository at this point in the history
  • Loading branch information
pstalcup committed Dec 16, 2024
1 parent c7173a8 commit 5a14900
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
use,
wellStocked,
} from "kolmafia";
import { AsdonMartin, Kmail } from "libram";
import { AsdonMartin, Kmail, sumNumbers } from "libram";
import { Options } from "./options";
import { TabTitle } from "./types";
import { coinmasterBest, coinmasterBuyAll } from "./coinmaster";
Expand Down Expand Up @@ -116,7 +116,8 @@ export const actions: {
}
const itemQuantities = new Map<Item, number>(items.map((i) => [i, amount(i, options)]));
print(`Sending Kmail to ${target}`);
Kmail.send(target, options.body ?? "", itemQuantities);
if (sumNumbers([...itemQuantities.values()]) > 0)
Kmail.send(target, options.body ?? "", itemQuantities);
},
};
},
Expand Down

0 comments on commit 5a14900

Please sign in to comment.