Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
thororen1234 2025-08-06 19:07:19 -04:00
commit cd793f862a
No known key found for this signature in database
8 changed files with 20 additions and 27 deletions

View file

@ -83,6 +83,9 @@ export class Message extends DiscordRecord {
channel_id: string;
message_id: string;
} | undefined;
messageSnapshots: {
message: Message;
}[];
nick: unknown; // probably a string
nonce: string | undefined;
pinned: boolean;

View file

@ -163,7 +163,7 @@ export default definePlugin({
patches: [
{
find: "=!0,toolbar:",
find: ".controlButtonWrapper,",
replacement: {
match: /(?<=function (\i).{0,100}\()\i.Fragment,(?=.+?toolbar:\1\(\))/,
replace: "$self.ToolboxFragmentWrapper,"

View file

@ -33,8 +33,8 @@ export default definePlugin({
replace: "if(Vencord.Api.Notices.currentNotice)return false;$&"
},
{
match: /(?<=function \i\(\i\){)return null!=(\i)/,
replace: "if($1?.id==\"EquicordNotice\")return($1=null,Vencord.Api.Notices.nextNotice(),true);$&"
match: /(?<=function (\i)\(\i\){)return null!=(\i)(?=.+?NOTICE_DISMISS:\1)/,
replace: (m, _, notice) => `if(${notice}?.id=="EquicordNotice")return(${notice}=null,Vencord.Api.Notices.nextNotice(),true);${m}`
}
]
}

View file

@ -25,7 +25,7 @@ import { ImageInvisible, ImageVisible } from "@components/Icons";
import { Devs } from "@utils/constants";
import { classes } from "@utils/misc";
import definePlugin from "@utils/types";
import { MessageSnapshot } from "@vencord/discord-types";
import { Message } from "@vencord/discord-types";
import { ChannelStore } from "@webpack/common";
const KEY = "HideAttachments_HiddenIds";
@ -41,6 +41,8 @@ const saveHiddenMessages = (ids: Set<string>) => set(KEY, ids);
migratePluginSettings("HideMedia", "HideAttachments");
const hasMedia = (msg: Message) => msg.attachments.length > 0 || msg.embeds.length > 0 || msg.stickerItems.length > 0;
export default definePlugin({
name: "HideMedia",
description: "Hide attachments and embeds for individual messages via hover button",
@ -56,12 +58,7 @@ export default definePlugin({
}],
renderMessagePopoverButton(msg) {
// @ts-expect-error - discord-types lags behind discord.
const hasAttachmentsInShapshots = msg.messageSnapshots.some(
(snapshot: MessageSnapshot) => snapshot?.message.attachments.length
);
if (!msg.attachments.length && !msg.embeds.length && !msg.stickerItems.length && !hasAttachmentsInShapshots) return null;
if (!hasMedia(msg) && !msg.messageSnapshots.some(s => hasMedia(s.message))) return null;
const isHidden = hiddenMessages instanceof Set ? hiddenMessages.has(msg.id) : false;

View file

@ -84,14 +84,6 @@ export default definePlugin({
replace: "$&$self.BiteSizeReviewsButton({user:arguments[0].user}),"
}
},
{
find: ".MODAL,user:",
replacement: {
match: /children:\[(?=[^[]+?shouldShowTooltip:)/,
replace: "$&$self.BiteSizeReviewsButton({user:arguments[0].user}),"
}
},
// places like the user profile on the right in dms
{
find: ".SIDEBAR,shouldShowTooltip:",
replacement: {

View file

@ -36,8 +36,8 @@ export default definePlugin({
find: "#{intl::MESSAGE_UTILITIES_A11Y_LABEL}",
replacement: [
{
match: /(\i)=\i&&(!\i.+?)/,
replace: "$1=$2"
match: /(?<=(\i)=)\i(?=&&.+?isExpanded:\1)/,
replace: "true"
},
{
predicate: () => settings.store.noShiftDelete,

View file

@ -42,8 +42,8 @@ export default definePlugin({
{
find: ",BURST_REACTION_EFFECT_PLAY",
replacement: {
match: /(\i=>{.{50,100})(\i\(\i,\i\))>=\i/,
replace: "$1!$self.shouldPlayBurstReaction($2)"
match: /(?<=(\i)=\i=>{.+?)(\i\(\i,\i\))>=\i(?=\).+BURST_REACTION_EFFECT_PLAY:\1)/,
replace: "!$self.shouldPlayBurstReaction($2)"
}
},
{

View file

@ -20,17 +20,18 @@ import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/Co
import { ImageInvisible, ImageVisible } from "@components/Icons";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import { MessageSnapshot } from "@vencord/discord-types";
import { Channel, Message } from "@vencord/discord-types";
import { Constants, Menu, PermissionsBits, PermissionStore, RestAPI, UserStore } from "@webpack/common";
const EMBED_SUPPRESSED = 1 << 2;
const messageContextMenuPatch: NavContextMenuPatchCallback = (children, { channel, message: { author, messageSnapshots, embeds, flags, id: messageId } }) => {
const messageContextMenuPatch: NavContextMenuPatchCallback = (
children,
{ channel, message: { author, messageSnapshots, embeds, flags, id: messageId } }: { channel: Channel; message: Message; }
) => {
const isEmbedSuppressed = (flags & EMBED_SUPPRESSED) !== 0;
const hasEmbedsInSnapshots = messageSnapshots.some(
(snapshot: MessageSnapshot) => snapshot?.message.embeds.length
);
const hasEmbedsInSnapshots = messageSnapshots.some(s => s.message.embeds.length);
if (!isEmbedSuppressed && !embeds.length && !hasEmbedsInSnapshots) return;