3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-13 21:35:02 +00:00
zeppelin/backend/src/plugins/ContextMenus/actions/update.ts
Dragory 45e3fe2ef0
chore: esm imports
This will make merging this into 'next' much easier.
2024-08-11 21:58:52 +03:00

28 lines
890 B
TypeScript

import { GuildMember } from "discord.js";
import { GuildPluginData } from "knub";
import { CaseTypes } from "../../../data/CaseTypes.js";
import { Case } from "../../../data/entities/Case.js";
import { CasesPlugin } from "../../Cases/CasesPlugin.js";
import { LogsPlugin } from "../../Logs/LogsPlugin.js";
import { ContextMenuPluginType } from "../types.js";
export async function updateAction(
pluginData: GuildPluginData<ContextMenuPluginType>,
executingMember: GuildMember,
theCase: Case,
value: string,
) {
const casesPlugin = pluginData.getPlugin(CasesPlugin);
await casesPlugin.createCaseNote({
caseId: theCase.case_number,
modId: executingMember.id,
body: value,
});
void pluginData.getPlugin(LogsPlugin).logCaseUpdate({
mod: executingMember.user,
caseNumber: theCase.case_number,
caseType: CaseTypes[theCase.type],
note: value,
});
}