Merge branch 'dev'

This commit is contained in:
thororen1234 2024-11-05 15:28:08 -05:00
commit e1a1f1e2a8
127 changed files with 473 additions and 382 deletions

View file

@ -1,7 +1,7 @@
{
"name": "equicord",
"private": "true",
"version": "1.10.5",
"version": "1.10.6",
"description": "The other cutest Discord client mod",
"homepage": "https://github.com/Equicord/Equicord#readme",
"bugs": {
@ -38,6 +38,7 @@
"dependencies": {
"@ffmpeg/ffmpeg": "^0.12.10",
"@ffmpeg/util": "^0.12.1",
"@intrnl/xxhash64": "^0.1.2",
"@sapphi-red/web-noise-suppressor": "0.3.5",
"@types/less": "^3.0.6",
"@types/stylus": "^0.48.42",
@ -119,4 +120,4 @@
"node": ">=18",
"pnpm": ">=9"
}
}
}

22
pnpm-lock.yaml generated
View file

@ -22,6 +22,9 @@ importers:
'@ffmpeg/util':
specifier: ^0.12.1
version: 0.12.1
'@intrnl/xxhash64':
specifier: ^0.1.2
version: 0.1.2
'@sapphi-red/web-noise-suppressor':
specifier: 0.3.5
version: 0.3.5
@ -425,6 +428,7 @@ packages:
'@eslint/object-schema@2.1.4':
resolution: {integrity: sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@ffmpeg/ffmpeg@0.12.10':
resolution: {integrity: sha512-lVtk8PW8e+NUzGZhPTWj2P1J4/NyuCrbDD3O9IGpSeLYtUZKBqZO8CNj1WYGghep/MXoM8e1qVY1GztTkf8YYQ==}
engines: {node: '>=18.x'}
@ -437,10 +441,6 @@ packages:
resolution: {integrity: sha512-10jjfAKWaDyb8+nAkijcsi9wgz/y26LOc1NKJradNMyCIl6usQcBbhkjX5qhALrSBcOy6TOeksunTYa+a03qNQ==}
engines: {node: '>=18.x'}
'@humanwhocodes/config-array@0.11.10':
resolution: {integrity: sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==}
engines: {node: '>=10.10.0'}
'@humanwhocodes/module-importer@1.0.1':
resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==}
engines: {node: '>=12.22'}
@ -449,6 +449,9 @@ packages:
resolution: {integrity: sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==}
engines: {node: '>=18.18'}
'@intrnl/xxhash64@0.1.2':
resolution: {integrity: sha512-1+lx7j99fdph+uy3EnjQyr39KQZ7LP56+aWOr6finJWpgYpvb7XrhFUqDwnEk/wpPC98nCjAT6RulpW3crWjlg==}
'@jridgewell/gen-mapping@0.3.5':
resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==}
engines: {node: '>=6.0.0'}
@ -2585,6 +2588,7 @@ snapshots:
'@eslint/js@9.8.0': {}
'@eslint/object-schema@2.1.4': {}
'@ffmpeg/ffmpeg@0.12.10':
dependencies:
'@ffmpeg/types': 0.12.2
@ -2593,18 +2597,12 @@ snapshots:
'@ffmpeg/util@0.12.1': {}
'@humanwhocodes/config-array@0.11.10':
dependencies:
'@humanwhocodes/object-schema': 1.2.1
debug: 4.3.4
minimatch: 3.1.2
transitivePeerDependencies:
- supports-color
'@humanwhocodes/module-importer@1.0.1': {}
'@humanwhocodes/retry@0.3.0': {}
'@intrnl/xxhash64@0.1.2': {}
'@jridgewell/gen-mapping@0.3.5':
dependencies:
'@jridgewell/set-array': 1.2.1

View file

@ -18,9 +18,8 @@
import "./iconStyles.css";
import { getTheme, Theme } from "@utils/discord";
import { getIntlMessage, getTheme, Theme } from "@utils/discord";
import { classes } from "@utils/misc";
import { i18n } from "@webpack/common";
import type { PropsWithChildren } from "react";
interface BaseIconProps extends IconProps {
@ -133,7 +132,7 @@ export function InfoIcon(props: IconProps) {
export function OwnerCrownIcon(props: IconProps) {
return (
<Icon
aria-label={i18n.Messages.GUILD_OWNER}
aria-label={getIntlMessage("GUILD_OWNER")}
{...props}
className={classes(props.className, "vc-owner-crown-icon")}
role="img"

View file

@ -15,7 +15,7 @@ interface ColorPickerProps {
showEyeDropper?: boolean;
onChange(value: number | null): void;
}
const ColorPicker = findComponentByCodeLazy<ColorPickerProps>(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR", ".BACKGROUND_PRIMARY)");
const ColorPicker = findComponentByCodeLazy<ColorPickerProps>("#{intl::USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR}", ".BACKGROUND_PRIMARY)");
// TinyColor is completely unmangled and it's duplicated in two modules! Fun!
const TinyColor: tinycolor.Constructor = findByCodeLazy("this._gradientType=");

View file

@ -31,9 +31,7 @@ export async function loadLazyChunks() {
const lazyChunks = factoryCode.matchAll(LazyChunkRegex);
const validChunkGroups = new Set<[chunkIds: number[], entryPoint: number]>();
// Workaround for a chunk that depends on the ChannelMessage component but may be be force loaded before
// the chunk containing the component
const shouldForceDefer = factoryCode.includes(".Messages.GUILD_FEED_UNFEATURE_BUTTON_TEXT");
const shouldForceDefer = false;
await Promise.all(Array.from(lazyChunks).map(async ([, rawChunkIds, entryPoint]) => {
const chunkIds = rawChunkIds ? Array.from(rawChunkIds.matchAll(Webpack.ChunkIdsRegex)).map(m => Number(m[1])) : [];

View file

@ -74,10 +74,10 @@ export default definePlugin({
},
{
// Settings, sidebar
find: "Messages.BILLING_SETTINGS",
find: "#{intl::BILLING_SETTINGS}",
replacement: [
{
match: /(?<=Messages.BILLING_SETTINGS,)/,
match: /(?<=#{intl::BILLING_SETTINGS}\),)/,
replace: "capitalism:true,"
},
{
@ -99,7 +99,7 @@ export default definePlugin({
},
{
// Emoji list
find: "Messages.EMOJI_PICKER_CREATE_EMOJI_TITLE,size:",
find: "#{intl::EMOJI_PICKER_CREATE_EMOJI_TITLE}),size:",
replacement: {
match: /(\i)=\i\|\|!\i&&\i.\i.isEmojiCategoryNitroLocked\(\{[^}]*\}\);/,
replace: "$&$1||"
@ -108,7 +108,7 @@ export default definePlugin({
},
{
// Emoji category list
find: "Messages.EMOJI_CATEGORY_TOP_GUILD_EMOJI.format({",
find: "#{intl::EMOJI_CATEGORY_TOP_GUILD_EMOJI}",
replacement: {
match: /(?<=(\i)\.unshift\((\i)\):)(?=\1\.push\(\2\))/,
replace: "$2.isNitroLocked||"

View file

@ -39,7 +39,7 @@ export default definePlugin({
settings,
patches: [
{
find: ".Messages.GUILD_OWNER,",
find: "#{intl::GUILD_OWNER}),",
replacement:
{
// We add the banner as a property while we can still access the user id

View file

@ -8,8 +8,9 @@ import "./style.css";
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import { getIntlMessage } from "@utils/discord";
import definePlugin, { OptionType } from "@utils/types";
import { Button, Forms, i18n, TextInput } from "@webpack/common";
import { Button, Forms, TextInput } from "@webpack/common";
function ReasonsComponent() {
const { reasons } = settings.use(["reasons"]);
@ -72,9 +73,9 @@ export default definePlugin({
authors: [Devs.Inbestigator],
patches: [
{
find: "Messages.BAN_MULTIPLE_CONFIRM_TITLE",
find: "#{intl::BAN_MULTIPLE_CONFIRM_TITLE}",
replacement: [{
match: /\[\{name:\i\.\i\.Messages\.BAN_REASON_OPTION_SPAM_ACCOUNT.+?\}\]/,
match: /\[\{name:\i\.\i\.string\(\i\.\i#{intl::BAN_REASON_OPTION_SPAM_ACCOUNT}\).+?\}\]/,
replace: "$self.getReasons()"
},
{
@ -87,9 +88,9 @@ export default definePlugin({
const reasons = settings.store.reasons.length
? settings.store.reasons
: [
i18n.Messages.BAN_REASON_OPTION_SPAM_ACCOUNT,
i18n.Messages.BAN_REASON_OPTION_HACKED_ACCOUNT,
i18n.Messages.BAN_REASON_OPTION_BREAKING_RULES
getIntlMessage("BAN_REASON_OPTION_SPAM_ACCOUNT"),
getIntlMessage("BAN_REASON_OPTION_HACKED_ACCOUNT"),
getIntlMessage("BAN_REASON_OPTION_BREAKING_RULES")
];
return reasons.map(s => ({ name: s, value: s }));
},

View file

@ -37,10 +37,10 @@ export default definePlugin({
authors: [EquicordDevs.iamme],
patches: [
{
find: ".Messages.HUB_INVITE_ANOTHER_SCHOOL_LINK",
find: "#{intl::HUB_INVITE_ANOTHER_SCHOOL_LINK}",
replacement: [
{
match: /,(\i)&&(\(.{0,15}\i\.TooltipContainer.+)(\i\.\i\.Messages.GUEST_MEMBERSHIP_EXPLANATION)/,
match: /,(\i)&&(\(.{0,15}\i\.TooltipContainer.+)(\i\.\i\.string\(\i\.\i#{intl::GUEST_MEMBERSHIP_EXPLANATION}\))/,
replace: ",($1||((!$1)&&arguments[0].invite.expires_at)) && $2$self.RenderTip($1, $3, arguments[0].invite.expires_at)"
},
{

View file

@ -59,7 +59,7 @@ export default definePlugin({
}
},
{
find: ".ADD_REACTION_NAMED.format",
find: "#{intl::ADD_REACTION_NAMED}",
group: true,
replacement: [
// Override limit of emojis to display with offset hook.

View file

@ -15,7 +15,7 @@ export default definePlugin({
description: "Reworks the user area styling to fit more buttons and overall look nicer",
authors: [Devs.Samwich],
patches: [{
find: ".Messages.ACCOUNT_SPEAKING_WHILE_MUTED",
find: "#{intl::ACCOUNT_SPEAKING_WHILE_MUTED}",
replacement:
[
// add a custom class to make things easier

View file

@ -5,10 +5,11 @@
*/
import { classNameFactory } from "@api/Styles";
import { getIntlMessage } from "@utils/discord";
import { classes } from "@utils/misc";
import { closeModal, openModal } from "@utils/modal";
import { findByPropsLazy } from "@webpack";
import { Avatar, ChannelStore, ContextMenuApi, FluxDispatcher, GuildStore, i18n, Menu, ReadStateStore, ReadStateUtils, Text, Tooltip, useDrag, useDrop, useEffect, useRef, UserStore } from "@webpack/common";
import { Avatar, ChannelStore, ContextMenuApi, FluxDispatcher, GuildStore, Menu, ReadStateStore, ReadStateUtils, Text, Tooltip, useDrag, useDrop, useEffect, useRef, UserStore } from "@webpack/common";
import { BasicChannelTabsProps, Bookmark, BookmarkFolder, BookmarkProps, CircleQuestionIcon, isBookmarkFolder, settings, switchChannel, useBookmarks } from "../util";
import { NotificationDot } from "./ChannelTab";
@ -108,7 +109,7 @@ function BookmarkFolderOpenMenu(props: BookmarkProps) {
<Menu.MenuItem
key="mark-as-read"
id="mark-as-read"
label={i18n.Messages.MARK_AS_READ}
label={getIntlMessage("MARK_AS_READ")}
disabled={!ReadStateStore.hasUnread(b.channelId)}
action={() => ReadStateUtils.ackChannel(ChannelStore.getChannel(b.channelId))}
/>

View file

@ -5,10 +5,10 @@
*/
import { classNameFactory } from "@api/Styles";
import { getUniqueUsername } from "@utils/discord";
import { getIntlMessage, getUniqueUsername } from "@utils/discord";
import { classes } from "@utils/misc";
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
import { Avatar, ChannelStore, ContextMenuApi, Dots, GuildStore, i18n, PresenceStore, ReadStateStore, Text, TypingStore, useDrag, useDrop, useRef, UserStore, useStateFromStores } from "@webpack/common";
import { Avatar, ChannelStore, ContextMenuApi, Dots, GuildStore, PresenceStore, ReadStateStore, Text, TypingStore, useDrag, useDrop, useRef, UserStore, useStateFromStores } from "@webpack/common";
import { Channel, Guild, User } from "discord-types/general";
import { ChannelTabsProps, CircleQuestionIcon, closeTab, isTabSelected, moveDraggedTabs, moveToTab, openedTabs, settings } from "../util";
@ -113,22 +113,22 @@ function ChannelTabContent(props: ChannelTabsProps & {
</>
);
else {
let name = `${i18n.Messages.UNKNOWN_CHANNEL} (${channelId})`;
let name = `${getIntlMessage("UNKNOWN_CHANNEL")} (${channelId})`;
switch (channelId) {
case "customize-community":
name = i18n.Messages.CHANNELS_AND_ROLES;
name = getIntlMessage("CHANNELS_AND_ROLES");
break;
case "channel-browser":
name = i18n.Messages.GUILD_SIDEBAR_CHANNEL_BROWSER;
name = getIntlMessage("GUILD_SIDEBAR_CHANNEL_BROWSER");
break;
case "shop":
name = i18n.Messages.GUILD_SHOP_CHANNEL_LABEL;
name = getIntlMessage("GUILD_SHOP_CHANNEL_LABEL");
break;
case "member-safety":
name = i18n.Messages.MEMBER_SAFETY_CHANNEL_TITLE;
name = getIntlMessage("MEMBER_SAFETY_CHANNEL_TITLE");
break;
case "@home":
name = i18n.Messages.SERVER_GUIDE;
name = getIntlMessage("SERVER_GUIDE");
break;
}
return (
@ -168,7 +168,7 @@ function ChannelTabContent(props: ChannelTabsProps & {
return (
<>
<ChannelIcon channel={channel} />
{!compact && <Text className={cl("name-text")}>{channel?.name || i18n.Messages.GROUP_DM}</Text>}
{!compact && <Text className={cl("name-text")}>{channel?.name || getIntlMessage("GROUP_DM")}</Text>}
<NotificationDot channelIds={[channel.id]} />
<TypingIndicator isTyping={isTyping} />
</>
@ -180,14 +180,14 @@ function ChannelTabContent(props: ChannelTabsProps & {
return (
<>
<FriendsIcon />
{!compact && <Text className={cl("name-text")}>{i18n.Messages.FRIENDS}</Text>}
{!compact && <Text className={cl("name-text")}>{getIntlMessage("FRIENDS")}</Text>}
</>
);
return (
<>
<CircleQuestionIcon />
{!compact && <Text className={cl("name-text")}>{i18n.Messages.UNKNOWN_CHANNEL}</Text>}
{!compact && <Text className={cl("name-text")}>{getIntlMessage("UNKNOWN_CHANNEL")}</Text>}
</>
);
}

View file

@ -4,9 +4,10 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { getIntlMessage } from "@utils/discord";
import { Margins } from "@utils/margins";
import { closeModal, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, openModal } from "@utils/modal";
import { Button, ChannelStore, FluxDispatcher, Forms, i18n, Menu, ReadStateStore, ReadStateUtils, Select, Text, TextInput, useState } from "@webpack/common";
import { Button, ChannelStore, FluxDispatcher, Forms, Menu, ReadStateStore, ReadStateUtils, Select, Text, TextInput, useState } from "@webpack/common";
import { bookmarkFolderColors, bookmarkPlaceholderName, closeOtherTabs, closeTab, closeTabsToTheLeft, closeTabsToTheRight, createTab, hasClosedTabs, isBookmarkFolder, openedTabs, reopenClosedTab, settings, toggleCompactTab } from "../util";
import { Bookmark, BookmarkFolder, Bookmarks, ChannelTabsProps, UseBookmarkMethods } from "../util/types";
@ -177,7 +178,7 @@ export function BookmarkContextMenu({ bookmarks, index, methods }: { bookmarks:
{bookmarkNotificationDot && !isFolder &&
<Menu.MenuItem
id="mark-as-read"
label={i18n.Messages.MARK_AS_READ}
label={getIntlMessage("MARK_AS_READ")}
disabled={!ReadStateStore.hasUnread(bookmark.channelId)}
action={() => ReadStateUtils.ackChannel(ChannelStore.getChannel(bookmark.channelId))}
/>
@ -287,7 +288,7 @@ export function TabContextMenu({ tab }: { tab: ChannelTabsProps; }) {
{channel &&
<Menu.MenuItem
id="mark-as-read"
label={i18n.Messages.MARK_AS_READ}
label={getIntlMessage("MARK_AS_READ")}
disabled={!ReadStateStore.hasUnread(channel.id)}
action={() => ReadStateUtils.ackChannel(channel)}
/>

View file

@ -167,7 +167,7 @@ export default definePlugin({
},
// "1 blocked message"
{
find: "Messages.BLOCKED_MESSAGES_HIDE.format",
find: "#{intl::BLOCKED_MESSAGES_HIDE}",
replacement: {
match: /\i.memo\(function\(\i\){/,
replace: "$&return null;"

View file

@ -67,7 +67,7 @@ export default definePlugin({
</>
),
patches: [{
find: "MESSAGE_EDITED_TIMESTAMP_A11Y_LABEL.format",
find: "#{intl::MESSAGE_EDITED_TIMESTAMP_A11Y_LABEL}",
replacement: [
{
match: /(?<=\i=\i\?)\(0,\i\.\i\)\((\i),"LT"\):\(0,\i\.\i\)\(\i\)/,

View file

@ -22,7 +22,7 @@ export default definePlugin({
}
},
{
find: "Messages.FORUM_POST_AUTHOR_A11Y_LABEL",
find: "#{intl::FORUM_POST_AUTHOR_A11Y_LABEL}",
replacement: {
match: /(?<=\}=(\i),\{(user:\i,author:\i)\}=.{0,400}?\(\i\.Fragment,{children:)\i(?=}\),)/,
replace: "$self.wrapForumAuthor({...$1,$2},$&)"

View file

@ -41,7 +41,7 @@ export default definePlugin({
generateSearchResults: generateSearchResults,
patches: [
{
find: ".QUICKSWITCHER_PLACEHOLDER",
find: "#{intl::QUICKSWITCHER_PLACEHOLDER}",
replacement: {
match: /let{selectedIndex:\i,results:\i}/,
replace: "this.props.results = $self.generateSearchResults(this.state.query);$&"

View file

@ -212,7 +212,7 @@ export default definePlugin({
queryFriendTags: queryFriendTags,
patches: [
{
find: ".QUICKSWITCHER_PLACEHOLDER",
find: "#{intl::QUICKSWITCHER_PLACEHOLDER}",
replacement: {
match: /let{selectedIndex:\i,results:\i}/,
replace: "if(this.state.query.includes(\"&\")){ this.props.results = $self.queryFriendTags(this.state.query); }$&"

View file

@ -17,7 +17,7 @@ export default definePlugin({
patches: [
{
find: "UNKNOWN_ROLE_PLACEHOLDER]",
find: "#{intl::UNKNOWN_ROLE_PLACEHOLDER})]",
replacement: {
match: /(hidePersonalInformation.*?)return/,
replace: "$1return $self.patchChatboxMention(arguments[0]);"

View file

@ -88,7 +88,7 @@ function CopyPresetComponent() {
);
}
const ColorPicker = findComponentByCodeLazy(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR", ".BACKGROUND_PRIMARY)");
const ColorPicker = findComponentByCodeLazy("#{intl::USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR}", ".BACKGROUND_PRIMARY)");
export function generateAndApplyProceduralTheme() {

View file

@ -77,7 +77,7 @@ export default definePlugin({
find: '("guildsnav")',
replacement: [
{
match: /(?<=Messages\.SERVERS,children:.{0,300}?)(\i)(\)?\.map\(\i\))/,
match: /(?<=#{intl::SERVERS}\),children:.{0,300}?)(\i)(\)?\.map\(\i\))/,
replace: "$self.useFilteredGuilds($1)$2",
},
// despite my best efforts, the above doesnt trigger a rerender
@ -88,7 +88,7 @@ export default definePlugin({
]
},
{
find: "QUICKSWITCHER_PROTIP.format",
find: "#{intl::QUICKSWITCHER_PROTIP}",
replacement: {
match: /(?<=renderResults\(\){)let{query/,
replace: "this.props.results = $self.filteredGuildResults(this.props.results);$&",

View file

@ -26,7 +26,7 @@ export default definePlugin({
},
patches: [
{
find: ".Messages.DISCODO_DISABLED",
find: "#{intl::DISCODO_DISABLED}",
replacement:
[
{

View file

@ -140,7 +140,7 @@ export default definePlugin({
{
find: "DefaultCustomizationSections",
replacement: {
match: /(?<=USER_SETTINGS_AVATAR_DECORATION},"decoration"\),)/,
match: /(?<=#{intl::USER_SETTINGS_AVATAR_DECORATION}\)},"decoration"\),)/,
replace: "$self.ResetCard(),"
}
},

View file

@ -13,7 +13,7 @@ export default definePlugin({
authors: [Devs.D3SOX],
patches: [
{
find: "Messages.NEW_TERMS_TITLE",
find: "#{intl::NEW_TERMS_TITLE}",
replacement: {
match: /function (\i)\((\i)\)\{let\{transitionState:(\i)\}=(\i)/g,
replace: "function $1($2){return $self.closeModal($2);let{transitionState:$3}=$4"

View file

@ -33,7 +33,7 @@ const recentMentionsPopoutClass = findByPropsLazy("recentMentionsPopout");
const tabClass = findByPropsLazy("inboxTitle", "tab");
const buttonClass = findByPropsLazy("size36");
const MenuHeader = findByCodeLazy(".getUnseenInviteCount())");
const Popout = findByCodeLazy(".Messages.UNBLOCK_TO_JUMP_TITLE", "canCloseAllMessages:");
const Popout = findByCodeLazy("#{intl::UNBLOCK_TO_JUMP_TITLE}", "canCloseAllMessages:");
const createMessageRecord = findByCodeLazy(".createFromServer(", ".isBlockedForMessage", "messageReference:");
const KEYWORD_ENTRIES_KEY = "KeywordNotify_keywordEntries";
const KEYWORD_LOG_KEY = "KeywordNotify_log";
@ -313,14 +313,14 @@ export default definePlugin({
settings,
patches: [
{
find: "Messages.UNREADS_TAB_LABEL}",
find: "#{intl::UNREADS_TAB_LABEL}",
replacement: {
match: /\i\?\(0,\i\.jsxs\)\(\i\.TabBar\.Item/,
replace: "$self.keywordTabBar(),$&"
}
},
{
find: "location:\"RecentsPopout\"})",
find: "location:\"RecentsPopout\"});",
replacement: {
match: /:(\i)===\i\.\i\.MENTIONS\?\(0,.+?setTab:(\i),onJump:(\i),badgeState:\i,closePopout:(\i)/,
replace: ": $1 === 8 ? $self.tryKeywordMenu($2, $3, $4) $&"

View file

@ -6,8 +6,9 @@
import { definePluginSettings } from "@api/Settings";
import { EquicordDevs } from "@utils/constants";
import { getIntlMessage } from "@utils/discord";
import definePlugin, { OptionType } from "@utils/types";
import { Button, Forms, i18n, Menu } from "@webpack/common";
import { Button, Forms, Menu } from "@webpack/common";
import { ReactElement } from "react";
import { preload, unload } from "./images";
@ -33,7 +34,7 @@ export default definePlugin({
return (
<Button size={Button.Sizes.SMALL} onClick={openQrModal}>
{i18n.Messages.USER_SETTINGS_SCAN_QR_CODE}
{getIntlMessage("USER_SETTINGS_SCAN_QR_CODE")}
</Button>
);
},
@ -58,13 +59,13 @@ export default definePlugin({
replacement: {
// Find the Edit User Profile button and insert our custom button.
// A bit jank, but whatever
match: /,(.{11}\.Button,.{58}\.USER_SETTINGS_EDIT_USER_PROFILE}\))/,
match: /,(.{0,20}\.Button,.{0,100}#{intl::USER_SETTINGS_EDIT_USER_PROFILE}\)}\))/,
replace: ",$self.insertScanQrButton($1)",
},
},
// Insert a Scan QR Code MenuItem in the Swith Accounts popout
{
find: ".SWITCH_ACCOUNTS_MANAGE_ACCOUNTS,",
find: 'id:"manage-accounts"',
replacement: {
match: /(id:"manage-accounts",.*?)}\)\)(,\i)/,
replace: "$1}),$self.ScanQrMenuItem)$2"
@ -94,21 +95,21 @@ export default definePlugin({
insertScanQrButton: (button: ReactElement) => (
<div className={cl("settings-btns")}>
<Button size={Button.Sizes.SMALL} onClick={openQrModal}>
{i18n.Messages.USER_SETTINGS_SCAN_QR_CODE}
{getIntlMessage("USER_SETTINGS_SCAN_QR_CODE")}
</Button>
{button}
</div>
),
get ScanQrMenuItem() {
return <Menu.MenuItem id="scan-qr" label={i18n.Messages.USER_SETTINGS_SCAN_QR_CODE} action={openQrModal} />;
return <Menu.MenuItem id="scan-qr" label={getIntlMessage("USER_SETTINGS_SCAN_QR_CODE")} action={openQrModal} />;
},
get ScanQrSettingsSheet() {
return {
section: i18n.Messages.USER_SETTINGS_SCAN_QR_CODE,
section: getIntlMessage("USER_SETTINGS_SCAN_QR_CODE"),
onClick: openQrModal,
searchableTitles: [i18n.Messages.USER_SETTINGS_SCAN_QR_CODE],
label: i18n.Messages.USER_SETTINGS_SCAN_QR_CODE,
ariaLabel: i18n.Messages.USER_SETTINGS_SCAN_QR_CODE
searchableTitles: [getIntlMessage("USER_SETTINGS_SCAN_QR_CODE")],
label: getIntlMessage("USER_SETTINGS_SCAN_QR_CODE"),
ariaLabel: getIntlMessage("USER_SETTINGS_SCAN_QR_CODE")
};
},

View file

@ -4,6 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { getIntlMessage } from "@utils/discord";
import {
ModalContent,
ModalHeader,
@ -15,7 +16,6 @@ import {
import { findByPropsLazy } from "@webpack";
import {
Button,
i18n,
RestAPI,
Text,
useEffect,
@ -372,7 +372,7 @@ function QrModal(props: ModalProps) {
tag="h1"
style={{ flexGrow: 1 }}
>
{i18n.Messages.USER_SETTINGS_SCAN_QR_CODE}
{getIntlMessage("USER_SETTINGS_SCAN_QR_CODE")}
</Text>
</ModalHeader>
<ModalContent scrollbarType="none">

View file

@ -4,6 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { getIntlMessage } from "@utils/discord";
import {
ModalContent,
ModalFooter,
@ -15,7 +16,6 @@ import {
import { findByPropsLazy } from "@webpack";
import {
Button,
i18n,
RestAPI,
Text,
useEffect,
@ -131,14 +131,14 @@ function VerifyModal({
tag="h1"
className={cl("device-header")}
>
{i18n.Messages.QR_CODE_LOGIN_SUCCESS}
{getIntlMessage("QR_CODE_LOGIN_SUCCESS")}
</Text>
<Text
variant="text-md/semibold"
color="text-normal"
style={{ width: "30rem" }}
>
{i18n.Messages.QR_CODE_LOGIN_SUCCESS_FLAVOR}
{getIntlMessage("QR_CODE_LOGIN_SUCCESS_FLAVOR")}
</Text>
</>
) : state === VerifyState.NotFound ? (
@ -155,14 +155,14 @@ function VerifyModal({
tag="h1"
className={cl("device-header")}
>
{i18n.Messages.QR_CODE_NOT_FOUND}
{getIntlMessage("QR_CODE_NOT_FOUND")}
</Text>
<Text
variant="text-md/semibold"
color="text-normal"
style={{ width: "30rem" }}
>
{i18n.Messages.QR_CODE_NOT_FOUND_DESCRIPTION}
{getIntlMessage("QR_CODE_NOT_FOUND_DESCRIPTION")}
</Text>
</>
) : (
@ -179,7 +179,7 @@ function VerifyModal({
tag="h1"
className={cl("device-header")}
>
{i18n.Messages.QR_CODE_LOGIN_CONFIRM}
{getIntlMessage("QR_CODE_LOGIN_CONFIRM")}
</Text>
<Text variant="text-md/semibold" color="text-danger">
Never scan a login QR code from another user or application.
@ -205,7 +205,7 @@ function VerifyModal({
<ModalFooter className={cl("device-footer")}>
{state === VerifyState.LoggedIn ? (
<Button onClick={props.onClose}>
{i18n.Messages.QR_CODE_LOGIN_FINISH_BUTTON}
{getIntlMessage("QR_CODE_LOGIN_FINISH_BUTTON")}
</Button>
) : (
<Button
@ -214,8 +214,8 @@ function VerifyModal({
onClick={props.onClose}
>
{state === VerifyState.NotFound
? i18n.Messages.CLOSE
: i18n.Messages.CANCEL}
? getIntlMessage("CLOSE")
: getIntlMessage("CANCEL")}
</Button>
)}
</ModalFooter>

View file

@ -101,7 +101,7 @@ export default definePlugin({
predicate: () => settings.store.onLink,
},
{
find: "Messages.REPLY_QUOTE_MESSAGE_NOT_LOADED",
find: "#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED}",
replacement: {
// Should match two places
match: /(\i\.Clickable),\{/g,
@ -110,7 +110,7 @@ export default definePlugin({
predicate: () => settings.store.onReply,
},
{
find: "Messages.MESSAGE_FORWARDED}",
find: "#{intl::MESSAGE_FORWARDED}",
replacement: {
match: /(\i\.Clickable),\{/,
replace: "$self.ForwardTooltip,{Component:$1,vcProps:arguments[0],"

View file

@ -32,7 +32,7 @@ export default definePlugin({
patches: [
{
find: "STICKER_BUTTON_LABEL,",
find: "#{intl::STICKER_BUTTON_LABEL}",
replacement: [{
match: /(children:\(0,\w\.jsx\)\()([\w.]+?)(,{innerClassName.{10,30}\.stickerButton)/,
replace: (_, head, button, tail) => {
@ -64,11 +64,11 @@ export default definePlugin({
}
},
{
find: ".Messages.EXPRESSION_PICKER_GIF",
find: "#{intl::EXPRESSION_PICKER_GIF}",
replacement: {
match: /role:"tablist",.+?\.Messages\.EXPRESSION_PICKER_CATEGORIES_A11Y_LABEL,children:(\[.*?\)\]}\)}\):null,)(.*?closePopout:\w.*?:null)/s,
match: /role:"tablist",.+?#{intl::EXPRESSION_PICKER_CATEGORIES_A11Y_LABEL}\),children:(\[.*?\)\]}\)}\):null,)(.*?closePopout:\w.*?:null)/s,
replace: m => {
const stickerTabRegex = /(\w+?)\?(\([^()]+?\))\((.{1,2}),{.{0,128},isActive:(.{1,2})===.{1,150},children:(.{1,10}Messages.EXPRESSION_PICKER_STICKER).*?:null/s;
const stickerTabRegex = /(\w+?)\?(\([^()]+?\))\((.{1,2}),{.{0,128},isActive:(.{1,2})===.{1,150},children:(.{1,10}#{intl::EXPRESSION_PICKER_STICKER}).*?:null/s;
const res = m.replace(stickerTabRegex, (_m, canUseStickers, jsx, tabHeaderComp, currentTab, stickerText) => {
const isActive = `${currentTab}==="stickers+"`;
return (

View file

@ -14,10 +14,10 @@ export default definePlugin({
patches: [
{
find: ",APP_TAG:\"",
find: "#{intl::APP_TAG})",
replacement: {
match: /APP_TAG:".*?"/,
replace: "APP_TAG:\"BOT\""
match: /\i\.\i\.string\(\i\.\i#{intl::APP_TAG}\)/,
replace: '"BOT"'
}
}
],

View file

@ -5,9 +5,10 @@
*/
import { Devs } from "@utils/constants";
import { getIntlMessage } from "@utils/discord";
import definePlugin from "@utils/types";
import { findByCodeLazy, findByPropsLazy } from "@webpack";
import { ChannelStore, GuildStore, i18n, RelationshipStore, UserStore } from "@webpack/common";
import { ChannelStore, GuildStore, RelationshipStore, UserStore } from "@webpack/common";
const { getName } = findByPropsLazy("getName", "useName", "getNickname");
const computeChannelName = findByCodeLazy(".isThread())return'\"'.concat(");
@ -39,7 +40,7 @@ export default definePlugin({
if (message.type === MessageTypes.REPLY && message.referenced_message?.author) {
const replyUser = UserStore.getUser(message.referenced_message.author.id);
const replyUsername = getName(channel.guild_id, channel.id, replyUser);
title = i18n.Messages.CHANNEL_MESSAGE_REPLY_A11Y_LABEL.format({
title = getIntlMessage("CHANNEL_MESSAGE_REPLY_A11Y_LABEL", {
author: username,
repliedAuthor: replyUsername,
});

View file

@ -27,9 +27,9 @@ export default definePlugin({
authors: [EquicordDevs.iamme],
patches: [
{
find: "Messages.MESSAGE_EDITED,",
find: "#{intl::MESSAGE_EDITED}),",
replacement: {
match: /Messages\.MESSAGE_EDITED,(?:[^}]*[}]){3}\)/,
match: /#{intl::MESSAGE_EDITED}\),(?:[^}]*[}]){3}\)/,
replace: "$&,$self.PinnedIcon(arguments[0].message)"
}
}

View file

@ -11,7 +11,7 @@ import definePlugin from "@utils/types";
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
import badges from "plugins/_api/badges";
const roleIconClassName = findByPropsLazy("roleIcon", "separator").roleIcon;
const RoleIconComponent = findComponentByCodeLazy(".Messages.ROLE_ICON_ALT_TEXT");
const RoleIconComponent = findComponentByCodeLazy("#{intl::ROLE_ICON_ALT_TEXT}");
import "./styles.css";
import { User } from "discord-types/general";

View file

@ -34,7 +34,7 @@ const { HeaderBar, HeaderBarIcon } = mapMangledModuleLazy(".themedMobile]:", {
});
const Chat = findComponentByCodeLazy("filterAfterTimestamp:", "chatInputType");
const Resize = findComponentByCodeLazy("sidebarType:", "homeSidebarWidth");
const ChannelHeader = findComponentByCodeLazy(".Messages.HUB_DIRECTORY_CHANNEL_TITLE.format({");
const ChannelHeader = findComponentByCodeLazy("#{intl::HUB_DIRECTORY_CHANNEL_TITLE}");
const ChatInputTypes = findByPropsLazy("FORM", "NORMAL");
const Sidebars = findByPropsLazy("ThreadSidebar", "MessageRequestSidebar");

View file

@ -131,14 +131,14 @@ export default definePlugin({
dependencies: ["UserSettingsAPI"],
patches: [
{
find: "Messages.CUSTOM_STATUS_SET_CUSTOM_STATUS}",
find: "#{intl::CUSTOM_STATUS_SET_CUSTOM_STATUS}",
replacement: {
match: /\.ModalFooter,.{0,70}\.Messages\.SAVE\}\)/,
match: /\.ModalFooter,.{0,70}\i\.\i\.string\(\i\.\i#{intl::SAVE}\)\}\)/,
replace: "$&,$self.renderRememberButton(this.state)"
}
},
{
find: /"aria-label":.{0,3}\.Messages.STATUS_MENU_LABEL/,
find: /"aria-label":.{0,1}\.\i\.string\(\i\.\i#{intl::STATUS_MENU_LABEL}/,
replacement: {
match: /!\i&&(.{0,15}\i\.Fragment.{0,55}null==(\i).{0,200}customEmojiPlaceholder\}\),onClick:([^}]+}))/,
replace: "$self.render($2, $3),false&&$1"

View file

@ -14,7 +14,7 @@ import { Devs } from "@utils/constants";
import { openModal } from "@utils/modal";
import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy } from "@webpack";
import { i18n, Menu, Tooltip, useEffect, useState } from "@webpack/common";
import { Menu, Tooltip, useEffect, useState } from "@webpack/common";
import { Message, User } from "discord-types/general";
import { SetTimezoneModal } from "./TimezoneModal";
@ -27,6 +27,7 @@ export let timezones: Record<string, string | null> = {};
})();
const classes = findByPropsLazy("timestamp", "compact", "contentOnly");
const locale = findByPropsLazy("getLocale");
export const settings = definePluginSettings({
"24h Time": {
@ -50,7 +51,7 @@ export const settings = definePluginSettings({
function getTime(timezone: string, timestamp: string | number, props: Intl.DateTimeFormatOptions = {}) {
const date = new Date(timestamp);
const formatter = new Intl.DateTimeFormat(i18n?.getLocale?.() ?? "en-US", {
const formatter = new Intl.DateTimeFormat(locale.getLocale() ?? "en-US", {
hour12: !settings.store["24h Time"],
timeZone: timezone,
...props

View file

@ -8,10 +8,11 @@ import { NavContextMenuPatchCallback } from "@api/ContextMenu";
import { CodeBlock } from "@components/CodeBlock";
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import { getIntlMessage } from "@utils/discord";
import { Margins } from "@utils/margins";
import { closeModal, ModalCloseButton, ModalContent, ModalHeader, ModalRoot, ModalSize, openModal } from "@utils/modal";
import definePlugin from "@utils/types";
import { Forms, i18n, Menu, Text } from "@webpack/common";
import { Forms, Menu, Text } from "@webpack/common";
import { Message } from "discord-types/general";
type CustomMessage = Message & { editHistory?: any; deleted?: any; firstEditTimestamp?: any; };
@ -64,7 +65,7 @@ function openViewRawModal(obj: any, type: string, isMessage?: boolean) {
function makeContextCallback(name: string, action: (any) => void): NavContextMenuPatchCallback {
return (children, props) => {
if (props.label === i18n.Messages.CHANNEL_ACTIONS_MENU_LABEL) return; // random shit like notification settings
if (props.label === getIntlMessage("CHANNEL_ACTIONS_MENU_LABEL")) return; // random shit like notification settings
const value = props[name];
if (!value) return;

View file

@ -601,7 +601,7 @@ export default definePlugin({
authors: [EquicordDevs.creations],
patches: [
{
find: ".Messages.EMOJI_MATCHING",
find: "#{intl::EMOJI_MATCHING}",
replacement: {
match: /renderResults\((\i)\){/,
replace: "$&$1.results.emojis=$self.filterEmojis($1);if($1.results.emojis.length===0)return;"

View file

@ -9,12 +9,12 @@ import { classNameFactory } from "@api/Styles";
import ErrorBoundary from "@components/ErrorBoundary";
import { Flex } from "@components/Flex";
import { EquicordDevs } from "@utils/constants";
import { openUserProfile } from "@utils/discord";
import { getIntlMessage, openUserProfile } from "@utils/discord";
import { Margins } from "@utils/margins";
import { classes } from "@utils/misc";
import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack";
import { Clickable, Forms, i18n, RelationshipStore, Tooltip, UserStore, useStateFromStores } from "@webpack/common";
import { Clickable, Forms, RelationshipStore, Tooltip, UserStore, useStateFromStores } from "@webpack/common";
import { User } from "discord-types/general";
interface WatchingProps {
@ -46,7 +46,7 @@ function Watching({ userIds, guildId }: WatchingProps): JSX.Element {
<div className={cl("content")}>
{userIds.length ?
(<>
<Forms.FormTitle>{i18n.Messages.SPECTATORS.format({ numViewers: userIds.length })}</Forms.FormTitle>
<Forms.FormTitle>{getIntlMessage("SPECTATORS", { numViewers: userIds.length })}</Forms.FormTitle>
<Flex flexDirection="column" style={{ gap: 6 }} >
{users.map(user => (
<Flex flexDirection="row" style={{ gap: 6, alignContent: "center" }} className={cl("user")} >
@ -54,7 +54,7 @@ function Watching({ userIds, guildId }: WatchingProps): JSX.Element {
{getUsername(user)}
</Flex>
))}
{missingUsers > 0 && <span className={cl("more_users")}>{`+${i18n.Messages.NUM_USERS.format({ num: missingUsers })}`}</span>}
{missingUsers > 0 && <span className={cl("more_users")}>{`+${getIntlMessage("NUM_USERS", { num: missingUsers })}`}</span>}
</Flex>
</>)
: (<span className={cl("no_viewers")}>No spectators</span>)}
@ -121,7 +121,7 @@ export default definePlugin({
{users.length ?
<>
<Forms.FormTitle tag="h3" style={{ marginTop: 8, marginBottom: 0, textTransform: "uppercase" }}>
{i18n.Messages.SPECTATORS.format({ numViewers: userIds.length })}
{getIntlMessage("SPECTATORS", { numViewers: userIds.length })}
</Forms.FormTitle>
<UserSummaryItem
users={users}

View file

@ -18,7 +18,7 @@ export default definePlugin({
authors: [Devs.arHSM],
patches: [
{
find: ".Messages.SUPPRESS_ALL_EMBEDS",
find: "#{intl::SUPPRESS_ALL_EMBEDS}",
replacement: {
match: /case (\i\.\i\.VIDEO):(case \i\.\i\.\i:)*break;default:(\i)=(?:(this\.renderDescription)\(\))\}/,
replace: "$2 break; case $1: $3 = $self.ToggleableDescriptionWrapper({ embed: this.props.embed, original: $4.bind(this) }); break; default: $3 = $4() }"

View file

@ -31,7 +31,7 @@ export default definePlugin({
match: /let\{[^}]*lostPermissionTooltipText:\i[^}]*\}=(\i),/,
replace: "$&vencordProps=$1,"
}, {
match: /\.Messages\.GUILD_OWNER(?=.+?decorators:(\i)\(\)).+?\1=?\(\)=>.+?children:\[/,
match: /#{intl::GUILD_OWNER}(?=.+?decorators:(\i)\(\)).+?\1=?\(\)=>.+?children:\[/,
replace: "$&...(typeof vencordProps=='undefined'?[]:Vencord.Api.MemberListDecorators.__getDecorators(vencordProps)),"
}
]

View file

@ -25,7 +25,7 @@ export default definePlugin({
authors: [Devs.Cyn],
patches: [
{
find: ".Messages.REMOVE_ATTACHMENT_BODY",
find: "#{intl::REMOVE_ATTACHMENT_BODY}",
replacement: {
match: /(?<=.container\)?,children:)(\[.+?\])/,
replace: "Vencord.Api.MessageAccessories._modifyAccessories($1,this.props)",

View file

@ -27,7 +27,7 @@ export default definePlugin({
{
find: '"Message Username"',
replacement: {
match: /\.Messages\.GUILD_COMMUNICATION_DISABLED_BOTTOM_SHEET_TITLE.+?}\),\i(?=\])/,
match: /#{intl::GUILD_COMMUNICATION_DISABLED_BOTTOM_SHEET_TITLE}.+?}\),\i(?=\])/,
replace: "$&,...Vencord.Api.MessageDecorations.__addDecorationsToMessage(arguments[0])"
}
}

View file

@ -25,7 +25,7 @@ export default definePlugin({
authors: [Devs.Arjix, Devs.hunt, Devs.Ven],
patches: [
{
find: ".Messages.EDIT_TEXTAREA_HELP",
find: "#{intl::EDIT_TEXTAREA_HELP}",
replacement: {
match: /(shouldRefocus:!1.+?value:\i,channel:\i}\)\.then\()(.+?)(?=return \i\.content!==this\.props\.message\.content&&\i\((.+?)\))/,
replace: (_, rest1, rest2, args) => "" +

View file

@ -24,9 +24,9 @@ export default definePlugin({
description: "API to add buttons to message popovers.",
authors: [Devs.KingFish, Devs.Ven, Devs.Nuckyz],
patches: [{
find: "Messages.MESSAGE_UTILITIES_A11Y_LABEL",
find: "#{intl::MESSAGE_UTILITIES_A11Y_LABEL}",
replacement: {
match: /\.jsx\)\((\i\.\i),\{label:\i\.\i\.Messages\.MESSAGE_ACTION_REPLY.{0,200}?"reply-self".{0,50}?\}\):null(?=,.+?message:(\i))/,
match: /\.jsx\)\((\i\.\i),\{label:\i\.\i\.string\(\i\.\i#{intl::MESSAGE_ACTION_REPLY}.{0,200}?"reply-self".{0,50}?\}\):null(?=,.+?message:(\i))/,
replace: "$&,Vencord.Api.MessagePopover._buildPopoverElements($1,$2)"
}
}],

View file

@ -25,17 +25,17 @@ export default definePlugin({
description: "Api required for plugins that modify the server list",
patches: [
{
find: "Messages.DISCODO_DISABLED",
find: "#{intl::DISCODO_DISABLED}",
replacement: {
match: /(?<=Messages\.DISCODO_DISABLED.+?return)(\(.{0,75}?tutorialContainer.+?}\))(?=}function)/,
match: /(?<=#{intl::DISCODO_DISABLED}.+?return)(\(.{0,75}?tutorialContainer.+?}\))(?=}function)/,
replace: "[$1].concat(Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.Above))"
}
},
{
find: "Messages.SERVERS,children",
find: "#{intl::SERVERS}),children",
replacement: [
{
match: /(?<=Messages\.SERVERS,children:)\i\.map\(\i\)/,
match: /(?<=#{intl::SERVERS}\),children:)\i\.map\(\i\)/,
replace: "Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.In).concat($&)"
},
{

View file

@ -24,8 +24,9 @@ import PluginsTab from "@components/VencordSettings/PluginsTab";
import UpdaterTab from "@components/VencordSettings/UpdaterTab";
import VencordTab from "@components/VencordSettings/VencordTab";
import { Devs } from "@utils/constants";
import { getIntlMessage } from "@utils/discord";
import definePlugin, { OptionType } from "@utils/types";
import { i18n, React } from "@webpack/common";
import { React } from "@webpack/common";
import gitHash from "~git-hash";
@ -69,7 +70,7 @@ export default definePlugin({
]
},
{
find: "Messages.USER_SETTINGS_ACTIONS_MENU_LABEL",
find: "#{intl::USER_SETTINGS_ACTIONS_MENU_LABEL}",
replacement: {
match: /(?<=function\((\i),\i\)\{)(?=let \i=Object.values\(\i.\i\).*?(\i\.\i)\.open\()/,
replace: "$2.open($1);return;"
@ -162,11 +163,12 @@ export default definePlugin({
try {
const names = {
top: i18n.Messages.USER_SETTINGS,
aboveNitro: i18n.Messages.BILLING_SETTINGS,
belowNitro: i18n.Messages.APP_SETTINGS,
aboveActivity: i18n.Messages.ACTIVITY_SETTINGS
top: getIntlMessage("USER_SETTINGS"),
aboveNitro: getIntlMessage("BILLING_SETTINGS"),
belowNitro: getIntlMessage("APP_SETTINGS"),
aboveActivity: getIntlMessage("ACTIVITY_SETTINGS")
};
return header === names[settingsLocation];
} catch {
return firstChild === "PREMIUM";

View file

@ -147,9 +147,9 @@ export default definePlugin({
settings,
patches: [{
find: ".BEGINNING_DM.format",
find: "#{intl::BEGINNING_DM}",
replacement: {
match: /BEGINNING_DM\.format\(\{.+?\}\),(?=.{0,300}(\i)\.isMultiUserDM)/,
match: /#{intl::BEGINNING_DM},{.+?}\),(?=.{0,300}(\i)\.isMultiUserDM)/,
replace: "$& $self.renderContributorDmWarningCard({ channel: $1 }),"
}
}],

View file

@ -69,7 +69,7 @@ export default definePlugin({
patches: [
{
find: ".Messages.ACCOUNT_SPEAKING_WHILE_MUTED",
find: "#{intl::ACCOUNT_SPEAKING_WHILE_MUTED}",
group: true,
replacement: [
{

View file

@ -41,7 +41,7 @@ export default definePlugin({
},
{
// Status emojis
find: ".Messages.GUILD_OWNER,",
find: "#{intl::GUILD_OWNER}",
replacement: {
match: /(?<=\.activityEmoji,.+?animate:)\i/,
replace: "!0"

View file

@ -88,9 +88,9 @@ export default definePlugin({
}
},
{
find: ".Messages.ATTACHMENT_UTILITIES_SPOILER",
find: "#{intl::ATTACHMENT_UTILITIES_SPOILER}",
replacement: {
match: /(?<=children:\[)(?=.{10,80}tooltip:.{0,100}\i\.\i\.Messages\.ATTACHMENT_UTILITIES_SPOILER)/,
match: /(?<=children:\[)(?=.{10,80}tooltip:.{0,100}#{intl::ATTACHMENT_UTILITIES_SPOILER})/,
replace: "arguments[0].canEdit!==false?$self.renderIcon(arguments[0]):null,"
},
},

View file

@ -36,7 +36,7 @@ export default definePlugin({
settings,
patches: [
{
find: "BAN_CONFIRM_TITLE.",
find: "#{intl::BAN_CONFIRM_TITLE}",
replacement: {
match: /src:\i\("?\d+"?\)/g,
replace: "src:$self.source"

View file

@ -18,9 +18,10 @@
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import { getIntlMessage } from "@utils/discord";
import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy, findLazy, findStoreLazy } from "@webpack";
import { FluxDispatcher, i18n, useMemo } from "@webpack/common";
import { FluxDispatcher, useMemo } from "@webpack/common";
import FolderSideBar from "./FolderSideBar";
@ -172,7 +173,7 @@ export default definePlugin({
// Disable expanding and collapsing folders transition in the normal GuildsBar sidebar
{
predicate: () => !settings.store.keepIcons,
match: /(?<=\.Messages\.SERVER_FOLDER_PLACEHOLDER.+?useTransition\)\()/,
match: /(?<=#{intl::SERVER_FOLDER_PLACEHOLDER}.+?useTransition\)\()/,
replace: "$self.shouldShowTransition(arguments[0])&&"
},
// If we are rendering the normal GuildsBar sidebar, we avoid rendering guilds from folders that are expanded
@ -205,7 +206,7 @@ export default definePlugin({
}
},
{
find: ".Messages.DISCODO_DISABLED",
find: "#{intl::DISCODO_DISABLED}",
predicate: () => settings.store.closeAllHomeButton,
replacement: {
// Close all folders when clicking the home button
@ -274,12 +275,16 @@ export default definePlugin({
},
makeGuildsBarGuildListFilter(isBetterFolders: boolean) {
return child => {
if (isBetterFolders) {
return child?.props?.["aria-label"] === i18n.Messages.SERVERS;
}
try {
return child => {
if (isBetterFolders) {
return child?.props?.["aria-label"] === getIntlMessage("SERVERS");
}
return true;
};
} catch {
return true;
};
}
},
makeGuildsBarTreeFilter(isBetterFolders: boolean) {

View file

@ -34,9 +34,9 @@ export default definePlugin({
},
},
{
find: ".Messages.GIF,",
find: "#{intl::GIF}",
replacement: {
match: /alt:(\i)=(\i\.\i\.Messages\.GIF)(?=,[^}]*\}=(\i))/,
match: /alt:(\i)=(\i\.\i\.string\(\i\.\i#{intl::GIF}\))(?=,[^}]*\}=(\i))/,
replace:
// rename prop so we can always use default value
"alt_$$:$1=$self.altify($3)||$2",

View file

@ -63,9 +63,9 @@ export default definePlugin({
}
},
{
find: "Messages.NOTE_PLACEHOLDER",
find: "#{intl::NOTE_PLACEHOLDER}",
replacement: {
match: /\.NOTE_PLACEHOLDER,/,
match: /#{intl::NOTE_PLACEHOLDER}\),/,
replace: "$&spellCheck:!$self.noSpellCheck,"
}
}

View file

@ -47,7 +47,7 @@ export default definePlugin({
},
{
find: ".ADD_ROLE_A11Y_LABEL",
find: "#{intl::ADD_ROLE_A11Y_LABEL}",
all: true,
predicate: () => Settings.plugins.BetterRoleDot.copyRoleColorInProfilePopout && !Settings.plugins.BetterRoleDot.bothStyles,
noWarn: true,

View file

@ -60,7 +60,7 @@ export default definePlugin({
patches: [
{
find: "Messages.AUTH_SESSIONS_SESSION_LOG_OUT",
find: "#{intl::AUTH_SESSIONS_SESSION_LOG_OUT}",
replacement: [
// Replace children with a single label with state
{

View file

@ -5,8 +5,9 @@
*/
import { openPluginModal } from "@components/PluginSettings/PluginModal";
import { getIntlMessage } from "@utils/discord";
import { isObjectEmpty } from "@utils/misc";
import { Alerts, i18n, Menu, useMemo, useState } from "@webpack/common";
import { Alerts, Menu, useMemo, useState } from "@webpack/common";
import Plugins from "~plugins";
@ -48,7 +49,7 @@ export default function PluginsSubmenu() {
query={query}
onChange={setQuery}
ref={ref}
placeholder={i18n.Messages.SEARCH}
placeholder={getIntlMessage("SEARCH")}
/>
)}
/>

View file

@ -7,10 +7,11 @@
import { definePluginSettings } from "@api/Settings";
import { classNameFactory } from "@api/Styles";
import { Devs } from "@utils/constants";
import { getIntlMessage } from "@utils/discord";
import { Logger } from "@utils/Logger";
import definePlugin, { OptionType } from "@utils/types";
import { waitFor } from "@webpack";
import { ComponentDispatch, FocusLock, i18n, Menu, useEffect, useRef } from "@webpack/common";
import { ComponentDispatch, FocusLock, Menu, useEffect, useRef } from "@webpack/common";
import type { HTMLAttributes, ReactElement } from "react";
import PluginsSubmenu from "./PluginsSubmenu";
@ -113,18 +114,16 @@ export default definePlugin({
],
predicate: () => settings.store.disableFade
},
{
// Load menu TOC eagerly
find: "Messages.USER_SETTINGS_WITH_BUILD_OVERRIDE.format",
{ // Load menu TOC eagerly
find: "#{intl::USER_SETTINGS_WITH_BUILD_OVERRIDE}",
replacement: {
match: /(\i)\(this,"handleOpenSettingsContextMenu",.{0,100}?null!=\i&&.{0,100}?(await Promise\.all[^};]*?\)\)).*?,(?=\1\(this)/,
replace: "$&(async ()=>$2)(),"
},
predicate: () => settings.store.eagerLoad
},
{
// Settings cog context menu
find: "Messages.USER_SETTINGS_ACTIONS_MENU_LABEL",
{ // Settings cog context menu
find: "#{intl::USER_SETTINGS_ACTIONS_MENU_LABEL}",
replacement: [
{
match: /(EXPERIMENTS:.+?)(\(0,\i.\i\)\(\))(?=\.filter\(\i=>\{let\{section:\i\}=)/,
@ -164,7 +163,7 @@ export default definePlugin({
if (item.section === "HEADER") {
items.push({ label: item.label, items: [] });
} else if (item.section === "DIVIDER") {
items.push({ label: i18n.Messages.OTHER_OPTIONS, items: [] });
items.push({ label: getIntlMessage("OTHER_OPTIONS"), items: [] });
} else {
items.at(-1)!.items.push(item);
}

View file

@ -14,7 +14,7 @@ import definePlugin, { OptionType, StartAt } from "@utils/types";
import { findByCodeLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack";
import { Button, Forms, ThemeStore, useStateFromStores } from "@webpack/common";
const ColorPicker = findComponentByCodeLazy(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR", ".BACKGROUND_PRIMARY)");
const ColorPicker = findComponentByCodeLazy("#{intl::USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR}", ".BACKGROUND_PRIMARY)");
const colorPresets = [
"#1E1514", "#172019", "#13171B", "#1C1C28", "#402D2D",

View file

@ -18,6 +18,7 @@
import { Devs } from "@utils/constants";
import { getCurrentChannel, getCurrentGuild } from "@utils/discord";
import { runtimeHashMessageKey } from "@utils/intlHash";
import { SYM_LAZY_CACHED, SYM_LAZY_GET } from "@utils/lazy";
import { relaunch } from "@utils/native";
import { canonicalizeMatch, canonicalizeReplace, canonicalizeReplacement } from "@utils/patches";
@ -104,6 +105,7 @@ function makeShortcuts() {
canonicalizeMatch,
canonicalizeReplace,
canonicalizeReplacement,
runtimeHashMessageKey,
fakeRender: (component: ComponentType, props: any) => {
const prevWin = fakeRenderWin?.deref();
const win = prevWin?.closed === false

View file

@ -25,7 +25,7 @@ export default definePlugin({
authors: [Devs.Obsidian, Devs.Nuckyz],
patches: [
{
find: ".Messages.PREVIEW_BYTES_LEFT.format(",
find: "#{intl::PREVIEW_BYTES_LEFT}",
replacement: {
match: /\.footerGap.+?url:\i,fileName:\i,fileSize:\i}\),(?<=fileContents:(\i),bytesLeft:(\i).+?)/g,
replace: "$&$self.addCopyButton({fileContents:$1,bytesLeft:$2}),"

View file

@ -67,7 +67,7 @@ export default definePlugin({
patches: [
{
find: ".Messages.ERRORS_UNEXPECTED_CRASH",
find: "#{intl::ERRORS_UNEXPECTED_CRASH}",
replacement: {
match: /this\.setState\((.+?)\)/,
replace: "$self.handleCrash(this,$1);"

View file

@ -41,7 +41,7 @@ export default definePlugin({
{
find: "DefaultCustomizationSections",
replacement: {
match: /(?<=USER_SETTINGS_AVATAR_DECORATION},"decoration"\),)/,
match: /(?<=#{intl::USER_SETTINGS_AVATAR_DECORATION}\)},"decoration"\),)/,
replace: "$self.DecorSection(),"
}
},

View file

@ -5,7 +5,8 @@
*/
import { PlusIcon } from "@components/Icons";
import { i18n, Text } from "@webpack/common";
import { getIntlMessage } from "@utils/discord";
import { Text } from "@webpack/common";
import { HTMLProps } from "react";
import { DecorationGridItem } from ".";
@ -24,7 +25,7 @@ export default function DecorationGridCreate(props: DecorationGridCreateProps) {
variant="text-xs/normal"
color="header-primary"
>
{i18n.Messages.CREATE}
{getIntlMessage("CREATE")}
</Text>
</DecorationGridItem >;
}

View file

@ -5,7 +5,8 @@
*/
import { NoEntrySignIcon } from "@components/Icons";
import { i18n, Text } from "@webpack/common";
import { getIntlMessage } from "@utils/discord";
import { Text } from "@webpack/common";
import { HTMLProps } from "react";
import { DecorationGridItem } from ".";
@ -24,7 +25,7 @@ export default function DecorationGridNone(props: DecorationGridNoneProps) {
variant="text-xs/normal"
color="header-primary"
>
{i18n.Messages.NONE}
{getIntlMessage("NONE")}
</Text>
</DecorationGridItem >;
}

View file

@ -27,7 +27,7 @@ export default definePlugin({
authors: [Devs.Nuckyz],
patches: [
{
find: ".Messages.BOT_CALL_IDLE_DISCONNECT",
find: "#{intl::BOT_CALL_IDLE_DISCONNECT_2}",
replacement: {
match: /,?(?=\i\(this,"idleTimeout",new \i\.\i\))/,
replace: ";return;"

View file

@ -285,7 +285,7 @@ export default definePlugin({
},
// Remove boost requirements to stream with high quality
{
find: "STREAM_FPS_OPTION.format",
find: "#{intl::STREAM_FPS_OPTION}",
predicate: () => settings.store.enableStreamQualityBypass,
replacement: {
match: /guildPremiumTier:\i\.\i\.TIER_\d,?/g,
@ -356,7 +356,7 @@ export default definePlugin({
]
},
{
find: ".Messages.STICKER_POPOUT_UNJOINED_PRIVATE_GUILD_DESCRIPTION.format",
find: "#{intl::STICKER_POPOUT_UNJOINED_PRIVATE_GUILD_DESCRIPTION}",
predicate: () => settings.store.transformStickers,
replacement: [
{
@ -381,7 +381,7 @@ export default definePlugin({
}
},
{
find: ".Messages.EMOJI_POPOUT_UNJOINED_DISCOVERABLE_GUILD_DESCRIPTION",
find: "#{intl::EMOJI_POPOUT_UNJOINED_DISCOVERABLE_GUILD_DESCRIPTION}",
predicate: () => settings.store.transformEmojis,
replacement: {
// Add the fake nitro emoji notice

View file

@ -108,10 +108,10 @@ interface ProfileModalProps {
isTryItOutFlow: boolean;
}
const ColorPicker = findComponentByCodeLazy<ColorPickerProps>(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR", ".BACKGROUND_PRIMARY)");
const ColorPicker = findComponentByCodeLazy<ColorPickerProps>("#{intl::USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR}", ".BACKGROUND_PRIMARY)");
const ProfileModal = findComponentByCodeLazy<ProfileModalProps>("isTryItOutFlow:", "pendingThemeColors:", "pendingAvatarDecoration:", "EDIT_PROFILE_BANNER");
const requireColorPicker = extractAndLoadChunksLazy(["USER_SETTINGS_PROFILE_COLOR_DEFAULT_BUTTON.format"], /createPromise:\(\)=>\i\.\i(\("?.+?"?\)).then\(\i\.bind\(\i,"?(.+?)"?\)\)/);
const requireColorPicker = extractAndLoadChunksLazy(["#{intl::USER_SETTINGS_PROFILE_COLOR_DEFAULT_BUTTON}"], /createPromise:\(\)=>\i\.\i(\("?.+?"?\)).then\(\i\.bind\(\i,"?(.+?)"?\)\)/);
export default definePlugin({
name: "FakeProfileThemes",
@ -126,9 +126,9 @@ export default definePlugin({
}
},
{
find: ".USER_SETTINGS_RESET_PROFILE_THEME",
find: "#{intl::USER_SETTINGS_RESET_PROFILE_THEME}",
replacement: {
match: /RESET_PROFILE_THEME}\)(?<=color:(\i),.{0,500}?color:(\i),.{0,500}?)/,
match: /#{intl::USER_SETTINGS_RESET_PROFILE_THEME}\)}\)(?<=color:(\i),.{0,500}?color:(\i),.{0,500}?)/,
replace: "$&,$self.addCopy3y3Button({primary:$1,accent:$2})"
}
}

View file

@ -27,7 +27,7 @@ export default definePlugin({
authors: [Devs.D3SOX, Devs.Nickyux],
patches: [
{
find: ".Messages.GUILD_OWNER,",
find: "#{intl::GUILD_OWNER}",
replacement: {
match: /,isOwner:(\i),/,
replace: ",_isOwner:$1=$self.isGuildOwner(e),"

View file

@ -26,7 +26,7 @@ export default definePlugin({
{
find: ".PANEL}),nicknameIcons",
replacement: {
match: /USER_PROFILE_MEMBER_SINCE,.{0,100}userId:(\i\.id)}\)}\)/,
match: /#{intl::USER_PROFILE_MEMBER_SINCE}\),.{0,100}userId:(\i\.id)}\)}\)/,
replace: "$&,$self.FriendsSinceComponent({userId:$1,isSidebar:true})"
}
},
@ -34,7 +34,7 @@ export default definePlugin({
{
find: "action:\"PRESS_APP_CONNECTION\"",
replacement: {
match: /USER_PROFILE_MEMBER_SINCE,.{0,100}userId:(\i\.id),.{0,100}}\)}\),/,
match: /#{intl::USER_PROFILE_MEMBER_SINCE}\),.{0,100}userId:(\i\.id),.{0,100}}\)}\),/,
replace: "$&,$self.FriendsSinceComponent({userId:$1,isSidebar:false}),"
}
}

View file

@ -19,10 +19,11 @@
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
import { migratePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import { getIntlMessage } from "@utils/discord";
import { NoopComponent } from "@utils/react";
import definePlugin from "@utils/types";
import { filters, findByPropsLazy, waitFor } from "@webpack";
import { ChannelStore, ContextMenuApi, i18n, UserStore } from "@webpack/common";
import { ChannelStore, ContextMenuApi, UserStore } from "@webpack/common";
import { Message } from "discord-types/general";
const { useMessageMenu } = findByPropsLazy("useMessageMenu");
@ -41,7 +42,7 @@ function MessageMenu({ message, channel, onHeightUpdate }) {
return useMessageMenu({
navId: "message-actions",
ariaLabel: i18n.Messages.MESSAGE_UTILITIES_A11Y_LABEL,
ariaLabel: getIntlMessage("MESSAGE_UTILITIES_A11Y_LABEL"),
message,
channel,
@ -72,7 +73,7 @@ const contextMenuPatch: NavContextMenuPatchCallback = (children, props: MessageA
const group = findGroupChildrenByChildId("devmode-copy-id", children, true);
group?.push(
CopyIdMenuItem({ id: props.message.author.id, label: i18n.Messages.COPY_ID_AUTHOR })
CopyIdMenuItem({ id: props.message.author.id, label: getIntlMessage("COPY_ID_AUTHOR") })
);
};

View file

@ -92,7 +92,7 @@ export default definePlugin({
patches: [
{
find: ".Messages.ACCOUNT_SPEAKING_WHILE_MUTED",
find: "#{intl::ACCOUNT_SPEAKING_WHILE_MUTED}",
replacement: {
match: /this\.renderNameZone\(\).+?children:\[/,
replace: "$&$self.GameActivityToggleButton(),"

View file

@ -166,7 +166,7 @@ export default definePlugin({
patches: [
{
find: "Messages.WELCOME_CTA_LABEL",
find: "#{intl::WELCOME_CTA_LABEL}",
replacement: {
match: /innerClassName:\i\.welcomeCTAButton,(?<={channel:\i,message:\i}=(\i).{0,400}?)/,
replace: "$&onContextMenu:(vcEvent)=>$self.pickSticker(vcEvent, $1),"

View file

@ -260,9 +260,9 @@ export default definePlugin({
}
},
{
find: ".Messages.SETTINGS_GAMES_TOGGLE_OVERLAY",
find: "#{intl::SETTINGS_GAMES_TOGGLE_OVERLAY}",
replacement: {
match: /\.Messages\.SETTINGS_GAMES_TOGGLE_OVERLAY.+?}\(\),(?<={overlay:\i,.+?=(\i),.+?)(?=!(\i))/,
match: /#{intl::SETTINGS_GAMES_TOGGLE_OVERLAY}.+?}\(\),(?<={overlay:\i,.+?=(\i),.+?)(?=!(\i))/,
replace: (m, props, nowPlaying) => `${m}$self.renderToggleGameActivityButton(${props},${nowPlaying}),`
}
},

View file

@ -32,7 +32,7 @@ export default definePlugin({
patches: [
// Counts header
{
find: ".FRIENDS_ALL_HEADER",
find: "#{intl::FRIENDS_ALL_HEADER}",
replacement: {
match: /toString\(\)\}\);case (\i\.\i)\.BLOCKED/,
replace: 'toString()});case $1.IMPLICIT:return "Implicit — "+arguments[1];case $1.BLOCKED'
@ -48,9 +48,9 @@ export default definePlugin({
},
// Sections header
{
find: ".FRIENDS_SECTION_ONLINE",
find: "#{intl::FRIENDS_SECTION_ONLINE}",
replacement: {
match: /(\(0,\i\.jsx\)\(\i\.TabBar\.Item,\{id:\i\.\i)\.BLOCKED,className:([^\s]+?)\.item,children:\i\.\i\.Messages\.BLOCKED\}\)/,
match: /(\(0,\i\.jsx\)\(\i\.TabBar\.Item,\{id:\i\.\i)\.BLOCKED,className:([^\s]+?)\.item,children:\i\.\i\.string\(\i\.\i#{intl::BLOCKED}\)\}\)/,
replace: "$1.IMPLICIT,className:$2.item,children:\"Implicit\"}),$&"
},
},

View file

@ -108,7 +108,7 @@ export default definePlugin({
patches: [
{
// Indicator
find: ".Messages.MESSAGE_EDITED,",
find: "#{intl::MESSAGE_EDITED}",
replacement: {
match: /let\{className:\i,message:\i[^}]*\}=(\i)/,
replace: "try {$1 && $self.INV_REGEX.test($1.message.content) ? $1.content.push($self.indicator()) : null } catch {};$&"

View file

@ -19,7 +19,7 @@
import * as DataStore from "@api/DataStore";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import { ChannelRouter, SelectedChannelStore, SelectedGuildStore } from "@webpack/common";
import { ChannelRouter, ChannelStore, NavigationRouter, SelectedChannelStore, SelectedGuildStore } from "@webpack/common";
export interface LogoutEvent {
type: "LOGOUT";
@ -45,6 +45,16 @@ export default definePlugin({
description: "Attempt to navigate to the channel you were in before switching accounts or loading Discord.",
authors: [Devs.Nuckyz],
patches: [
{
find: '"Switching accounts"',
replacement: {
match: /goHomeAfterSwitching:\i/,
replace: "goHomeAfterSwitching:!1"
}
}
],
flux: {
LOGOUT(e: LogoutEvent) {
({ isSwitchingAccount } = e);
@ -55,7 +65,11 @@ export default definePlugin({
isSwitchingAccount = false;
if (previousCache?.channelId) {
ChannelRouter.transitionToChannel(previousCache.channelId);
if (ChannelStore.hasChannel(previousCache.channelId)) {
ChannelRouter.transitionToChannel(previousCache.channelId);
} else {
NavigationRouter.transitionToGuild("@me");
}
}
},

View file

@ -62,7 +62,7 @@ export default definePlugin({
patches: [
{
find: ".LOADING_DID_YOU_KNOW",
find: "#{intl::LOADING_DID_YOU_KNOW}",
replacement: [
{
match: /"_loadingText".+?(?=(\i)\[.{0,10}\.random)/,

View file

@ -74,7 +74,7 @@ export default definePlugin({
{
find: ".invitesDisabledTooltip",
replacement: {
match: /\.VIEW_AS_ROLES_MENTIONS_WARNING.{0,100}(?=])/,
match: /#{intl::VIEW_AS_ROLES_MENTIONS_WARNING}.{0,100}(?=])/,
replace: "$&,$self.renderTooltip(arguments[0].guild)"
},
predicate: () => settings.store.toolTip

View file

@ -15,23 +15,13 @@ import { Settings } from "@api/Settings";
import { disableStyle, enableStyle } from "@api/Styles";
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import { getIntlMessage } from "@utils/discord";
import { proxyLazy } from "@utils/lazy";
import { Logger } from "@utils/Logger";
import { classes } from "@utils/misc";
import definePlugin, { OptionType } from "@utils/types";
import { findByCodeLazy, findByPropsLazy } from "@webpack";
import {
ChannelStore,
FluxDispatcher,
i18n,
Menu,
MessageStore,
Parser,
SelectedChannelStore,
Timestamp,
UserStore,
useStateFromStores,
} from "@webpack/common";
import { ChannelStore, FluxDispatcher, Menu, MessageStore, Parser, SelectedChannelStore, Timestamp, UserStore, useStateFromStores } from "@webpack/common";
import { Message } from "discord-types/general";
import overlayStyle from "./deleteStyleOverlay.css?managed";
@ -188,30 +178,23 @@ export default definePlugin({
(oldMsg, newMsg) => oldMsg?.editHistory === newMsg?.editHistory,
);
return (
Settings.plugins.MessageLogger.inlineEdits && (
<>
{message.editHistory?.map(edit => (
<div className="messagelogger-edited">
{parseEditContent(edit.content, message)}
<Timestamp
timestamp={edit.timestamp}
isEdited={true}
isInline={false}
>
<span className={styles.edited}>
{" "}
({i18n.Messages.MESSAGE_EDITED})
</span>
</Timestamp>
</div>
))}
</>
)
return Settings.plugins.MessageLogger.inlineEdits && (
<>
{message.editHistory?.map(edit => (
<div className="messagelogger-edited">
{parseEditContent(edit.content, message)}
<Timestamp
timestamp={edit.timestamp}
isEdited={true}
isInline={false}
>
<span className={styles.edited}>{" "}({getIntlMessage("MESSAGE_EDITED")})</span>
</Timestamp>
</div>
))}
</>
);
},
{ noop: true },
),
}, { noop: true }),
makeEdit(newMessage: any, oldMessage: any): any {
return {
@ -505,7 +488,7 @@ export default definePlugin({
{
// Message content renderer
find: 'Messages.MESSAGE_EDITED,")"',
find: "#{intl::MESSAGE_EDITED}",
replacement: [
{
// Render editHistory in the deepest div for message content
@ -558,7 +541,7 @@ export default definePlugin({
},
{
// Message group rendering
find: "Messages.NEW_MESSAGES_ESTIMATED_WITH_DATE",
find: "#{intl::NEW_MESSAGES_ESTIMATED_WITH_DATE}",
replacement: [
{
match: /(\i).type===\i\.\i\.MESSAGE_GROUP_BLOCKED\|\|/,

View file

@ -19,6 +19,7 @@
import { definePluginSettings } from "@api/Settings";
import { Flex } from "@components/Flex";
import { Devs } from "@utils/constants";
import { getIntlMessage } from "@utils/discord";
import { Margins } from "@utils/margins";
import definePlugin, { OptionType } from "@utils/types";
import { findByCodeLazy, findLazy } from "@webpack";
@ -187,13 +188,13 @@ export default definePlugin({
}
},
{
find: ".DISCORD_SYSTEM_MESSAGE_BOT_TAG_TOOLTIP_OFFICIAL,",
find: "#{intl::DISCORD_SYSTEM_MESSAGE_BOT_TAG_TOOLTIP_OFFICIAL}",
replacement: [
// make the tag show the right text
{
match: /(switch\((\i)\){.+?)case (\i(?:\.\i)?)\.BOT:default:(\i)=.{0,40}(\i\.\i\.Messages)\.APP_TAG/,
replace: (_, origSwitch, variant, tags, displayedText, strings) =>
`${origSwitch}default:{${displayedText} = $self.getTagText(${tags}[${variant}], ${strings})}`
match: /(switch\((\i)\){.+?)case (\i(?:\.\i)?)\.BOT:default:(\i)=(.{0,40}#{intl::APP_TAG}\))/,
replace: (_, origSwitch, variant, tags, displayedText, originalText) =>
`${origSwitch}default:{${displayedText} = $self.getTagText(${tags}[${variant}],${originalText})}`
},
// show OP tags correctly
{
@ -217,7 +218,7 @@ export default definePlugin({
},
// in the member list
{
find: ".Messages.GUILD_OWNER,",
find: "#{intl::GUILD_OWNER}",
replacement: {
match: /(?<type>\i)=\(null==.{0,100}\.BOT;return null!=(?<user>\i)&&\i\.bot/,
replace: "$<type> = $self.getTag({user: $<user>, channel: arguments[0].channel, origType: $<user>.bot ? 0 : null, location: 'not-chat' }); return typeof $<type> === 'number'"
@ -232,7 +233,7 @@ export default definePlugin({
}
},
{
find: ".Messages.USER_PROFILE_PRONOUNS",
find: "#{intl::USER_PROFILE_PRONOUNS}",
replacement: {
match: /(?=,hideBotTag:!0)/,
replace: ",moreTags_channelId:arguments[0].moreTags_channelId"
@ -295,21 +296,25 @@ export default definePlugin({
isOPTag: (tag: number) => tag === Tag.Types.ORIGINAL_POSTER || tags.some(t => tag === Tag.Types[`${t.name}-OP`]),
getTagText(passedTagName: string, strings: Record<string, string>) {
if (!passedTagName) return strings.APP_TAG;
const [tagName, variant] = passedTagName.split("-");
const tag = tags.find(({ name }) => tagName === name);
if (!tag) return strings.APP_TAG;
if (variant === "BOT" && tagName !== "WEBHOOK" && this.settings.store.dontShowForBots) return strings.APP_TAG;
getTagText(passedTagName: string, originalText: string) {
try {
const [tagName, variant] = passedTagName.split("-");
if (!passedTagName) return getIntlMessage("APP_TAG");
const tag = tags.find(({ name }) => tagName === name);
if (!tag) return getIntlMessage("APP_TAG");
if (variant === "BOT" && tagName !== "WEBHOOK" && this.settings.store.dontShowForBots) return getIntlMessage("APP_TAG");
const tagText = settings.store.tagSettings?.[tag.name]?.text || tag.displayName;
switch (variant) {
case "OP":
return `${strings.BOT_TAG_FORUM_ORIGINAL_POSTER}${tagText}`;
case "BOT":
return `${strings.APP_TAG}${tagText}`;
default:
return tagText;
const tagText = settings.store.tagSettings?.[tag.name]?.text || tag.displayName;
switch (variant) {
case "OP":
return `${getIntlMessage("BOT_TAG_FORUM_ORIGINAL_POSTER")}${tagText}`;
case "BOT":
return `${getIntlMessage("APP_TAG")}${tagText}`;
default:
return tagText;
}
} catch {
return originalText;
}
},

View file

@ -38,7 +38,7 @@ export default definePlugin({
authors: [Devs.rushii, Devs.Samu, Devs.F53],
patches: [
{
find: "Messages.BLOCKED_MESSAGES_HIDE",
find: "#{intl::BLOCKED_MESSAGES_HIDE}",
replacement: [
{
match: /let\{[^}]*collapsedReason[^}]*\}/,

View file

@ -25,7 +25,7 @@ export default definePlugin({
authors: [Devs.nekohaxx],
patches: [
{
find: "Messages.ONBOARDING_COVER_WELCOME_SUBTITLE",
find: "#{intl::ONBOARDING_COVER_WELCOME_SUBTITLE}",
replacement: {
match: "3e3",
replace: "0"

View file

@ -28,21 +28,21 @@ export default definePlugin({
{
find: '.id,"Search Results"',
replacement: {
match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}UNBLOCK_TO_JUMP_TITLE)/,
match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/,
replace: "if(false)$1"
}
},
{
find: "renderJumpButton()",
replacement: {
match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}UNBLOCK_TO_JUMP_TITLE)/,
match: /if\(.{1,10}\)(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/,
replace: "if(false)$1"
}
},
{
find: "flash:!0,returnMessageId",
replacement: {
match: /.\?(.{1,10}\.show\({.{1,50}UNBLOCK_TO_JUMP_TITLE)/,
match: /.\?(.{1,10}\.show\({.{1,50}#{intl::UNBLOCK_TO_JUMP_TITLE})/,
replace: "false?$1"
}
}

View file

@ -13,7 +13,7 @@ export default definePlugin({
authors: [Devs.bb010g],
patches: [
{
find: ".Messages.COPY_MESSAGE_LINK,",
find: "#{intl::COPY_MESSAGE_LINK}",
replacement: {
match: /\.concat\(location\.host\)/,
replace: ".concat($self.normalizeHost(location.host))",

View file

@ -18,8 +18,9 @@
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import { getIntlMessage } from "@utils/discord";
import definePlugin from "@utils/types";
import { Constants, GuildStore, i18n, RestAPI } from "@webpack/common";
import { Constants, GuildStore, RestAPI } from "@webpack/common";
function showDisableInvites(guildId: string) {
// @ts-ignore
@ -43,15 +44,15 @@ export default definePlugin({
patches: [
{
find: "Messages.GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION",
find: "#{intl::GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION}",
group: true,
replacement: [
{
match: /children:\i\.\i\.\i\.GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION/,
match: /children:\i\.\i\.string\(\i\.\i#{intl::GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION}\)/,
replace: "children: $self.renderInvitesLabel({guildId:arguments[0].guildId,setChecked})",
},
{
match: /\.INVITES_DISABLED\)(?=.+?\.Messages\.INVITES_PERMANENTLY_DISABLED_TIP.+?checked:(\i)).+?\[\1,(\i)\]=\i.useState\(\i\)/,
match: /\.INVITES_DISABLED\)(?=.+?#{intl::INVITES_PERMANENTLY_DISABLED_TIP}.+?checked:(\i)).+?\[\1,(\i)\]=\i.useState\(\i\)/,
replace: "$&,setChecked=$2"
}
]
@ -61,7 +62,7 @@ export default definePlugin({
renderInvitesLabel: ErrorBoundary.wrap(({ guildId, setChecked }) => {
return (
<div>
{i18n.Messages.GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION}
{getIntlMessage("GUILD_INVITE_DISABLE_ACTION_SHEET_DESCRIPTION")}
{showDisableInvites(guildId) && <a role="button" onClick={() => {
setChecked(true);
disableInvites(guildId);

View file

@ -32,7 +32,7 @@ export default definePlugin({
patches: [
// Permission lockout, just set the check to true
{
find: ".STAGE_CHANNEL_CANNOT_OVERWRITE_PERMISSION",
find: "#{intl::STAGE_CHANNEL_CANNOT_OVERWRITE_PERMISSION}",
replacement: [
{
match: /case"DENY":.{0,50}if\((?=\i\.\i\.can)/,
@ -43,7 +43,7 @@ export default definePlugin({
},
// Onboarding, same thing but we need to prevent the check
{
find: ".ONBOARDING_CHANNEL_THRESHOLD_WARNING",
find: "#{intl::ONBOARDING_CHANNEL_THRESHOLD_WARNING}",
replacement: [
{
match: /{(\i:function\(\){return \i},?){2}}/,

View file

@ -19,10 +19,10 @@
import ErrorBoundary from "@components/ErrorBoundary";
import { Flex } from "@components/Flex";
import { InfoIcon, OwnerCrownIcon } from "@components/Icons";
import { getUniqueUsername } from "@utils/discord";
import { getIntlMessage, getUniqueUsername } from "@utils/discord";
import { ModalCloseButton, ModalContent, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
import { findByCodeLazy } from "@webpack";
import { Clipboard, ContextMenuApi, FluxDispatcher, GuildMemberStore, GuildStore, i18n, Menu, PermissionsBits, ScrollerThin, Text, Tooltip, useEffect, UserStore, useState, useStateFromStores } from "@webpack/common";
import { Clipboard, ContextMenuApi, FluxDispatcher, GuildMemberStore, GuildStore, Menu, PermissionsBits, ScrollerThin, Text, Tooltip, useEffect, UserStore, useState, useStateFromStores } from "@webpack/common";
import { UnicodeEmoji } from "@webpack/types";
import type { Guild, Role, User } from "discord-types/general";
@ -216,7 +216,7 @@ function RoleContextMenu({ guild, roleId, onClose }: { guild: Guild; roleId: str
>
<Menu.MenuItem
id={cl("copy-role-id")}
label={i18n.Messages.COPY_ID_ROLE}
label={getIntlMessage("COPY_ID_ROLE")}
action={() => {
Clipboard.copy(roleId);
}}
@ -225,7 +225,7 @@ function RoleContextMenu({ guild, roleId, onClose }: { guild: Guild; roleId: str
{(settings.store as any).unsafeViewAsRole && (
<Menu.MenuItem
id={cl("view-as-role")}
label={i18n.Messages.VIEW_AS_ROLE}
label={getIntlMessage("VIEW_AS_ROLE")}
action={() => {
const role = GuildStore.getRole(guild.id, roleId);
if (!role) return;
@ -257,7 +257,7 @@ function UserContextMenu({ userId }: { userId: string; }) {
>
<Menu.MenuItem
id={cl("copy-user-id")}
label={i18n.Messages.COPY_ID_USER}
label={getIntlMessage("COPY_ID_USER")}
action={() => {
Clipboard.copy(userId);
}}

View file

@ -18,9 +18,10 @@
import ErrorBoundary from "@components/ErrorBoundary";
import { ExpandableHeader } from "@components/ExpandableHeader";
import { getIntlMessage } from "@utils/discord";
import { classes } from "@utils/misc";
import { filters, findBulk, proxyLazyWebpack } from "@webpack";
import { i18n, PermissionsBits, Text, Tooltip, useMemo, UserStore } from "@webpack/common";
import { PermissionsBits, Text, Tooltip, useMemo, UserStore } from "@webpack/common";
import type { Guild, GuildMember } from "discord-types/general";
import { PermissionsSortOrder, settings } from "..";
@ -105,7 +106,7 @@ function UserPermissionsComponent({ guild, guildMember, forceOpen = false }: { g
permissions: Object.values(PermissionsBits).reduce((prev, curr) => prev | curr, 0n)
});
const OWNER = i18n.Messages.GUILD_OWNER || "Server Owner";
const OWNER = getIntlMessage("GUILD_OWNER") || "Server Owner";
userPermissions.push({
permission: OWNER,
roleName: "Owner",

View file

@ -170,7 +170,7 @@ export default definePlugin({
patches: [
{
find: ".VIEW_ALL_ROLES,",
find: "#{intl::VIEW_ALL_ROLES}",
replacement: {
match: /\.expandButton,.+?null,/,
replace: "$&$self.ViewPermissionsButton(arguments[0]),"

View file

@ -17,8 +17,9 @@
*/
import { classNameFactory } from "@api/Styles";
import { getIntlMessage } from "@utils/discord";
import { wordsToTitle } from "@utils/text";
import { GuildStore, i18n, Parser } from "@webpack/common";
import { GuildStore, Parser } from "@webpack/common";
import { Guild, GuildMember, Role } from "discord-types/general";
import type { ReactNode } from "react";
@ -44,7 +45,7 @@ const PermissionKeyMap = {
export function getPermissionString(permission: string) {
permission = PermissionKeyMap[permission] || permission;
return i18n.Messages[permission] ||
return getIntlMessage(permission) ||
// shouldn't get here but just in case
formatPermissionWithoutMatchingString(permission);
}
@ -58,7 +59,7 @@ export function getPermissionDescription(permission: string): ReactNode {
else if (permission !== "STREAM")
permission = PermissionKeyMap[permission] || permission;
const msg = i18n.Messages[`ROLE_PERMISSIONS_${permission}_DESCRIPTION`] as any;
const msg = getIntlMessage(`ROLE_PERMISSIONS_${permission}_DESCRIPTION`) as any;
if (msg?.hasMarkdown)
return Parser.parse(msg.message);

View file

@ -30,7 +30,7 @@ interface ColorPickerWithSwatchesProps {
renderCustomButton?: () => React.ReactNode;
}
const ColorPicker = findComponentByCodeLazy<ColorPickerProps>(".Messages.USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR", ".BACKGROUND_PRIMARY)");
const ColorPicker = findComponentByCodeLazy<ColorPickerProps>("#{intl::USER_SETTINGS_PROFILE_COLOR_SELECT_COLOR}", ".BACKGROUND_PRIMARY)");
const ColorPickerWithSwatches = findExportedComponentLazy<ColorPickerWithSwatchesProps>("ColorPicker", "CustomColorPicker");
export const requireSettingsMenu = extractAndLoadChunksLazy(['name:"UserSettings"'], /createPromise:.{0,20}Promise\.all\((\[\i\.\i\("?.+?"?\).+?\])\).then\(\i\.bind\(\i,"?(.+?)"?\)\).{0,50}"UserSettings"/);

View file

@ -67,7 +67,7 @@ export default definePlugin({
patches: [
{
find: ".REPLY_QUOTE_MESSAGE_BLOCKED",
find: "#{intl::REPLY_QUOTE_MESSAGE_BLOCKED}",
replacement: {
match: /\.onClickReply,.+?}\),(?=\i,\i,\i\])/,
replace: "$&$self.ReplyTimestamp(arguments[0]),"

View file

@ -108,7 +108,7 @@ export default definePlugin({
patches: [
{
find: ".Messages.MESSAGE_ACTIONS_MENU_LABEL,shouldHideMediaOptions",
find: "#{intl::MESSAGE_ACTIONS_MENU_LABEL}",
replacement: {
match: /favoriteableType:\i,(?<=(\i)\.getAttribute\("data-type"\).+?)/,
replace: (m, target) => `${m}reverseImageSearchType:${target}.getAttribute("data-role"),`

View file

@ -104,7 +104,7 @@ export default definePlugin({
predicate: () => settings.store.memberList,
},
{
find: ".Messages.THREAD_BROWSER_PRIVATE",
find: "#{intl::THREAD_BROWSER_PRIVATE}",
replacement: [
{
match: /children:\[\i," — ",\i\]/,
@ -132,7 +132,7 @@ export default definePlugin({
predicate: () => settings.store.reactorsList,
},
{
find: '.Messages.MESSAGE_EDITED,")"',
find: "#{intl::MESSAGE_EDITED}",
replacement: {
match: /(?<=isUnsupported\]:(\i)\.isUnsupported\}\),)(?=children:\[)/,
replace: "style:{color:$self.useMessageColor($1)},"

View file

@ -46,7 +46,7 @@ export default definePlugin({
}
},
{
find: ".PREVIEW_NUM_LINES",
find: "#{intl::PREVIEW_NUM_LINES}",
replacement: {
match: /(?<=function \i\((\i)\)\{)(?=let\{text:\i,language:)/,
replace: "return $self.renderHighlighter({lang:$1.language,content:$1.text});"

View file

@ -26,7 +26,7 @@ export default definePlugin({
patches: [
{
find: ".Messages.MESSAGE_UTILITIES_A11Y_LABEL",
find: "#{intl::MESSAGE_UTILITIES_A11Y_LABEL}",
replacement: {
match: /isExpanded:\i&&(.+?),/,
replace: "isExpanded:$1,"

Some files were not shown because too many files have changed in this diff Show more