Skip to content

Commit

Permalink
Display DG Buyables list by sending command without item flag (#5784)
Browse files Browse the repository at this point in the history
  • Loading branch information
I-am-TURBO authored May 2, 2024
1 parent 8baf49e commit 3ce27b2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/mahoji/commands/dg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ async function startCommand(channelID: string, user: MUser, floor: string | unde
return str;
}

async function buyCommand(user: MUser, name: string, quantity?: number) {
async function buyCommand(user: MUser, name?: string, quantity?: number) {
const buyable = dungBuyables.find(i => stringMatches(name, i.item.name));
if (!buyable) {
return `That isn't a buyable item. Here are the items you can buy: \n\n${dungBuyables
.map(i => `**${i.item.name}:** ${i.cost.toLocaleString()} tokens`)
.join('\n')}.`;
let msg = `${dungBuyables.map(i => `**${i.item.name}:** ${i.cost.toLocaleString()} tokens`).join('\n')}.`;
if (name !== undefined) msg = `**That isn't a buyable item**. Here are the items you can buy:\n\n${msg}`;
return msg;
}

if (!quantity) {
Expand Down Expand Up @@ -258,7 +258,7 @@ export const dgCommand: OSBMahojiCommand = {
.filter(i => (!value ? true : i.item.name.toLowerCase().includes(value.toLowerCase())))

Check warning on line 258 in src/mahoji/commands/dg.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected string value in conditional. An explicit empty string check is required

Check warning on line 258 in src/mahoji/commands/dg.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected string value in conditional. An explicit empty string check is required
.map(i => ({ name: i.item.name, value: i.item.name }));
},
required: true
required: false
},
{
type: ApplicationCommandOptionType.Integer,
Expand All @@ -277,7 +277,7 @@ export const dgCommand: OSBMahojiCommand = {
interaction
}: CommandRunOptions<{
start?: { floor?: string; solo?: boolean };
buy?: { item: string; quantity?: number };
buy?: { item?: string; quantity?: number };
stats?: {};
}>) => {
if (interaction) await deferInteraction(interaction);

Check warning on line 283 in src/mahoji/commands/dg.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected object value in conditional. The condition is always true

Check warning on line 283 in src/mahoji/commands/dg.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected object value in conditional. The condition is always true
Expand Down

0 comments on commit 3ce27b2

Please sign in to comment.