From 74cedcf27b122a534b0eefa99fd45c4648d47367 Mon Sep 17 00:00:00 2001 From: themrrobert <10122432+themrrobert@users.noreply.github.com> Date: Thu, 11 Jan 2024 02:39:05 -0800 Subject: [PATCH] Adds 'Auto Slay' button to trip finish for Patrons. (#5570) --- src/lib/util/globalInteractions.ts | 9 +++++++++ src/lib/util/handleTripFinish.ts | 3 +++ .../lib/abstracted_commands/autoSlayCommand.ts | 2 +- .../lib/abstracted_commands/minionStatusCommand.ts | 14 ++++++-------- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/lib/util/globalInteractions.ts b/src/lib/util/globalInteractions.ts index 61c1bc1926..207c4f2db4 100644 --- a/src/lib/util/globalInteractions.ts +++ b/src/lib/util/globalInteractions.ts @@ -94,6 +94,15 @@ export function makeBirdHouseTripButton() { .setStyle(ButtonStyle.Secondary) .setEmoji('692946556399124520'); } + +export function makeAutoSlayButton() { + return new ButtonBuilder() + .setCustomId('AUTO_SLAY') + .setLabel('Auto Slay') + .setEmoji('630911040560824330') + .setStyle(ButtonStyle.Secondary); +} + const reactionTimeLimits = { 0: Time.Hour * 12, [PerkTier.One]: Time.Hour * 12, diff --git a/src/lib/util/handleTripFinish.ts b/src/lib/util/handleTripFinish.ts index 807e6c09fd..3443e4a268 100644 --- a/src/lib/util/handleTripFinish.ts +++ b/src/lib/util/handleTripFinish.ts @@ -18,6 +18,7 @@ import { ActivityTaskData } from '../types/minions'; import { channelIsSendable, makeComponents } from '../util'; import { makeAutoContractButton, + makeAutoSlayButton, makeBirdHouseTripButton, makeNewSlayerTaskButton, makeOpenCasketButton, @@ -148,6 +149,8 @@ export async function handleTripFinish( ['MonsterKilling', 'Inferno', 'FightCaves'].includes(data.type) ) { components.push(makeNewSlayerTaskButton()); + } else { + components.push(makeAutoSlayButton()); } if (loot?.has('Seed pack')) { components.push(makeOpenSeedPackButton()); diff --git a/src/mahoji/lib/abstracted_commands/autoSlayCommand.ts b/src/mahoji/lib/abstracted_commands/autoSlayCommand.ts index d9fa852df2..2d81c2e2cb 100644 --- a/src/mahoji/lib/abstracted_commands/autoSlayCommand.ts +++ b/src/mahoji/lib/abstracted_commands/autoSlayCommand.ts @@ -236,7 +236,7 @@ export async function autoSlayCommand({ const isOnTask = usersTask.assignedTask !== null && usersTask.currentTask !== null; if (!isOnTask) { - return slayerNewTaskCommand({ userID: user.id, channelID, interaction }); + return slayerNewTaskCommand({ userID: user.id, channelID, interaction, showButtons: true }); } const savedMethod = determineAutoslayMethod(autoslayOptions as AutoslayOptionsEnum[]); const method = modeOverride ?? savedMethod; diff --git a/src/mahoji/lib/abstracted_commands/minionStatusCommand.ts b/src/mahoji/lib/abstracted_commands/minionStatusCommand.ts index e8393213d7..ba9b700905 100644 --- a/src/mahoji/lib/abstracted_commands/minionStatusCommand.ts +++ b/src/mahoji/lib/abstracted_commands/minionStatusCommand.ts @@ -8,7 +8,11 @@ import { clArrayUpdate } from '../../../lib/handleNewCLItems'; import { roboChimpSyncData, roboChimpUserFetch } from '../../../lib/roboChimp'; import { prisma } from '../../../lib/settings/prisma'; import { makeComponents } from '../../../lib/util'; -import { makeAutoContractButton, makeBirdHouseTripButton } from '../../../lib/util/globalInteractions'; +import { + makeAutoContractButton, + makeAutoSlayButton, + makeBirdHouseTripButton +} from '../../../lib/util/globalInteractions'; import { minionStatus } from '../../../lib/util/minionStatus'; import { makeRepeatTripButtons } from '../../../lib/util/repeatStoredTrip'; import { calculateBirdhouseDetails } from './birdhousesCommand'; @@ -100,13 +104,7 @@ export async function minionStatusCommand(user: MUser): Promise