diff --git a/src/equicordplugins/messageLatency/index.tsx b/src/equicordplugins/messageLatency/index.tsx deleted file mode 100644 index b42f08d0..00000000 --- a/src/equicordplugins/messageLatency/index.tsx +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { definePluginSettings } from "@api/Settings"; -import { EquicordDevs } from "@utils/constants"; -import { isNonNullish } from "@utils/guards"; -import definePlugin, { OptionType } from "@utils/types"; -import { waitFor } from "@webpack"; -import { SnowflakeUtils, Tooltip } from "@webpack/common"; -import { Message } from "discord-types/general"; - -type FillValue = ("status-danger" | "status-warning" | "text-muted"); -type Fill = [FillValue, FillValue, FillValue]; -type DiffKey = keyof Diff; - -interface Diff { - days: number, - hours: number, - minutes: number, - seconds: number; -} - -let HiddenVisually; -waitFor("HiddenVisually", mod => { - HiddenVisually = mod.HiddenVisually; -}); - -export default definePlugin({ - name: "MessageLatency", - description: "Displays an indicator for messages that took ≥n seconds to send", - authors: [EquicordDevs.arHSM], - settings: definePluginSettings({ - latency: { - type: OptionType.NUMBER, - description: "Threshold in seconds for latency indicator", - default: 2 - } - }), - patches: [ - { - find: "showCommunicationDisabledStyles", - replacement: { - match: /(message:(\i),avatar:\i,username:\(0,\i.jsxs\)\(\i.Fragment,\{children:\[)(\i&&)/, - replace: "$1$self.Tooltip($2),$3" - } - } - ], - stringDelta(delta: number) { - const diff: Diff = { - days: Math.round(delta / (60 * 60 * 24)), - hours: Math.round((delta / (60 * 60)) % 24), - minutes: Math.round((delta / (60)) % 60), - seconds: Math.round(delta % 60), - }; - - const str = (k: DiffKey) => diff[k] > 0 ? `${diff[k]} ${k}` : null; - const keys: DiffKey[] = ["days", "hours", "minutes", "seconds"]; - - return keys.map(str).filter(isNonNullish).join(" "); - }, - latencyTooltipData(message: Message) { - const { id, nonce } = message; - - // Message wasn't received through gateway - if (!isNonNullish(nonce)) return null; - - const delta = Math.round((SnowflakeUtils.extractTimestamp(id) - SnowflakeUtils.extractTimestamp(nonce)) / 1000); - - // Thanks dziurwa (I hate you) - // This is when the user's clock is ahead - // Can't do anything if the clock is behind - const abs = Math.abs(delta); - const ahead = abs !== delta; - - const stringDelta = this.stringDelta(abs); - - // Also thanks dziurwa - // 2 minutes - const TROLL_LIMIT = 2 * 60; - const { latency } = this.settings.store; - - const fill: Fill = delta >= TROLL_LIMIT || ahead ? ["text-muted", "text-muted", "text-muted"] : delta >= (latency * 2) ? ["status-danger", "text-muted", "text-muted"] : ["status-warning", "status-warning", "text-muted"]; - - return abs >= latency ? { delta: stringDelta, ahead: abs !== delta, fill } : null; - }, - Tooltip(message: Message) { - - const d = this.latencyTooltipData(message); - - if (!isNonNullish(d)) return null; - - return - { - props => <> - {} - {/* Time Out indicator uses this, I think this is for a11y */} - Delayed Message - - } - ; - }, - Icon({ delta, fill, props }: { - delta: string; - fill: Fill, - props: { - onClick(): void; - onMouseEnter(): void; - onMouseLeave(): void; - onContextMenu(): void; - onFocus(): void; - onBlur(): void; - "aria-label"?: string; - }; - }) { - return - - - - ; - } -}); diff --git a/src/equicordplugins/replyTimestamp/index.tsx b/src/equicordplugins/replyTimestamp/index.tsx deleted file mode 100644 index 5f841905..00000000 --- a/src/equicordplugins/replyTimestamp/index.tsx +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import "./style.css"; - -import ErrorBoundary from "@components/ErrorBoundary"; -import { Devs } from "@utils/constants"; -import definePlugin from "@utils/types"; -import { findByPropsLazy } from "@webpack"; -import { Timestamp } from "@webpack/common"; -import type { Message } from "discord-types/general"; -import type { HTMLAttributes } from "react"; - -const { getMessageTimestampId } = findByPropsLazy("getMessageTimestampId"); -const { calendarFormat, dateFormat, isSameDay } = findByPropsLazy("calendarFormat", "dateFormat", "isSameDay", "accessibilityLabelCalendarFormat"); -const MessageClasses = findByPropsLazy("separator", "latin24CompactTimeStamp"); - -function Sep(props: HTMLAttributes) { - return ; -} - -function ReplyTimestamp({ - referencedMessage, - baseMessage, -}: { - referencedMessage: { state: number, message?: Message; }, - baseMessage: Message; -}) { - if (referencedMessage.state !== 0) return null; - const refTimestamp = referencedMessage.message!.timestamp as any; - const baseTimestamp = baseMessage.timestamp as any; - return ( - - [ - {isSameDay(refTimestamp, baseTimestamp) - ? dateFormat(refTimestamp, "LT") - : calendarFormat(refTimestamp) - } - ] - - ); -} - -export default definePlugin({ - name: "ReplyTimestamp", - description: "Shows a timestamp on replied-message previews", - authors: [Devs.Kyuuhachi], - - patches: [ - { - find: "renderSingleLineMessage:function()", - replacement: { - match: /(?<="aria-label":\i,children:\[)(?=\i,\i,\i\])/, - replace: "$self.ReplyTimestamp(arguments[0])," - } - } - ], - - ReplyTimestamp: ErrorBoundary.wrap(ReplyTimestamp, { noop: true }), -}); diff --git a/src/equicordplugins/replyTimestamp/style.css b/src/equicordplugins/replyTimestamp/style.css deleted file mode 100644 index f4237171..00000000 --- a/src/equicordplugins/replyTimestamp/style.css +++ /dev/null @@ -1,3 +0,0 @@ -.vc-reply-timestamp { - margin-right: 0.25em; -} diff --git a/src/equicordplugins/voiceDownload/index.tsx b/src/equicordplugins/voiceDownload/index.tsx deleted file mode 100644 index 8ee9a2a4..00000000 --- a/src/equicordplugins/voiceDownload/index.tsx +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import "./style.css"; - -import ErrorBoundary from "@components/ErrorBoundary"; -import { EquicordDevs } from "@utils/constants"; -import definePlugin from "@utils/types"; - -export default definePlugin({ - name: "VoiceDownload", - description: "Download voice messages.", - authors: [EquicordDevs.puv], - patches: [ - { - find: ".rippleContainer", - replacement: { - match: /\(0,i.jsx\).{0,150},children:.{0,50}\("source",{src:(.{1,2})}\)}\)/, - replace: "[$&, $self.renderDownload($1)]" - } - } - ], - - renderDownload: function (src) { - return ( - - e.stopPropagation()} - > - - ); - }, - - Icon: () => ( - - - - ), -}); diff --git a/src/equicordplugins/voiceDownload/style.css b/src/equicordplugins/voiceDownload/style.css deleted file mode 100644 index f3f07807..00000000 --- a/src/equicordplugins/voiceDownload/style.css +++ /dev/null @@ -1,12 +0,0 @@ -.voice-download { - width: 24px; - height: 24px; - color: var(--interactive-normal); - margin-left: 12px; - cursor: pointer; - position: relative; -} - -.voice-download:hover { - color: white; -} \ No newline at end of file diff --git a/src/plugins/messageLatency/README.md b/src/plugins/messageLatency/README.md deleted file mode 100644 index 8d2a776c..00000000 --- a/src/plugins/messageLatency/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# MessageLatency - -Displays an indicator for messages that took ≥n seconds to send. - -> **NOTE** -> -> - This plugin only applies to messages received after opening the channel -> - False positives can exist if the user's system clock has drifted. -> - Grouped messages only display latency of the first message - -## Demo - -### Chat View - -![chat-view](https://github.com/Vendicated/Vencord/assets/82430093/69430881-60b3-422f-aa3d-c62953837566) - -### Clock -ve Drift - -![pissbot-on-top](https://github.com/Vendicated/Vencord/assets/82430093/d9248b66-e761-4872-8829-e8bf4fea6ec8) - -### Clock +ve Drift - -![dumb-ai](https://github.com/Vendicated/Vencord/assets/82430093/0e9783cf-51d5-4559-ae10-42399e7d4099) - -### Connection Delay - -![who-this](https://github.com/Vendicated/Vencord/assets/82430093/fd68873d-8630-42cc-a166-e9063d2718b2) - -### Icons - -![icons](https://github.com/Vendicated/Vencord/assets/82430093/17630bd9-44ee-4967-bcdf-3315eb6eca85) diff --git a/src/plugins/replyTimestamp/README.md b/src/plugins/replyTimestamp/README.md deleted file mode 100644 index b7952bf3..00000000 --- a/src/plugins/replyTimestamp/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# ReplyTimestamp - -Shows timestamps on the previews of replied-to messages. Pretty simple. - -![](https://github.com/Vendicated/Vencord/assets/1547062/62e2b67a-e567-4c7a-884d-4640f897f7e0)