diff --git a/eslint.config.mjs b/eslint.config.mjs index 07c70fa74..67327b938 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -105,7 +105,13 @@ export default tseslint.config( "no-invalid-regexp": "error", "no-constant-condition": ["error", { "checkLoops": false }], "no-duplicate-imports": "error", - "dot-notation": "error", + "@typescript-eslint/dot-notation": [ + "error", + { + "allowPrivateClassPropertyAccess": true, + "allowProtectedClassPropertyAccess": true + } + ], "no-useless-escape": [ "error", { diff --git a/package.json b/package.json index a7dca5793..057175f9c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vencord", "private": "true", - "version": "1.11.2", + "version": "1.11.3", "description": "The cutest Discord client mod", "homepage": "https://github.com/Vendicated/Vencord#readme", "bugs": { diff --git a/src/api/Badges.ts b/src/api/Badges.ts index 7a041f1ee..ee2f3a30c 100644 --- a/src/api/Badges.ts +++ b/src/api/Badges.ts @@ -57,7 +57,7 @@ const Badges = new Set(); * Register a new badge with the Badges API * @param badge The badge to register */ -export function addBadge(badge: ProfileBadge) { +export function addProfileBadge(badge: ProfileBadge) { badge.component &&= ErrorBoundary.wrap(badge.component, { noop: true }); Badges.add(badge); } @@ -66,7 +66,7 @@ export function addBadge(badge: ProfileBadge) { * Unregister a badge from the Badges API * @param badge The badge to remove */ -export function removeBadge(badge: ProfileBadge) { +export function removeProfileBadge(badge: ProfileBadge) { return Badges.delete(badge); } @@ -100,20 +100,3 @@ export interface BadgeUserArgs { userId: string; guildId: string; } - -interface ConnectedAccount { - type: string; - id: string; - name: string; - verified: boolean; -} - -interface Profile { - connectedAccounts: ConnectedAccount[]; - premiumType: number; - premiumSince: string; - premiumGuildSince?: any; - lastFetched: number; - profileFetchFailed: boolean; - application?: any; -} diff --git a/src/api/ChatButtons.tsx b/src/api/ChatButtons.tsx index d38f4ff50..6f4285ff5 100644 --- a/src/api/ChatButtons.tsx +++ b/src/api/ChatButtons.tsx @@ -9,7 +9,7 @@ import "./ChatButton.css"; import ErrorBoundary from "@components/ErrorBoundary"; import { Logger } from "@utils/Logger"; import { waitFor } from "@webpack"; -import { Button, ButtonLooks, ButtonWrapperClasses, Tooltip } from "@webpack/common"; +import { Button, ButtonWrapperClasses, Tooltip } from "@webpack/common"; import { Channel } from "discord-types/general"; import { HTMLProps, JSX, MouseEventHandler, ReactNode } from "react"; @@ -74,9 +74,9 @@ export interface ChatBarProps { }; } -export type ChatBarButton = (props: ChatBarProps & { isMainChat: boolean; }) => JSX.Element | null; +export type ChatBarButtonFactory = (props: ChatBarProps & { isMainChat: boolean; }) => JSX.Element | null; -const buttonFactories = new Map(); +const buttonFactories = new Map(); const logger = new Logger("ChatButtons"); export function _injectButtons(buttons: ReactNode[], props: ChatBarProps) { @@ -91,7 +91,7 @@ export function _injectButtons(buttons: ReactNode[], props: ChatBarProps) { } } -export const addChatBarButton = (id: string, button: ChatBarButton) => buttonFactories.set(id, button); +export const addChatBarButton = (id: string, button: ChatBarButtonFactory) => buttonFactories.set(id, button); export const removeChatBarButton = (id: string) => buttonFactories.delete(id); export interface ChatBarButtonProps { @@ -110,7 +110,7 @@ export const ChatBarButton = ErrorBoundary.wrap((props: ChatBarButtonProps) => { + ); + } + + if (props.channel.id === SUPPORT_CHANNEL_ID) { + if (props.message.content.includes("/vencord-debug") || props.message.content.includes("/vencord-plugins")) { + buttons.push( + , + + ); + } + + if (props.message.author.id === VENBOT_USER_ID) { + const match = CodeBlockRe.exec(props.message.content || props.message.embeds[0]?.rawDescription || ""); + if (match) { + buttons.push( + + ); + } + } + } + + return buttons.length + ? {buttons} + : null; + }, + renderContributorDmWarningCard: ErrorBoundary.wrap(({ channel }) => { const userId = channel.getRecipientId(); if (!isPluginDev(userId)) return null; @@ -250,85 +328,4 @@ export default definePlugin({ ); }, { noop: true }), - - start() { - addAccessory("vencord-debug", props => { - const buttons = [] as JSX.Element[]; - - const shouldAddUpdateButton = - !IS_UPDATER_DISABLED - && ( - (props.channel.id === KNOWN_ISSUES_CHANNEL_ID) || - (props.channel.id === SUPPORT_CHANNEL_ID && props.message.author.id === VENBOT_USER_ID) - ) - && props.message.content?.includes("update"); - - if (shouldAddUpdateButton) { - buttons.push( - - ); - } - - if (props.channel.id === SUPPORT_CHANNEL_ID) { - if (props.message.content.includes("/vencord-debug") || props.message.content.includes("/vencord-plugins")) { - buttons.push( - , - - ); - } - - if (props.message.author.id === VENBOT_USER_ID) { - const match = CodeBlockRe.exec(props.message.content || props.message.embeds[0]?.rawDescription || ""); - if (match) { - buttons.push( - - ); - } - } - } - - return buttons.length - ? {buttons} - : null; - }); - }, }); diff --git a/src/plugins/accountPanelServerProfile/index.tsx b/src/plugins/accountPanelServerProfile/index.tsx index e2dc220b7..a2fed5d79 100644 --- a/src/plugins/accountPanelServerProfile/index.tsx +++ b/src/plugins/accountPanelServerProfile/index.tsx @@ -23,7 +23,7 @@ const UserProfile = findComponentByCodeLazy("UserProfilePopoutWrapper: user cann const styles = findByPropsLazy("accountProfilePopoutWrapper"); let openAlternatePopout = false; -let accountPanelRef: React.MutableRefObject | null> = { current: null }; +let accountPanelRef: React.RefObject | null> = { current: null }; const AccountPanelContextMenu = ErrorBoundary.wrap(() => { const { prioritizeServerProfile } = settings.use(["prioritizeServerProfile"]); diff --git a/src/plugins/alwaysAnimate/index.ts b/src/plugins/alwaysAnimate/index.ts index fc528466f..a5297445b 100644 --- a/src/plugins/alwaysAnimate/index.ts +++ b/src/plugins/alwaysAnimate/index.ts @@ -43,8 +43,8 @@ export default definePlugin({ // Status emojis find: "#{intl::GUILD_OWNER}),children:", replacement: { - match: /(?<=\.activityEmoji,.+?animate:)\i/, - replace: "!0" + match: /(\.CUSTOM_STATUS.+?animate:)\i/, + replace: (_, rest) => `${rest}!0` } }, { diff --git a/src/plugins/betterFolders/FolderSideBar.tsx b/src/plugins/betterFolders/FolderSideBar.tsx index 53d24ed93..5203b14d2 100644 --- a/src/plugins/betterFolders/FolderSideBar.tsx +++ b/src/plugins/betterFolders/FolderSideBar.tsx @@ -17,14 +17,13 @@ */ import ErrorBoundary from "@components/ErrorBoundary"; -import { findByPropsLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack"; -import { useStateFromStores } from "@webpack/common"; +import { findComponentByCodeLazy, findStoreLazy } from "@webpack"; +import { Animations, useStateFromStores } from "@webpack/common"; import type { CSSProperties } from "react"; import { ExpandedGuildFolderStore, settings } from "."; const ChannelRTCStore = findStoreLazy("ChannelRTCStore"); -const Animations = findByPropsLazy("a", "animated", "useTransition"); const GuildsBar = findComponentByCodeLazy('("guildsnav")'); export default ErrorBoundary.wrap(guildsBarProps => { diff --git a/src/plugins/betterFolders/index.tsx b/src/plugins/betterFolders/index.tsx index d9d68f138..39c109656 100644 --- a/src/plugins/betterFolders/index.tsx +++ b/src/plugins/betterFolders/index.tsx @@ -173,8 +173,8 @@ export default definePlugin({ // Disable expanding and collapsing folders transition in the normal GuildsBar sidebar { predicate: () => !settings.store.keepIcons, - match: /(?<=#{intl::SERVER_FOLDER_PLACEHOLDER}.+?useTransition\)\()/, - replace: "$self.shouldShowTransition(arguments[0])&&" + match: /(?=,\{from:\{height)/, + replace: "&&$self.shouldShowTransition(arguments[0])" }, // If we are rendering the normal GuildsBar sidebar, we avoid rendering guilds from folders that are expanded { diff --git a/src/plugins/betterRoleContext/index.tsx b/src/plugins/betterRoleContext/index.tsx index 1029c07e2..afef63908 100644 --- a/src/plugins/betterRoleContext/index.tsx +++ b/src/plugins/betterRoleContext/index.tsx @@ -83,7 +83,7 @@ export default definePlugin({ if (!role) return; if (role.colorString) { - children.push( + children.unshift( { + await GuildSettingsActions.open(guild.id, "ROLES"); + GuildSettingsActions.selectRole(id); + }} + icon={PencilIcon} + /> + ); + } + if (role.icon) { children.push( { - await GuildSettingsActions.open(guild.id, "ROLES"); - GuildSettingsActions.selectRole(id); - }} - icon={PencilIcon} - /> - ); - } } } }); diff --git a/src/plugins/betterSessions/index.tsx b/src/plugins/betterSessions/index.tsx index 9347c398c..8f8ef141f 100644 --- a/src/plugins/betterSessions/index.tsx +++ b/src/plugins/betterSessions/index.tsx @@ -21,7 +21,7 @@ import { definePluginSettings } from "@api/Settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; -import { findByPropsLazy, findExportedComponentLazy, findStoreLazy } from "@webpack"; +import { findByPropsLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack"; import { Constants, React, RestAPI, Tooltip } from "@webpack/common"; import { RenameButton } from "./components/RenameButton"; @@ -34,7 +34,7 @@ const UserSettingsModal = findByPropsLazy("saveAccountChanges", "open"); const TimestampClasses = findByPropsLazy("timestampTooltip", "blockquoteContainer"); const SessionIconClasses = findByPropsLazy("sessionIcon"); -const BlobMask = findExportedComponentLazy("BlobMask"); +const BlobMask = findComponentByCodeLazy("!1,lowerBadgeSize:"); const settings = definePluginSettings({ backgroundCheck: { diff --git a/src/plugins/betterSettings/index.tsx b/src/plugins/betterSettings/index.tsx index 5a97b0a6e..461dfaac8 100644 --- a/src/plugins/betterSettings/index.tsx +++ b/src/plugins/betterSettings/index.tsx @@ -101,8 +101,8 @@ export default definePlugin({ find: 'minimal:"contentColumnMinimal"', replacement: [ { - match: /\(0,\i\.useTransition\)\((\i)/, - replace: "(_cb=>_cb(void 0,$1))||$&" + match: /(?=\(0,\i\.\i\)\((\i),\{from:\{position:"absolute")/, + replace: "(_cb=>_cb(void 0,$1))||" }, { match: /\i\.animated\.div/, diff --git a/src/plugins/callTimer/index.tsx b/src/plugins/callTimer/index.tsx index e16abc4a1..bdcca7772 100644 --- a/src/plugins/callTimer/index.tsx +++ b/src/plugins/callTimer/index.tsx @@ -75,8 +75,8 @@ export default definePlugin({ patches: [{ find: "renderConnectionStatus(){", replacement: { - match: /(?<=renderConnectionStatus\(\){.+\.channel,children:).+?}\):\i(?=}\))/, - replace: "[$&, $self.renderTimer(this.props.channel.id)]" + match: /(renderConnectionStatus\(\){.+\.channel,children:)(.+?}\):\i)(?=}\))/, + replace: "$1[$2,$self.renderTimer(this.props.channel.id)]" } }], diff --git a/src/plugins/clearURLs/index.ts b/src/plugins/clearURLs/index.ts index d1be6c6f5..f00c751d4 100644 --- a/src/plugins/clearURLs/index.ts +++ b/src/plugins/clearURLs/index.ts @@ -17,11 +17,7 @@ */ import { - addPreEditListener, - addPreSendListener, - MessageObject, - removePreEditListener, - removePreSendListener + MessageObject } from "@api/MessageEvents"; import { Devs } from "@utils/constants"; import definePlugin from "@utils/types"; @@ -36,7 +32,18 @@ export default definePlugin({ name: "ClearURLs", description: "Removes tracking garbage from URLs", authors: [Devs.adryd], - dependencies: ["MessageEventsAPI"], + + start() { + this.createRules(); + }, + + onBeforeMessageSend(_, msg) { + return this.onSend(msg); + }, + + onBeforeMessageEdit(_cid, _mid, msg) { + return this.onSend(msg); + }, escapeRegExp(str: string) { return (str && reHasRegExpChar.test(str)) @@ -133,17 +140,4 @@ export default definePlugin({ ); } }, - - start() { - this.createRules(); - this.preSend = addPreSendListener((_, msg) => this.onSend(msg)); - this.preEdit = addPreEditListener((_cid, _mid, msg) => - this.onSend(msg) - ); - }, - - stop() { - removePreSendListener(this.preSend); - removePreEditListener(this.preEdit); - }, }); diff --git a/src/plugins/clientTheme/index.tsx b/src/plugins/clientTheme/index.tsx index 4c1668aae..2dc7ccf6c 100644 --- a/src/plugins/clientTheme/index.tsx +++ b/src/plugins/clientTheme/index.tsx @@ -91,15 +91,12 @@ function ThemeSettings() { const settings = definePluginSettings({ color: { - description: "Color your Discord client theme will be based around. Light mode isn't supported", type: OptionType.COMPONENT, default: "313338", - component: () => + component: ThemeSettings }, resetColor: { - description: "Reset Theme Color", type: OptionType.COMPONENT, - default: "313338", component: () => (