mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 10:32:43 +00:00
chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -2,10 +2,7 @@ import { type Message, MessageType } from "@buape/carbon";
|
||||
|
||||
import { formatDiscordUserTag } from "./format.js";
|
||||
|
||||
export function resolveDiscordSystemEvent(
|
||||
message: Message,
|
||||
location: string,
|
||||
): string | null {
|
||||
export function resolveDiscordSystemEvent(message: Message, location: string): string | null {
|
||||
switch (message.type) {
|
||||
case MessageType.ChannelPinnedMessage:
|
||||
return buildDiscordSystemEvent(message, location, "pinned a message");
|
||||
@@ -18,84 +15,42 @@ export function resolveDiscordSystemEvent(
|
||||
case MessageType.GuildBoost:
|
||||
return buildDiscordSystemEvent(message, location, "boosted the server");
|
||||
case MessageType.GuildBoostTier1:
|
||||
return buildDiscordSystemEvent(
|
||||
message,
|
||||
location,
|
||||
"boosted the server (Tier 1 reached)",
|
||||
);
|
||||
return buildDiscordSystemEvent(message, location, "boosted the server (Tier 1 reached)");
|
||||
case MessageType.GuildBoostTier2:
|
||||
return buildDiscordSystemEvent(
|
||||
message,
|
||||
location,
|
||||
"boosted the server (Tier 2 reached)",
|
||||
);
|
||||
return buildDiscordSystemEvent(message, location, "boosted the server (Tier 2 reached)");
|
||||
case MessageType.GuildBoostTier3:
|
||||
return buildDiscordSystemEvent(
|
||||
message,
|
||||
location,
|
||||
"boosted the server (Tier 3 reached)",
|
||||
);
|
||||
return buildDiscordSystemEvent(message, location, "boosted the server (Tier 3 reached)");
|
||||
case MessageType.ThreadCreated:
|
||||
return buildDiscordSystemEvent(message, location, "created a thread");
|
||||
case MessageType.AutoModerationAction:
|
||||
return buildDiscordSystemEvent(
|
||||
message,
|
||||
location,
|
||||
"auto moderation action",
|
||||
);
|
||||
return buildDiscordSystemEvent(message, location, "auto moderation action");
|
||||
case MessageType.GuildIncidentAlertModeEnabled:
|
||||
return buildDiscordSystemEvent(
|
||||
message,
|
||||
location,
|
||||
"raid protection enabled",
|
||||
);
|
||||
return buildDiscordSystemEvent(message, location, "raid protection enabled");
|
||||
case MessageType.GuildIncidentAlertModeDisabled:
|
||||
return buildDiscordSystemEvent(
|
||||
message,
|
||||
location,
|
||||
"raid protection disabled",
|
||||
);
|
||||
return buildDiscordSystemEvent(message, location, "raid protection disabled");
|
||||
case MessageType.GuildIncidentReportRaid:
|
||||
return buildDiscordSystemEvent(message, location, "raid reported");
|
||||
case MessageType.GuildIncidentReportFalseAlarm:
|
||||
return buildDiscordSystemEvent(
|
||||
message,
|
||||
location,
|
||||
"raid report marked false alarm",
|
||||
);
|
||||
return buildDiscordSystemEvent(message, location, "raid report marked false alarm");
|
||||
case MessageType.StageStart:
|
||||
return buildDiscordSystemEvent(message, location, "stage started");
|
||||
case MessageType.StageEnd:
|
||||
return buildDiscordSystemEvent(message, location, "stage ended");
|
||||
case MessageType.StageSpeaker:
|
||||
return buildDiscordSystemEvent(
|
||||
message,
|
||||
location,
|
||||
"stage speaker updated",
|
||||
);
|
||||
return buildDiscordSystemEvent(message, location, "stage speaker updated");
|
||||
case MessageType.StageTopic:
|
||||
return buildDiscordSystemEvent(message, location, "stage topic updated");
|
||||
case MessageType.PollResult:
|
||||
return buildDiscordSystemEvent(message, location, "poll results posted");
|
||||
case MessageType.PurchaseNotification:
|
||||
return buildDiscordSystemEvent(
|
||||
message,
|
||||
location,
|
||||
"purchase notification",
|
||||
);
|
||||
return buildDiscordSystemEvent(message, location, "purchase notification");
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function buildDiscordSystemEvent(
|
||||
message: Message,
|
||||
location: string,
|
||||
action: string,
|
||||
) {
|
||||
const authorLabel = message.author
|
||||
? formatDiscordUserTag(message.author)
|
||||
: "";
|
||||
function buildDiscordSystemEvent(message: Message, location: string, action: string) {
|
||||
const authorLabel = message.author ? formatDiscordUserTag(message.author) : "";
|
||||
const actor = authorLabel ? `${authorLabel} ` : "";
|
||||
return `Discord system: ${actor}${action} in ${location}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user