Merge remote-tracking branch 'upstream/main'
This commit is contained in:
commit
9ad552a5dc
21 changed files with 326 additions and 78 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "vencord",
|
"name": "vencord",
|
||||||
"private": "true",
|
"private": "true",
|
||||||
"version": "1.9.4",
|
"version": "1.9.5",
|
||||||
"description": "The cutest Discord client mod",
|
"description": "The cutest Discord client mod",
|
||||||
"homepage": "https://github.com/Vendicated/Vencord#readme",
|
"homepage": "https://github.com/Vendicated/Vencord#readme",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
|
@ -21,6 +21,7 @@
|
||||||
"buildReporter": "pnpm buildWebStandalone --reporter --skip-extension",
|
"buildReporter": "pnpm buildWebStandalone --reporter --skip-extension",
|
||||||
"buildReporterDesktop": "pnpm build --reporter",
|
"buildReporterDesktop": "pnpm build --reporter",
|
||||||
"watch": "pnpm build --watch",
|
"watch": "pnpm build --watch",
|
||||||
|
"dev": "pnpm watch",
|
||||||
"watchWeb": "pnpm buildWeb --watch",
|
"watchWeb": "pnpm buildWeb --watch",
|
||||||
"generatePluginJson": "tsx scripts/generatePluginList.ts",
|
"generatePluginJson": "tsx scripts/generatePluginList.ts",
|
||||||
"generateTypes": "tspc --emitDeclarationOnly --declaration --outDir packages/vencord-types",
|
"generateTypes": "tspc --emitDeclarationOnly --declaration --outDir packages/vencord-types",
|
||||||
|
|
|
@ -91,7 +91,7 @@ export default definePlugin({
|
||||||
|
|
||||||
/* new profiles */
|
/* new profiles */
|
||||||
{
|
{
|
||||||
find: ".PANEL]:14",
|
find: ".FULL_SIZE]:26",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=(\i)=\(0,\i\.\i\)\(\i\);)return 0===\i.length\?/,
|
match: /(?<=(\i)=\(0,\i\.\i\)\(\i\);)return 0===\i.length\?/,
|
||||||
replace: "$1.unshift(...$self.getBadges(arguments[0].displayProfile));$&"
|
replace: "$1.unshift(...$self.getBadges(arguments[0].displayProfile));$&"
|
||||||
|
|
|
@ -39,6 +39,15 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
patches: [
|
patches: [
|
||||||
|
// Only one of the two patches will be at effect; Discord often updates to switch between them.
|
||||||
|
// See: https://discord.com/channels/1015060230222131221/1032770730703716362/1261398512017477673
|
||||||
|
{
|
||||||
|
find: ".ENTER&&(!",
|
||||||
|
replacement: {
|
||||||
|
match: /(?<=(\i)\.which===\i\.\i.ENTER&&).{0,100}(\(0,\i\.\i\)\(\i\)).{0,100}(?=&&\(\i\.preventDefault)/,
|
||||||
|
replace: "$self.shouldSubmit($1, $2)"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
find: "!this.hasOpenCodeBlock()",
|
find: "!this.hasOpenCodeBlock()",
|
||||||
replacement: {
|
replacement: {
|
||||||
|
|
|
@ -88,8 +88,8 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: "useCanFavoriteChannel",
|
find: "useCanFavoriteChannel",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /!\(\i\.isDM\(\)\|\|\i\.isThread\(\)\)/,
|
match: /\i\.isDM\(\)\|\|\i\.isThread\(\)/,
|
||||||
replace: "true",
|
replace: "false",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
@ -24,7 +24,7 @@ import { getCurrentGuild } from "@utils/discord";
|
||||||
import { Logger } from "@utils/Logger";
|
import { Logger } from "@utils/Logger";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByCodeLazy, findByPropsLazy, findStoreLazy, proxyLazyWebpack } from "@webpack";
|
import { findByCodeLazy, findByPropsLazy, findStoreLazy, proxyLazyWebpack } from "@webpack";
|
||||||
import { Alerts, ChannelStore, DraftType, EmojiStore, FluxDispatcher, Forms, IconUtils, lodash, Parser, PermissionsBits, PermissionStore, UploadHandler, UserSettingsActionCreators, UserStore } from "@webpack/common";
|
import { Alerts, ChannelStore, DraftType, EmojiStore, FluxDispatcher, Forms, GuildMemberStore, IconUtils, lodash, Parser, PermissionsBits, PermissionStore, UploadHandler, UserSettingsActionCreators, UserStore } from "@webpack/common";
|
||||||
import type { Emoji } from "@webpack/types";
|
import type { Emoji } from "@webpack/types";
|
||||||
import type { Message } from "discord-types/general";
|
import type { Message } from "discord-types/general";
|
||||||
import { applyPalette, GIFEncoder, quantize } from "gifenc";
|
import { applyPalette, GIFEncoder, quantize } from "gifenc";
|
||||||
|
@ -818,7 +818,14 @@ export default definePlugin({
|
||||||
|
|
||||||
if (isUnusableRoleSubscriptionEmoji(e, this.guildId, true)) return false;
|
if (isUnusableRoleSubscriptionEmoji(e, this.guildId, true)) return false;
|
||||||
|
|
||||||
if (this.canUseEmotes)
|
let isUsableTwitchSubEmote = false;
|
||||||
|
if (e.managed && e.guildId) {
|
||||||
|
// @ts-ignore outdated type
|
||||||
|
const myRoles = GuildMemberStore.getSelfMember(e.guildId)?.roles ?? [];
|
||||||
|
isUsableTwitchSubEmote = e.roles.some(r => myRoles.includes(r));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.canUseEmotes || isUsableTwitchSubEmote)
|
||||||
return e.guildId === this.guildId || hasExternalEmojiPerms(channelId);
|
return e.guildId === this.guildId || hasExternalEmojiPerms(channelId);
|
||||||
else
|
else
|
||||||
return !e.animated && e.guildId === this.guildId;
|
return !e.animated && e.guildId === this.guildId;
|
||||||
|
|
|
@ -17,7 +17,7 @@ const container = findByPropsLazy("memberSince");
|
||||||
const getCreatedAtDate = findByCodeLazy('month:"short",day:"numeric"');
|
const getCreatedAtDate = findByCodeLazy('month:"short",day:"numeric"');
|
||||||
const locale = findByPropsLazy("getLocale");
|
const locale = findByPropsLazy("getLocale");
|
||||||
const lastSection = findByPropsLazy("lastSection");
|
const lastSection = findByPropsLazy("lastSection");
|
||||||
const section = findLazy((m: any) => m.section !== void 0 && Object.values(m).length === 1);
|
const section = findLazy((m: any) => m.section !== void 0 && m.heading !== void 0 && Object.values(m).length === 2);
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "FriendsSince",
|
name: "FriendsSince",
|
||||||
|
|
|
@ -133,10 +133,12 @@ export default definePlugin({
|
||||||
message: message,
|
message: message,
|
||||||
channel: ChannelStore.getChannel(message.channel_id),
|
channel: ChannelStore.getChannel(message.channel_id),
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
await iteratePasswords(message).then((res: string | false) => {
|
const res = await iteratePasswords(message);
|
||||||
if (res) return void this.buildEmbed(message, res);
|
|
||||||
return void buildDecModal({ message });
|
if (res)
|
||||||
});
|
this.buildEmbed(message, res);
|
||||||
|
else
|
||||||
|
buildDecModal({ message });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
: null;
|
: null;
|
||||||
|
@ -169,9 +171,9 @@ export default definePlugin({
|
||||||
|
|
||||||
message.embeds.push({
|
message.embeds.push({
|
||||||
type: "rich",
|
type: "rich",
|
||||||
title: "Decrypted Message",
|
rawTitle: "Decrypted Message",
|
||||||
color: "0x45f5f5",
|
color: "0x45f5f5",
|
||||||
description: revealed,
|
rawDescription: revealed,
|
||||||
footer: {
|
footer: {
|
||||||
text: "Made with ❤️ by c0dine and Sammy!",
|
text: "Made with ❤️ by c0dine and Sammy!",
|
||||||
},
|
},
|
||||||
|
|
5
src/plugins/mentionAvatars/README.md
Normal file
5
src/plugins/mentionAvatars/README.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# MentionAvatars
|
||||||
|
|
||||||
|
Shows user avatars inside mentions
|
||||||
|
|
||||||
|
![](https://github.com/user-attachments/assets/fc76ea47-5e19-4063-a592-c57785a75cc7)
|
44
src/plugins/mentionAvatars/index.tsx
Normal file
44
src/plugins/mentionAvatars/index.tsx
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2024 Vendicated and contributors
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import "./styles.css";
|
||||||
|
|
||||||
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
|
import { Devs } from "@utils/constants";
|
||||||
|
import definePlugin from "@utils/types";
|
||||||
|
import { SelectedGuildStore, useState } from "@webpack/common";
|
||||||
|
import { User } from "discord-types/general";
|
||||||
|
|
||||||
|
export default definePlugin({
|
||||||
|
name: "MentionAvatars",
|
||||||
|
description: "Shows user avatars inside mentions",
|
||||||
|
authors: [Devs.Ven],
|
||||||
|
|
||||||
|
patches: [{
|
||||||
|
find: ".USER_MENTION)",
|
||||||
|
replacement: {
|
||||||
|
match: /children:"@"\.concat\((null!=\i\?\i:\i)\)(?<=\.useName\((\i)\).+?)/,
|
||||||
|
replace: "children:$self.renderUsername({username:$1,user:$2})"
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
|
||||||
|
renderUsername: ErrorBoundary.wrap((props: { user: User, username: string; }) => {
|
||||||
|
const { user, username } = props;
|
||||||
|
const [isHovering, setIsHovering] = useState(false);
|
||||||
|
|
||||||
|
if (!user) return <>@{username}</>;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
onMouseEnter={() => setIsHovering(true)}
|
||||||
|
onMouseLeave={() => setIsHovering(false)}
|
||||||
|
>
|
||||||
|
<img src={user.getAvatarURL(SelectedGuildStore.getGuildId(), 16, isHovering)} className="vc-mentionAvatars-avatar" />
|
||||||
|
@{username}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}, { noop: true })
|
||||||
|
});
|
8
src/plugins/mentionAvatars/styles.css
Normal file
8
src/plugins/mentionAvatars/styles.css
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
.vc-mentionAvatars-avatar {
|
||||||
|
vertical-align: middle;
|
||||||
|
width: 1em !important; /* insane discord sets width: 100% in channel topic */
|
||||||
|
height: 1em;
|
||||||
|
margin: 0 4px 0.2rem 2px;
|
||||||
|
border-radius: 50%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
|
@ -147,6 +147,7 @@ async function fetchMessage(channelID: string, messageID: string) {
|
||||||
if (!msg) return;
|
if (!msg) return;
|
||||||
|
|
||||||
const message: Message = MessageStore.getMessages(msg.channel_id).receiveMessage(msg).get(msg.id);
|
const message: Message = MessageStore.getMessages(msg.channel_id).receiveMessage(msg).get(msg.id);
|
||||||
|
if (!message) return;
|
||||||
|
|
||||||
messageCache.set(message.id, {
|
messageCache.set(message.id, {
|
||||||
message,
|
message,
|
||||||
|
|
91
src/plugins/messageLogger/HistoryModal.tsx
Normal file
91
src/plugins/messageLogger/HistoryModal.tsx
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2024 Vendicated and contributors
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { classNameFactory } from "@api/Styles";
|
||||||
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
|
import { Margins } from "@utils/margins";
|
||||||
|
import { classes } from "@utils/misc";
|
||||||
|
import { ModalCloseButton, ModalContent, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
|
||||||
|
import { findByPropsLazy } from "@webpack";
|
||||||
|
import { TabBar, Text, Timestamp, TooltipContainer, useState } from "@webpack/common";
|
||||||
|
|
||||||
|
import { parseEditContent } from ".";
|
||||||
|
|
||||||
|
const CodeContainerClasses = findByPropsLazy("markup", "codeContainer");
|
||||||
|
const MiscClasses = findByPropsLazy("messageContent", "markupRtl");
|
||||||
|
|
||||||
|
const cl = classNameFactory("vc-ml-modal-");
|
||||||
|
|
||||||
|
export function openHistoryModal(message: any) {
|
||||||
|
openModal(props =>
|
||||||
|
<ErrorBoundary>
|
||||||
|
<HistoryModal
|
||||||
|
modalProps={props}
|
||||||
|
message={message}
|
||||||
|
/>
|
||||||
|
</ErrorBoundary>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function HistoryModal({ modalProps, message }: { modalProps: ModalProps; message: any; }) {
|
||||||
|
const [currentTab, setCurrentTab] = useState(message.editHistory.length);
|
||||||
|
const timestamps = [message.firstEditTimestamp, ...message.editHistory.map(m => m.timestamp)];
|
||||||
|
const contents = [...message.editHistory.map(m => m.content), message.content];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ModalRoot {...modalProps} size={ModalSize.LARGE}>
|
||||||
|
<ModalHeader className={cl("head")}>
|
||||||
|
<Text variant="heading-lg/semibold" style={{ flexGrow: 1 }}>Message Edit History</Text>
|
||||||
|
<ModalCloseButton onClick={modalProps.onClose} />
|
||||||
|
</ModalHeader>
|
||||||
|
|
||||||
|
<ModalContent className={cl("contents")}>
|
||||||
|
<TabBar
|
||||||
|
type="top"
|
||||||
|
look="brand"
|
||||||
|
className={classes("vc-settings-tab-bar", cl("tab-bar"))}
|
||||||
|
selectedItem={currentTab}
|
||||||
|
onItemSelect={setCurrentTab}
|
||||||
|
>
|
||||||
|
{message.firstEditTimestamp.getTime() !== message.timestamp.getTime() && (
|
||||||
|
<TooltipContainer text="This edit state was not logged so it can't be displayed.">
|
||||||
|
<TabBar.Item
|
||||||
|
className="vc-settings-tab-bar-item"
|
||||||
|
id={-1}
|
||||||
|
disabled
|
||||||
|
>
|
||||||
|
<Timestamp
|
||||||
|
className={cl("timestamp")}
|
||||||
|
timestamp={message.timestamp}
|
||||||
|
isEdited={true}
|
||||||
|
isInline={false}
|
||||||
|
/>
|
||||||
|
</TabBar.Item>
|
||||||
|
</TooltipContainer>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{timestamps.map((timestamp, index) => (
|
||||||
|
<TabBar.Item
|
||||||
|
className="vc-settings-tab-bar-item"
|
||||||
|
id={index}
|
||||||
|
>
|
||||||
|
<Timestamp
|
||||||
|
className={cl("timestamp")}
|
||||||
|
timestamp={timestamp}
|
||||||
|
isEdited={true}
|
||||||
|
isInline={false}
|
||||||
|
/>
|
||||||
|
</TabBar.Item>
|
||||||
|
))}
|
||||||
|
</TabBar>
|
||||||
|
|
||||||
|
<div className={classes(CodeContainerClasses.markup, MiscClasses.messageContent, Margins.top20)}>
|
||||||
|
{parseEditContent(contents[currentTab], message)}
|
||||||
|
</div>
|
||||||
|
</ModalContent>
|
||||||
|
</ModalRoot>
|
||||||
|
);
|
||||||
|
}
|
|
@ -24,21 +24,26 @@ import { Settings } from "@api/Settings";
|
||||||
import { disableStyle, enableStyle } from "@api/Styles";
|
import { disableStyle, enableStyle } from "@api/Styles";
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
|
import { proxyLazy } from "@utils/lazy";
|
||||||
import { Logger } from "@utils/Logger";
|
import { Logger } from "@utils/Logger";
|
||||||
|
import { classes } from "@utils/misc";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByPropsLazy } from "@webpack";
|
import { findByCodeLazy, findByPropsLazy } from "@webpack";
|
||||||
import { ChannelStore, FluxDispatcher, i18n, Menu, MessageStore, Parser, Timestamp, UserStore, useStateFromStores } from "@webpack/common";
|
import { ChannelStore, FluxDispatcher, i18n, Menu, MessageStore, Parser, SelectedChannelStore, Timestamp, UserStore, useStateFromStores } from "@webpack/common";
|
||||||
import { Message } from "discord-types/general";
|
import { Message } from "discord-types/general";
|
||||||
|
|
||||||
import overlayStyle from "./deleteStyleOverlay.css?managed";
|
import overlayStyle from "./deleteStyleOverlay.css?managed";
|
||||||
import textStyle from "./deleteStyleText.css?managed";
|
import textStyle from "./deleteStyleText.css?managed";
|
||||||
|
import { openHistoryModal } from "./HistoryModal";
|
||||||
|
|
||||||
interface MLMessage extends Message {
|
interface MLMessage extends Message {
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
editHistory?: { timestamp: Date; content: string; }[];
|
editHistory?: { timestamp: Date; content: string; }[];
|
||||||
|
firstEditTimestamp?: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = findByPropsLazy("edited", "communicationDisabled", "isSystemMessage");
|
const styles = findByPropsLazy("edited", "communicationDisabled", "isSystemMessage");
|
||||||
|
const getMessage = findByCodeLazy('replace(/^\\n+|\\n+$/g,"")');
|
||||||
|
|
||||||
function addDeleteStyle() {
|
function addDeleteStyle() {
|
||||||
if (Settings.plugins.MessageLogger.deleteStyle === "text") {
|
if (Settings.plugins.MessageLogger.deleteStyle === "text") {
|
||||||
|
@ -125,10 +130,22 @@ const patchChannelContextMenu: NavContextMenuPatchCallback = (children, { channe
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function parseEditContent(content: string, message: Message) {
|
||||||
|
return Parser.parse(content, true, {
|
||||||
|
channelId: message.channel_id,
|
||||||
|
messageId: message.id,
|
||||||
|
allowLinks: true,
|
||||||
|
allowHeading: true,
|
||||||
|
allowList: true,
|
||||||
|
allowEmojiLinks: true,
|
||||||
|
viewingChannelId: SelectedChannelStore.getChannelId(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "MessageLogger",
|
name: "MessageLogger",
|
||||||
description: "Temporarily logs deleted and edited messages.",
|
description: "Temporarily logs deleted and edited messages.",
|
||||||
authors: [Devs.rushii, Devs.Ven, Devs.AutumnVN, Devs.Nickyux],
|
authors: [Devs.rushii, Devs.Ven, Devs.AutumnVN, Devs.Nickyux, Devs.Kyuuhachi],
|
||||||
dependencies: ["MessageUpdaterAPI"],
|
dependencies: ["MessageUpdaterAPI"],
|
||||||
|
|
||||||
contextMenus: {
|
contextMenus: {
|
||||||
|
@ -150,11 +167,11 @@ export default definePlugin({
|
||||||
(oldMsg, newMsg) => oldMsg?.editHistory === newMsg?.editHistory
|
(oldMsg, newMsg) => oldMsg?.editHistory === newMsg?.editHistory
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return Settings.plugins.MessageLogger.inlineEdits && (
|
||||||
<>
|
<>
|
||||||
{message.editHistory?.map(edit => (
|
{message.editHistory?.map(edit => (
|
||||||
<div className="messagelogger-edited">
|
<div className="messagelogger-edited">
|
||||||
{Parser.parse(edit.content)}
|
{parseEditContent(edit.content, message)}
|
||||||
<Timestamp
|
<Timestamp
|
||||||
timestamp={edit.timestamp}
|
timestamp={edit.timestamp}
|
||||||
isEdited={true}
|
isEdited={true}
|
||||||
|
@ -191,11 +208,21 @@ export default definePlugin({
|
||||||
description: "Whether to log deleted messages",
|
description: "Whether to log deleted messages",
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
collapseDeleted: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: "Whether to collapse deleted messages, similar to blocked messages",
|
||||||
|
default: false
|
||||||
|
},
|
||||||
logEdits: {
|
logEdits: {
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
description: "Whether to log edited messages",
|
description: "Whether to log edited messages",
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
inlineEdits: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: "Whether to display edit history as part of message content",
|
||||||
|
default: true
|
||||||
|
},
|
||||||
ignoreBots: {
|
ignoreBots: {
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
description: "Whether to ignore messages by bots",
|
description: "Whether to ignore messages by bots",
|
||||||
|
@ -271,6 +298,23 @@ export default definePlugin({
|
||||||
(message.channel_id === "1026515880080842772" && message.author?.id === "1017176847865352332");
|
(message.channel_id === "1026515880080842772" && message.author?.id === "1017176847865352332");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
EditMarker({ message, className, children, ...props }: any) {
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
{...props}
|
||||||
|
className={classes("messagelogger-edit-marker", className)}
|
||||||
|
onClick={() => openHistoryModal(message)}
|
||||||
|
aria-role="button"
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
Messages: proxyLazy(() => ({
|
||||||
|
DELETED_MESSAGE_COUNT: getMessage("{count, plural, =0 {No deleted messages} one {{count} deleted message} other {{count} deleted messages}}")
|
||||||
|
})),
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
// MessageStore
|
// MessageStore
|
||||||
|
@ -324,7 +368,8 @@ export default definePlugin({
|
||||||
match: /this\.customRenderedContent=(\i)\.customRenderedContent,/,
|
match: /this\.customRenderedContent=(\i)\.customRenderedContent,/,
|
||||||
replace: "this.customRenderedContent = $1.customRenderedContent," +
|
replace: "this.customRenderedContent = $1.customRenderedContent," +
|
||||||
"this.deleted = $1.deleted || false," +
|
"this.deleted = $1.deleted || false," +
|
||||||
"this.editHistory = $1.editHistory || [],"
|
"this.editHistory = $1.editHistory || []," +
|
||||||
|
"this.firstEditTimestamp = $1.firstEditTimestamp || this.editedTimestamp || this.timestamp,"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -337,7 +382,7 @@ export default definePlugin({
|
||||||
// Pass through editHistory & deleted & original attachments to the "edited message" transformer
|
// Pass through editHistory & deleted & original attachments to the "edited message" transformer
|
||||||
match: /(?<=null!=\i\.edited_timestamp\)return )\i\(\i,\{reactions:(\i)\.reactions.{0,50}\}\)/,
|
match: /(?<=null!=\i\.edited_timestamp\)return )\i\(\i,\{reactions:(\i)\.reactions.{0,50}\}\)/,
|
||||||
replace:
|
replace:
|
||||||
"Object.assign($&,{ deleted:$1.deleted, editHistory:$1.editHistory })"
|
"Object.assign($&,{ deleted:$1.deleted, editHistory:$1.editHistory, firstEditTimestamp:$1.firstEditTimestamp })"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -356,7 +401,8 @@ export default definePlugin({
|
||||||
" return $2;" +
|
" return $2;" +
|
||||||
"})())," +
|
"})())," +
|
||||||
"deleted: arguments[1]?.deleted," +
|
"deleted: arguments[1]?.deleted," +
|
||||||
"editHistory: arguments[1]?.editHistory"
|
"editHistory: arguments[1]?.editHistory," +
|
||||||
|
"firstEditTimestamp: new Date(arguments[1]?.firstEditTimestamp ?? $2.editedTimestamp ?? $2.timestamp)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Preserve deleted attribute on attachments
|
// Preserve deleted attribute on attachments
|
||||||
|
@ -404,6 +450,11 @@ export default definePlugin({
|
||||||
// Render editHistory in the deepest div for message content
|
// Render editHistory in the deepest div for message content
|
||||||
match: /(\)\("div",\{id:.+?children:\[)/,
|
match: /(\)\("div",\{id:.+?children:\[)/,
|
||||||
replace: "$1 (!!arguments[0].message.editHistory?.length && $self.renderEdits(arguments[0])),"
|
replace: "$1 (!!arguments[0].message.editHistory?.length && $self.renderEdits(arguments[0])),"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// Make edit marker clickable
|
||||||
|
match: /"span",\{(?=className:\i\.edited,)/,
|
||||||
|
replace: "$self.EditMarker,{message:arguments[0].message,"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -433,6 +484,30 @@ export default definePlugin({
|
||||||
replace: "children:arguments[0].message.deleted?[]:$1"
|
replace: "children:arguments[0].message.deleted?[]:$1"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// Message grouping
|
||||||
|
find: "NON_COLLAPSIBLE.has(",
|
||||||
|
replacement: {
|
||||||
|
match: /if\((\i)\.blocked\)return \i\.\i\.MESSAGE_GROUP_BLOCKED;/,
|
||||||
|
replace: '$&else if($1.deleted) return"MESSAGE_GROUP_DELETED";',
|
||||||
|
},
|
||||||
|
predicate: () => Settings.plugins.MessageLogger.collapseDeleted
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// Message group rendering
|
||||||
|
find: "Messages.NEW_MESSAGES_ESTIMATED_WITH_DATE",
|
||||||
|
replacement: [
|
||||||
|
{
|
||||||
|
match: /(\i).type===\i\.\i\.MESSAGE_GROUP_BLOCKED\|\|/,
|
||||||
|
replace: '$&$1.type==="MESSAGE_GROUP_DELETED"||',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
match: /(\i).type===\i\.\i\.MESSAGE_GROUP_BLOCKED\?.*?:/,
|
||||||
|
replace: '$&$1.type==="MESSAGE_GROUP_DELETED"?$self.Messages.DELETED_MESSAGE_COUNT:',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
predicate: () => Settings.plugins.MessageLogger.collapseDeleted
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
|
@ -38,3 +38,17 @@
|
||||||
.theme-light .messagelogger-edited {
|
.theme-light .messagelogger-edited {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.messagelogger-edit-marker {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vc-ml-modal-timestamp {
|
||||||
|
cursor: unset;
|
||||||
|
height: unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vc-ml-modal-tab-bar {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
|
@ -256,6 +256,7 @@ export default definePlugin({
|
||||||
// in profiles
|
// in profiles
|
||||||
{
|
{
|
||||||
find: ",overrideDiscriminator:",
|
find: ",overrideDiscriminator:",
|
||||||
|
group: true,
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
// prevent channel id from getting ghosted
|
// prevent channel id from getting ghosted
|
||||||
|
@ -263,7 +264,7 @@ export default definePlugin({
|
||||||
match: /user:\i,nick:\i,/,
|
match: /user:\i,nick:\i,/,
|
||||||
replace: "$&moreTags_channelId,"
|
replace: "$&moreTags_channelId,"
|
||||||
}, {
|
}, {
|
||||||
match: /,botType:(\i\((\i)\)),/g,
|
match: /,botType:(\i),(?<=user:(\i).+?)/g,
|
||||||
replace: ",botType:$self.getTag({user:$2,channelId:moreTags_channelId,origType:$1,location:'not-chat'}),"
|
replace: ",botType:$self.getTag({user:$2,channelId:moreTags_channelId,origType:$1,location:'not-chat'}),"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -60,7 +60,7 @@ export default definePlugin({
|
||||||
find: 'location:"UserMention',
|
find: 'location:"UserMention',
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /user:(\i),channel:(\i).{0,400}?"@"\.concat\(.+?\)/,
|
match: /onContextMenu:\i,color:\i,\.\.\.\i(?=,children:)(?<=user:(\i),channel:(\i).{0,500}?)/,
|
||||||
replace: "$&,color:$self.getUserColor($1?.id,{channelId:$2?.id})"
|
replace: "$&,color:$self.getUserColor($1?.id,{channelId:$2?.id})"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
@ -18,34 +18,21 @@
|
||||||
|
|
||||||
import { definePluginSettings, migratePluginSettings } from "@api/Settings";
|
import { definePluginSettings, migratePluginSettings } from "@api/Settings";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType, PluginSettingDef } from "@utils/types";
|
||||||
|
|
||||||
|
const opt = (description: string) => ({
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description,
|
||||||
|
default: true,
|
||||||
|
restartNeeded: true
|
||||||
|
} satisfies PluginSettingDef);
|
||||||
|
|
||||||
const settings = definePluginSettings({
|
const settings = definePluginSettings({
|
||||||
showTimeouts: {
|
showTimeouts: opt("Show member timeout icons in chat."),
|
||||||
type: OptionType.BOOLEAN,
|
showInvitesPaused: opt("Show the invites paused tooltip in the server list."),
|
||||||
description: "Show member timeout icons in chat.",
|
showModView: opt("Show the member mod view context menu item in all servers."),
|
||||||
default: true,
|
disableDiscoveryFilters: opt("Disable filters in Server Discovery search that hide servers that don't meet discovery criteria."),
|
||||||
},
|
disableDisallowedDiscoveryFilters: opt("Disable filters in Server Discovery search that hide NSFW & disallowed servers."),
|
||||||
showInvitesPaused: {
|
|
||||||
type: OptionType.BOOLEAN,
|
|
||||||
description: "Show the invites paused tooltip in the server list.",
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
showModView: {
|
|
||||||
type: OptionType.BOOLEAN,
|
|
||||||
description: "Show the member mod view context menu item in all servers.",
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
disableDiscoveryFilters: {
|
|
||||||
type: OptionType.BOOLEAN,
|
|
||||||
description: "Disable filters in Server Discovery search that hide servers that don't meet discovery criteria.",
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
disableDisallowedDiscoveryFilters: {
|
|
||||||
type: OptionType.BOOLEAN,
|
|
||||||
description: "Disable filters in Server Discovery search that hide NSFW & disallowed servers.",
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
migratePluginSettings("ShowHiddenThings", "ShowTimeouts");
|
migratePluginSettings("ShowHiddenThings", "ShowTimeouts");
|
||||||
|
|
|
@ -67,7 +67,7 @@ export default definePlugin({
|
||||||
const { nick } = author;
|
const { nick } = author;
|
||||||
const prefix = withMentionPrefix ? "@" : "";
|
const prefix = withMentionPrefix ? "@" : "";
|
||||||
|
|
||||||
if (isRepliedMessage && !settings.store.inReplies || username === nick.toLowerCase())
|
if (isRepliedMessage && !settings.store.inReplies || username.toLowerCase() === nick.toLowerCase())
|
||||||
return <>{prefix}{nick}</>;
|
return <>{prefix}{nick}</>;
|
||||||
|
|
||||||
if (settings.store.mode === "user-nick")
|
if (settings.store.mode === "user-nick")
|
||||||
|
|
|
@ -183,14 +183,22 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
// Profiles Modal pfp
|
// Avatar component used in User DMs "User Profile" popup in the right and Profiles Modal pfp
|
||||||
...[".MODAL,hasProfileEffect", ".FULL_SIZE,hasProfileEffect:"].map(find => ({
|
{
|
||||||
find,
|
find: ".overlay:void 0,status:",
|
||||||
|
replacement: {
|
||||||
|
match: /avatarSrc:(\i),eventHandlers:(\i).+?"div",{...\2,/,
|
||||||
|
replace: "$&style:{cursor:\"pointer\"},onClick:()=>{$self.openImage($1)},"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Old Profiles Modal pfp
|
||||||
|
{
|
||||||
|
find: ".MODAL,hasProfileEffect",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /\{src:(\i)(?=,avatarDecoration)/,
|
match: /\{src:(\i)(?=,avatarDecoration)/,
|
||||||
replace: "{src:$1,onClick:()=>$self.openImage($1)"
|
replace: "{src:$1,onClick:()=>$self.openImage($1)"
|
||||||
}
|
}
|
||||||
})),
|
},
|
||||||
// Banners
|
// Banners
|
||||||
...[".NITRO_BANNER,", "=!1,canUsePremiumCustomization:"].map(find => ({
|
...[".NITRO_BANNER,", "=!1,canUsePremiumCustomization:"].map(find => ({
|
||||||
find,
|
find,
|
||||||
|
@ -202,7 +210,7 @@ export default definePlugin({
|
||||||
'onClick:ev=>$1&&ev.target.style.backgroundImage&&$self.openImage($2),style:{cursor:$1?"pointer":void 0,'
|
'onClick:ev=>$1&&ev.target.style.backgroundImage&&$self.openImage($2),style:{cursor:$1?"pointer":void 0,'
|
||||||
}
|
}
|
||||||
})),
|
})),
|
||||||
// User DMs "User Profile" popup in the right
|
// Old User DMs "User Profile" popup in the right
|
||||||
{
|
{
|
||||||
find: ".avatarPositionPanel",
|
find: ".avatarPositionPanel",
|
||||||
replacement: {
|
replacement: {
|
||||||
|
@ -210,14 +218,6 @@ export default definePlugin({
|
||||||
replace: "$1style:($2)?{cursor:\"pointer\"}:{},onClick:$2?()=>{$self.openImage($3)}"
|
replace: "$1style:($2)?{cursor:\"pointer\"}:{},onClick:$2?()=>{$self.openImage($3)}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
find: ".canUsePremiumProfileCustomization,{avatarSrc:",
|
|
||||||
replacement: {
|
|
||||||
match: /\.avatar,\i\.clickable\),onClick:\i,(?<=avatarSrc:(\i).+?)/,
|
|
||||||
replace: "$&style:{cursor:\"pointer\"},onClick:()=>{$self.openImage($1)},"
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Group DMs top small & large icon
|
// Group DMs top small & large icon
|
||||||
{
|
{
|
||||||
find: /\.recipients\.length>=2(?!<isMultiUserDM.{0,50})/,
|
find: /\.recipients\.length>=2(?!<isMultiUserDM.{0,50})/,
|
||||||
|
|
|
@ -55,6 +55,7 @@ function cleanMessage(msg: Message) {
|
||||||
const cloneAny = clone as any;
|
const cloneAny = clone as any;
|
||||||
delete cloneAny.editHistory;
|
delete cloneAny.editHistory;
|
||||||
delete cloneAny.deleted;
|
delete cloneAny.deleted;
|
||||||
|
delete cloneAny.firstEditTimestamp;
|
||||||
cloneAny.attachments?.forEach(a => delete a.deleted);
|
cloneAny.attachments?.forEach(a => delete a.deleted);
|
||||||
|
|
||||||
return clone;
|
return clone;
|
||||||
|
|
|
@ -43,14 +43,23 @@ function fetchReactions(msg: Message, emoji: ReactionEmoji, type: number) {
|
||||||
},
|
},
|
||||||
oldFormErrors: true
|
oldFormErrors: true
|
||||||
})
|
})
|
||||||
.then(res => FluxDispatcher.dispatch({
|
.then(res => {
|
||||||
|
for (const user of res.body) {
|
||||||
|
FluxDispatcher.dispatch({
|
||||||
|
type: "USER_UPDATE",
|
||||||
|
user
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
FluxDispatcher.dispatch({
|
||||||
type: "MESSAGE_REACTION_ADD_USERS",
|
type: "MESSAGE_REACTION_ADD_USERS",
|
||||||
channelId: msg.channel_id,
|
channelId: msg.channel_id,
|
||||||
messageId: msg.id,
|
messageId: msg.id,
|
||||||
users: res.body,
|
users: res.body,
|
||||||
emoji,
|
emoji,
|
||||||
reactionType: type
|
reactionType: type
|
||||||
}))
|
});
|
||||||
|
})
|
||||||
.catch(console.error)
|
.catch(console.error)
|
||||||
.finally(() => sleep(250));
|
.finally(() => sleep(250));
|
||||||
}
|
}
|
||||||
|
@ -148,13 +157,6 @@ export default definePlugin({
|
||||||
const reactions = getReactionsWithQueue(message, emoji, type);
|
const reactions = getReactionsWithQueue(message, emoji, type);
|
||||||
const users = Object.values(reactions).filter(Boolean) as User[];
|
const users = Object.values(reactions).filter(Boolean) as User[];
|
||||||
|
|
||||||
for (const user of users) {
|
|
||||||
FluxDispatcher.dispatch({
|
|
||||||
type: "USER_UPDATE",
|
|
||||||
user
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{ marginLeft: "0.5em", transform: "scale(0.9)" }}
|
style={{ marginLeft: "0.5em", transform: "scale(0.9)" }}
|
||||||
|
|
Loading…
Reference in a new issue