Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(modLog): add timeout duration #1173

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/yuudachi/locales/en-US/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@
"mod_log": {
"case_log": {
"description": "**Member**: `{{- target_tag}}` ({{target_id}})\n**Action**: {{- action}}",
"expiration": "\n**Expiration**: {{- time}}",
"duration": "\n**Duration**: `{{- time}}` {{- timestamp}}",
"context": "**Context:** {{- link}}",
"context_sub": "Beam me up, Yuu",
"reason": "\n**Reason:** {{- reason}}",
Expand Down
8 changes: 6 additions & 2 deletions apps/yuudachi/src/functions/logging/generateCaseLog.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ms } from "@naval-base/ms";
import { logger, kSQL, container } from "@yuudachi/framework";
import { Client, type Snowflake, hyperlink, time, TimestampStyles, messageLink, channelLink } from "discord.js";
import i18next from "i18next";
Expand Down Expand Up @@ -36,8 +37,11 @@ export async function generateCaseLog(case_: Case, logChannelId: Snowflake, loca
});

if (case_.actionExpiration) {
msg += i18next.t("log.mod_log.case_log.expiration", {
time: time(new Date(case_.actionExpiration), TimestampStyles.RelativeTime),
const expirationDate = new Date(case_.actionExpiration);

msg += i18next.t("log.mod_log.case_log.duration", {
time: ms(expirationDate.getTime() - Date.now()),
timestamp: time(expirationDate, TimestampStyles.RelativeTime),
lng: locale,
});
}
Expand Down