From 80872f4ab9a0184c05d1b34dfec4a052c1c0709b Mon Sep 17 00:00:00 2001 From: quarty <142720982+qwertyquarty@users.noreply.github.com> Date: Mon, 22 Sep 2025 04:44:13 +0200 Subject: [PATCH] MessageLatency: add option to ignore own messages (#3677) Co-authored-by: V --- src/plugins/messageLatency/index.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/messageLatency/index.tsx b/src/plugins/messageLatency/index.tsx index b81c55cf..437ce644 100644 --- a/src/plugins/messageLatency/index.tsx +++ b/src/plugins/messageLatency/index.tsx @@ -11,7 +11,7 @@ import { isNonNullish } from "@utils/guards"; import definePlugin, { OptionType } from "@utils/types"; import { Message } from "@vencord/discord-types"; import { findComponentByCodeLazy } from "@webpack"; -import { SnowflakeUtils, Tooltip } from "@webpack/common"; +import { AuthenticationStore, SnowflakeUtils, Tooltip } from "@webpack/common"; type FillValue = ("status-danger" | "status-warning" | "status-positive" | "text-muted"); type Fill = [FillValue, FillValue, FillValue]; @@ -48,6 +48,11 @@ export default definePlugin({ type: OptionType.BOOLEAN, description: "Show milliseconds", default: false + }, + ignoreSelf: { + type: OptionType.BOOLEAN, + description: "Don't add indicator to your own messages", + default: false } }), @@ -91,7 +96,7 @@ export default definePlugin({ }, latencyTooltipData(message: Message) { - const { latency, detectDiscordKotlin, showMillis } = this.settings.store; + const { latency, detectDiscordKotlin, showMillis, ignoreSelf } = this.settings.store; const { id, nonce } = message; // Message wasn't received through gateway @@ -100,6 +105,8 @@ export default definePlugin({ // Bots basically never send a nonce, and if someone does do it then it's usually not a snowflake if (message.author.bot) return null; + if (ignoreSelf && message.author.id === AuthenticationStore.getId()) return null; + let isDiscordKotlin = false; let delta = SnowflakeUtils.extractTimestamp(id) - SnowflakeUtils.extractTimestamp(nonce); // milliseconds if (!showMillis) {