Skip to content

Commit 9ae9066

Browse files
ebm5025Ed Morgan
andauthored
Warn when checking out a factioned bot (#213)
* Added faction warning to bot checkout * Check bot details for faction message --------- Co-authored-by: Ed Morgan <edwardmorgan706@gmail.com>
1 parent 7af54e6 commit 9ae9066

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
Warnings:
3+
4+
- Added the required column `factioned` to the `bot` table without a default value. This is not possible if the table is not empty.
5+
6+
*/
7+
-- AlterTable
8+
ALTER TABLE "bot" ADD COLUMN "factioned" BOOLEAN NOT NULL;

prisma/schema.prisma

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ model bot {
7777
checkoutTime String
7878
bindLocation String
7979
requiredRoles String[]
80+
factioned Boolean
8081
}
8182

8283
model batphone {

src/services/bot/bot-prisma.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { getClassAbreviation } from "../../shared/classes";
2525
import { raidBotInstructions } from "../../features/raid-bots/update-bots";
2626
import { ParkBotButtonCommand } from "../../features/raid-bots/park-bot-button-command";
2727
import { refreshBotEmbed } from "../../features/raid-bots/bot-embed";
28+
import { code } from "../../shared/util";
2829

2930
export class PrismaPublicAccounts implements IPublicAccountService {
3031
private prisma!: PrismaClient;
@@ -59,6 +60,7 @@ export class PrismaPublicAccounts implements IPublicAccountService {
5960
checkoutTime: time.isValid() ? time.toString() : "",
6061
currentPilot: row[BOT_SPREADSHEET_COLUMNS.CurrentPilot],
6162
bindLocation: row[BOT_SPREADSHEET_COLUMNS.BindLocation],
63+
factioned: row[BOT_SPREADSHEET_COLUMNS.Factioned] !== "",
6264
requiredRoles: roles.map((r) => r.id),
6365
},
6466
});
@@ -101,10 +103,16 @@ export class PrismaPublicAccounts implements IPublicAccountService {
101103
);
102104

103105
const foundBot = details.characters;
104-
106+
const prismaBot = await this.getBotByName(foundBot);
105107
const currentPilot = await this.getCurrentBotPilot(foundBot);
106108

107-
let response = `${details.characters} (${details.purpose})
109+
const factionWarning = `${code}diff
110+
- FACTIONED CHARACTER WARNING
111+
- BY PLAYING THIS CHARACTER YOU AGREE TO NOT TAKE ANY FACTION HITS. RAID LEADERSHIP RESERVES THE RIGHT TO RECOUP THE COSTS OF REFACTIONING THE BOT OR DOCK DKP, BASED ON THE DIFFICULTY OF REFACTIONING
112+
${code}`;
113+
114+
let response = `${prismaBot?.factioned ? factionWarning : ""}
115+
${details.characters} (${details.purpose})
108116
Account: ${details.accountName}
109117
Password: ${spoiler(details.password)}
110118
@@ -117,6 +125,7 @@ Password: ${spoiler(details.password)}
117125
components = await this.getBotParkButtonComponents(name);
118126
}
119127
response += `The credentials for ${foundBot} have been DM'd to you. Please remember to use \`/bot park\` when you are done!`;
128+
response += `${prismaBot?.factioned ? factionWarning : ""}`;
120129

121130
await interaction.editReply({
122131
content: response,

src/services/sheet-updater/public-sheet.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export enum BOT_SPREADSHEET_COLUMNS {
1616
CurrentPilot = "Current Bot Pilot",
1717
CheckoutTime = "Date and Time (EST) of pilot login",
1818
BindLocation = "Bind Location",
19+
Factioned = "Factioned",
1920
}
2021

2122
export class PublicSheetService {

0 commit comments

Comments
 (0)