From 7d91dea822e3b09769cafc59c215c9c0ba17284c Mon Sep 17 00:00:00 2001
From: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
Date: Mon, 13 May 2024 23:15:16 -0300
Subject: [PATCH] Merge branch 'dev' into immediate-finds
---
src/plugins/betterNotes/index.tsx | 12 ++-
src/plugins/betterSessions/index.tsx | 4 +-
src/plugins/emoteCloner/index.tsx | 11 +--
src/plugins/fakeNitro/index.tsx | 13 ++++
src/plugins/friendInvites/index.ts | 4 +-
src/plugins/invisibleChat.desktop/index.tsx | 4 +-
src/plugins/messageLinkEmbeds/index.tsx | 3 +-
.../messageLogger/deleteStyleOverlay.css | 2 +-
src/plugins/messageLogger/deleteStyleText.css | 8 +-
src/plugins/mutualGroupDMs/index.tsx | 4 +-
src/plugins/pauseInvitesForever/index.tsx | 73 ++++++++++---------
src/plugins/unsuppressEmbeds/index.tsx | 4 +-
src/plugins/validUser/index.tsx | 2 +-
src/plugins/voiceMessages/index.tsx | 4 +-
src/plugins/whoReacted/index.tsx | 4 +-
src/utils/constants.ts | 4 +
src/utils/discord.tsx | 4 +-
17 files changed, 89 insertions(+), 71 deletions(-)
diff --git a/src/plugins/betterNotes/index.tsx b/src/plugins/betterNotes/index.tsx
index c83994869..6309146c6 100644
--- a/src/plugins/betterNotes/index.tsx
+++ b/src/plugins/betterNotes/index.tsx
@@ -61,7 +61,7 @@ export default definePlugin({
find: ".popularApplicationCommandIds,",
replacement: {
match: /lastSection:(!?\i)}\),/,
- replace: "$&$self.patchPadding($1),"
+ replace: "$&$self.patchPadding({lastSection:$1}),"
}
}
],
@@ -81,12 +81,10 @@ export default definePlugin({
}
},
- patchPadding(lastSection: any) {
- if (!lastSection) return;
+ patchPadding: ErrorBoundary.wrap(({ lastSection }) => {
+ if (!lastSection) return null;
return (
-
-
-
+
);
- }
+ })
});
diff --git a/src/plugins/betterSessions/index.tsx b/src/plugins/betterSessions/index.tsx
index 7fdaff971..4692872a0 100644
--- a/src/plugins/betterSessions/index.tsx
+++ b/src/plugins/betterSessions/index.tsx
@@ -22,7 +22,7 @@ import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { findByProps, findExportedComponent, findStore } from "@webpack";
-import { React, RestAPI, Tooltip } from "@webpack/common";
+import { Constants, React, RestAPI, Tooltip } from "@webpack/common";
import { RenameButton } from "./components/RenameButton";
import { Session, SessionInfo } from "./types";
@@ -168,7 +168,7 @@ export default definePlugin({
async checkNewSessions() {
const data = await RestAPI.get({
- url: "/auth/sessions"
+ url: Constants.Endpoints.AUTH_SESSIONS
});
for (const session of data.body.user_sessions) {
diff --git a/src/plugins/emoteCloner/index.tsx b/src/plugins/emoteCloner/index.tsx
index 2c95317b2..4321b8146 100644
--- a/src/plugins/emoteCloner/index.tsx
+++ b/src/plugins/emoteCloner/index.tsx
@@ -24,7 +24,7 @@ import { Margins } from "@utils/margins";
import { ModalContent, ModalHeader, ModalRoot, openModalLazy } from "@utils/modal";
import definePlugin from "@utils/types";
import { findByProps, findStore } from "@webpack";
-import { EmojiStore, FluxDispatcher, Forms, GuildStore, Menu, PermissionsBits, PermissionStore, React, RestAPI, Toasts, Tooltip, UserStore } from "@webpack/common";
+import { Constants, EmojiStore, FluxDispatcher, Forms, GuildStore, Menu, PermissionsBits, PermissionStore, React, RestAPI, Toasts, Tooltip, UserStore } from "@webpack/common";
import { Promisable } from "type-fest";
const StickersStore = findStore("StickersStore");
@@ -64,7 +64,7 @@ async function fetchSticker(id: string) {
if (cached) return cached;
const { body } = await RestAPI.get({
- url: `/stickers/${id}`
+ url: Constants.Endpoints.STICKER(id)
});
FluxDispatcher.dispatch({
@@ -83,7 +83,7 @@ async function cloneSticker(guildId: string, sticker: Sticker) {
data.append("file", await fetchBlob(getUrl(sticker)));
const { body } = await RestAPI.post({
- url: `/guilds/${guildId}/stickers`,
+ url: Constants.Endpoints.GUILD_STICKER_PACKS(guildId),
body: data,
});
@@ -322,8 +322,9 @@ const messageContextMenuPatch: NavContextMenuPatchCallback = (children, props) =
switch (favoriteableType) {
case "emoji":
const match = props.message.content.match(RegExp(`|https://cdn\\.discordapp\\.com/emojis/${favoriteableId}\\.`));
- if (!match) return;
- const name = match[1] ?? "FakeNitroEmoji";
+ const reaction = props.message.reactions.find(reaction => reaction.emoji.id === favoriteableId);
+ if (!match && !reaction) return;
+ const name = (match && match[1]) ?? reaction?.emoji.name ?? "FakeNitroEmoji";
return buildMenuItem("Emoji", () => ({
id: favoriteableId,
diff --git a/src/plugins/fakeNitro/index.tsx b/src/plugins/fakeNitro/index.tsx
index 829b046fd..112c18ace 100644
--- a/src/plugins/fakeNitro/index.tsx
+++ b/src/plugins/fakeNitro/index.tsx
@@ -39,6 +39,7 @@ const StickerStore = findStore("StickersStore") as {
const UserSettingsProtoStore = findStore("UserSettingsProtoStore");
const ProtoUtils = findByProps("BINARY_READ_OPTIONS");
+const RoleSubscriptionEmojiUtils = findByProps("isUnusableRoleSubscriptionEmoji");
function searchProtoClassField(localName: string, protoClass: any) {
const field = protoClass?.fields?.find((field: any) => field.localName === localName);
@@ -407,6 +408,15 @@ export default definePlugin({
match: /canUseCustomNotificationSounds:function\(\i\){/,
replace: "$&return true;"
}
+ },
+ // Allows the usage of subscription-locked emojis
+ {
+ find: "isUnusableRoleSubscriptionEmoji:function",
+ replacement: {
+ match: /isUnusableRoleSubscriptionEmoji:function/,
+ // replace the original export with a func that always returns false and alias the original
+ replace: "isUnusableRoleSubscriptionEmoji:()=>()=>false,isUnusableRoleSubscriptionEmojiOriginal:function"
+ }
}
],
@@ -803,6 +813,9 @@ export default definePlugin({
if (e.require_colons === false) return true;
if (e.available === false) return false;
+ const isUnusableRoleSubEmoji = RoleSubscriptionEmojiUtils.isUnusableRoleSubscriptionEmojiOriginal ?? RoleSubscriptionEmojiUtils.isUnusableRoleSubscriptionEmoji;
+ if (isUnusableRoleSubEmoji(e, this.guildId)) return false;
+
if (this.canUseEmotes)
return e.guildId === this.guildId || hasExternalEmojiPerms(channelId);
else
diff --git a/src/plugins/friendInvites/index.ts b/src/plugins/friendInvites/index.ts
index eb293b663..41755cca7 100644
--- a/src/plugins/friendInvites/index.ts
+++ b/src/plugins/friendInvites/index.ts
@@ -20,7 +20,7 @@ import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption,
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import { findByProps } from "@webpack";
-import { RestAPI, UserStore } from "@webpack/common";
+import { Constants, RestAPI, UserStore } from "@webpack/common";
const FriendInvites = findByProps("createFriendInvite");
const { uuid4 } = findByProps("uuid4");
@@ -58,7 +58,7 @@ export default definePlugin({
if (uses === 1) {
const random = uuid4();
const { body: { invite_suggestions } } = await RestAPI.post({
- url: "/friend-finder/find-friends",
+ url: Constants.Endpoints.FRIEND_FINDER,
body: {
modified_contacts: {
[random]: [1, "", ""]
diff --git a/src/plugins/invisibleChat.desktop/index.tsx b/src/plugins/invisibleChat.desktop/index.tsx
index fcb0af712..3dfe51e77 100644
--- a/src/plugins/invisibleChat.desktop/index.tsx
+++ b/src/plugins/invisibleChat.desktop/index.tsx
@@ -23,7 +23,7 @@ import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import { getStegCloak } from "@utils/dependencies";
import definePlugin, { OptionType } from "@utils/types";
-import { ChannelStore, FluxDispatcher, RestAPI, Tooltip } from "@webpack/common";
+import { ChannelStore, Constants, FluxDispatcher, RestAPI, Tooltip } from "@webpack/common";
import { Message } from "discord-types/general";
import { buildDecModal } from "./components/DecryptionModal";
@@ -153,7 +153,7 @@ export default definePlugin({
// Gets the Embed of a Link
async getEmbed(url: URL): Promise