Skip to content

Commit

Permalink
Adds 'Auto Slay' button to trip finish for Patrons. (#5570)
Browse files Browse the repository at this point in the history
  • Loading branch information
themrrobert authored Jan 11, 2024
1 parent a8050ba commit 74cedcf
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
9 changes: 9 additions & 0 deletions src/lib/util/globalInteractions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions src/lib/util/handleTripFinish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { ActivityTaskData } from '../types/minions';
import { channelIsSendable, makeComponents } from '../util';
import {
makeAutoContractButton,
makeAutoSlayButton,
makeBirdHouseTripButton,
makeNewSlayerTaskButton,
makeOpenCasketButton,
Expand Down Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion src/mahoji/lib/abstracted_commands/autoSlayCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 6 additions & 8 deletions src/mahoji/lib/abstracted_commands/minionStatusCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -100,13 +104,7 @@ export async function minionStatusCommand(user: MUser): Promise<BaseMessageOptio
}

if (!minionIsBusy) {
buttons.push(
new ButtonBuilder()
.setCustomId('AUTO_SLAY')
.setLabel('Auto Slay')
.setEmoji('630911040560824330')
.setStyle(ButtonStyle.Secondary)
);
buttons.push(makeAutoSlayButton());
}

buttons.push(
Expand Down

0 comments on commit 74cedcf

Please sign in to comment.