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

This commit is contained in:
thororen1234 2025-03-21 12:41:43 -04:00
commit 252c4929cc
No known key found for this signature in database
8 changed files with 23 additions and 15 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "equicord", "name": "equicord",
"private": "true", "private": "true",
"version": "1.11.6", "version": "1.11.7",
"description": "The other cutest Discord client mod", "description": "The other cutest Discord client mod",
"homepage": "https://github.com/Equicord/Equicord#readme", "homepage": "https://github.com/Equicord/Equicord#readme",
"bugs": { "bugs": {

View file

@ -31,6 +31,7 @@ export const commands = {} as Record<string, Command>;
// hack for plugins being evaluated before we can grab these from webpack // hack for plugins being evaluated before we can grab these from webpack
const OptPlaceholder = Symbol("OptionalMessageOption") as any as Option; const OptPlaceholder = Symbol("OptionalMessageOption") as any as Option;
const ReqPlaceholder = Symbol("RequiredMessageOption") as any as Option; const ReqPlaceholder = Symbol("RequiredMessageOption") as any as Option;
/** /**
* Optional message option named "message" you can use in commands. * Optional message option named "message" you can use in commands.
* Used in "tableflip" or "shrug" * Used in "tableflip" or "shrug"
@ -44,8 +45,8 @@ export let OptionalMessageOption: Option = OptPlaceholder;
*/ */
export let RequiredMessageOption: Option = ReqPlaceholder; export let RequiredMessageOption: Option = ReqPlaceholder;
// Discords command list has random gaps for some reason, which can cause issues while rendering the commands // Discord's command list has random gaps for some reason, which can cause issues while rendering the commands
// add this offset too every added command to keep them unique // Add this offset to every added command to keep them unique
let commandIdOffset: number; let commandIdOffset: number;
export const _init = function (cmds: Command[]) { export const _init = function (cmds: Command[]) {
@ -53,7 +54,7 @@ export const _init = function (cmds: Command[]) {
BUILT_IN = cmds; BUILT_IN = cmds;
OptionalMessageOption = cmds.find(c => (c.untranslatedName || c.displayName) === "shrug")!.options![0]; OptionalMessageOption = cmds.find(c => (c.untranslatedName || c.displayName) === "shrug")!.options![0];
RequiredMessageOption = cmds.find(c => (c.untranslatedName || c.displayName) === "me")!.options![0]; RequiredMessageOption = cmds.find(c => (c.untranslatedName || c.displayName) === "me")!.options![0];
commandIdOffset = Math.abs(BUILT_IN.map(x => +x.id!).toSorted((x, y) => x - y)[0]) - BUILT_IN.length; commandIdOffset = Math.abs(BUILT_IN.map(x => Number(x.id)).sort((x, y) => x - y)[0]) - BUILT_IN.length;
} catch (e) { } catch (e) {
new Logger("CommandsAPI").error("Failed to load CommandsApi", e, " - cmds is", cmds); new Logger("CommandsAPI").error("Failed to load CommandsApi", e, " - cmds is", cmds);
} }

View file

@ -73,8 +73,8 @@ export default definePlugin({
group: true, group: true,
replacement: [ replacement: [
{ {
match: /(?<=\.AVATAR_SIZE\).{0,100};)(?=return)/, match: /let{speaking:\i/,
replace: "$self.useAccountPanelRef();" replace: "$self.useAccountPanelRef();$&"
}, },
{ {
match: /(\.AVATAR,children:.+?renderPopout:(\i)=>){(.+?)}(?=,position)(?<=currentUser:(\i).+?)/, match: /(\.AVATAR,children:.+?renderPopout:(\i)=>){(.+?)}(?=,position)(?<=currentUser:(\i).+?)/,

View file

@ -44,15 +44,15 @@ export default definePlugin({
find: "#{intl::GUILD_OWNER}),children:", find: "#{intl::GUILD_OWNER}),children:",
replacement: { replacement: {
match: /(\.CUSTOM_STATUS.+?animate:)\i/, match: /(\.CUSTOM_STATUS.+?animate:)\i/,
replace: (_, rest) => `${rest}!0` replace: "$1!0"
} }
}, },
{ {
// Guild Banner // Guild Banner
find: ".animatedBannerHoverLayer,onMouseEnter:", find: ".animatedBannerHoverLayer,onMouseEnter:",
replacement: { replacement: {
match: /(?<=guildBanner:\i,animate:)\i(?=,isRefreshEnabled:)/, match: /(\.headerContent.+?guildBanner:\i,animate:)\i/,
replace: "!0" replace: "$1!0"
} }
} }
] ]

View file

@ -99,7 +99,7 @@ export default definePlugin({
}, },
// Current user area, at bottom of channels/dm list // Current user area, at bottom of channels/dm list
{ {
find: "renderAvatarWithPopout(){", find: "#{intl::ACCOUNT_SPEAKING_WHILE_MUTED}",
replacement: [ replacement: [
// Use Decor avatar decoration hook // Use Decor avatar decoration hook
{ {

View file

@ -149,6 +149,12 @@ export default definePlugin({
renderChatBarButton: ChatBarIcon, renderChatBarButton: ChatBarIcon,
colorCodeFromNumber(color: number): string {
return `#${[color >> 16, color >> 8, color]
.map(x => (x & 0xFF).toString(16))
.join("")}`;
},
// Gets the Embed of a Link // Gets the Embed of a Link
async getEmbed(url: URL): Promise<Object | {}> { async getEmbed(url: URL): Promise<Object | {}> {
const { body } = await RestAPI.post({ const { body } = await RestAPI.post({
@ -157,6 +163,8 @@ export default definePlugin({
urls: [url] urls: [url]
} }
}); });
// The endpoint returns the color as a number, but Discord expects a string
body.embeds[0].color = this.colorCodeFromNumber(body.embeds[0].color);
return await body.embeds[0]; return await body.embeds[0];
}, },
@ -166,7 +174,7 @@ export default definePlugin({
message.embeds.push({ message.embeds.push({
type: "rich", type: "rich",
rawTitle: "Decrypted Message", rawTitle: "Decrypted Message",
color: "0x45f5f5", color: "#45f5f5",
rawDescription: revealed, rawDescription: revealed,
footer: { footer: {
text: "Made with ❤️ by c0dine and Sammy!", text: "Made with ❤️ by c0dine and Sammy!",

View file

@ -85,8 +85,7 @@ export default definePlugin({
const colorString = context?.author?.colorString; const colorString = context?.author?.colorString;
const color = calculateNameColorForUser(userId); const color = calculateNameColorForUser(userId);
// color preview in role settings // Color preview in role settings
// channel.id is undefined in the role menu
if (context?.message?.channel_id === "1337" && userId === "313337") if (context?.message?.channel_id === "1337" && userId === "313337")
return colorString; return colorString;

View file

@ -63,10 +63,10 @@ export default definePlugin({
patches: [ patches: [
{ {
find: "#{intl::BLOCKED_MESSAGE_COUNT}}", find: ".__invalid_blocked,",
replacement: [ replacement: [
{ {
match: /let\{[^}]*collapsedReason[^}]*\}/, match: /let{expanded:\i,[^}]*?collapsedReason[^}]*}/,
replace: "if($self.shouldHide(arguments[0]))return null;$&" replace: "if($self.shouldHide(arguments[0]))return null;$&"
} }
] ]