Skip to content

Commit 884eff2

Browse files
author
Ed Morgan
committed
Fix auto park command, enable embed
1 parent 12ba5dc commit 884eff2

File tree

5 files changed

+531
-522
lines changed

5 files changed

+531
-522
lines changed

src/features/raid-bots/bot-embed.ts

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
import { PublicAccountsFactory } from "../../services/bot/bot-factory";
1111
import moment from "moment";
1212
import { getClassAbreviation } from "../../shared/classes";
13-
import { log } from "../../shared/logger"
13+
import { log } from "../../shared/logger";
1414

1515
export const botEmbedInstructions = new InstructionsReadyAction(
1616
Name.BotStatusEmbed,
@@ -23,10 +23,10 @@ export const updateBotEmbed = (options: Options) => {
2323
}, options);
2424
};
2525

26-
const truncate = (str: string, maxLength: number) => {
26+
const truncate = (str: string, maxLength: number) => {
2727
if (str.length <= maxLength) return str;
28-
return str.slice(0, maxLength - 3) + '...';
29-
}
28+
return str.slice(0, maxLength - 3) + "...";
29+
};
3030
export const refreshBotEmbed = async () => {
3131
const publicAccounts = PublicAccountsFactory.getService();
3232
let botString = "";
@@ -65,20 +65,23 @@ export const refreshBotEmbed = async () => {
6565
}
6666

6767
botMessages.push(botString);
68-
69-
await botEmbedInstructions
70-
.createOrUpdateInstructions({
71-
embeds: botMessages.map((message: string, idx: number) => {
72-
return new EmbedBuilder({
73-
title:
74-
idx === 0
75-
? `Castle bots - last updated ${moment().toLocaleString()}`
76-
: "",
77-
description: message,
78-
});
79-
}),
80-
})
81-
.catch((reason) => {
82-
log(`Embed update failed: ${reason}`);
83-
});
68+
try {
69+
await botEmbedInstructions
70+
.createOrUpdateInstructions({
71+
embeds: botMessages.map((message: string, idx: number) => {
72+
return new EmbedBuilder({
73+
title:
74+
idx === 0
75+
? `Castle bots - last updated ${moment().toLocaleString()}`
76+
: "",
77+
description: message,
78+
});
79+
}),
80+
})
81+
.catch((reason) => {
82+
log(`Embed update failed: ${reason}`);
83+
});
84+
} catch (err: unknown) {
85+
log("Failed to update bot embed");
86+
}
8487
};

src/features/raid-bots/requestclass-subcommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { Mutex } from "async-mutex";
1414
import { LocationService } from "../../services/location";
1515
import { PublicAccountsFactory } from "../../services/bot/bot-factory";
1616
import { BOT_SPREADSHEET_COLUMNS } from "../../services/sheet-updater/public-sheet";
17-
import { log } from "../../shared/logger"
17+
import { log } from "../../shared/logger";
1818

1919

2020
export enum Option {

src/features/raid-bots/requestzone-subcommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { Mutex } from "async-mutex";
1414
import { LocationService } from "../../services/location";
1515
import { PublicAccountsFactory } from "../../services/bot/bot-factory";
1616
import { BOT_SPREADSHEET_COLUMNS } from "../../services/sheet-updater/public-sheet";
17-
import { log } from "../../shared/logger"
17+
import { log } from "../../shared/logger";
1818

1919
export enum Option {
2020
Location = "location",

src/listeners/ready-listener.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const readyListener = async (client: Client) => {
2525
updateInviteListInfo(client, updateOptions),
2626
updateJewelryRequestInfo(client, updateOptions),
2727
updateRaiderInfo(client, updateOptions),
28-
updateReinforcementInfo(client, updateOptions)
29-
//updateBotEmbed({ repeatDuration: 30000 }),
28+
updateReinforcementInfo(client, updateOptions),
29+
updateBotEmbed({ repeatDuration: 30000 }),
3030
];
3131
};

0 commit comments

Comments
 (0)