mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-07 13:43:03 -04:00
Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
54c3b33315
12 changed files with 57 additions and 48 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "equicord",
|
"name": "equicord",
|
||||||
"private": "true",
|
"private": "true",
|
||||||
"version": "1.9.9",
|
"version": "1.10.1",
|
||||||
"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": {
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { Logger } from "@utils/Logger";
|
||||||
import { makeCodeblock } from "@utils/text";
|
import { makeCodeblock } from "@utils/text";
|
||||||
|
|
||||||
import { sendBotMessage } from "./commandHelpers";
|
import { sendBotMessage } from "./commandHelpers";
|
||||||
|
@ -46,10 +47,10 @@ export let RequiredMessageOption: Option = ReqPlaceholder;
|
||||||
export const _init = function (cmds: Command[]) {
|
export const _init = function (cmds: Command[]) {
|
||||||
try {
|
try {
|
||||||
BUILT_IN = cmds;
|
BUILT_IN = cmds;
|
||||||
OptionalMessageOption = cmds.find(c => c.name === "shrug")!.options![0];
|
OptionalMessageOption = cmds.find(c => (c.untranslatedName || c.displayName) === "shrug")!.options![0];
|
||||||
RequiredMessageOption = cmds.find(c => c.name === "me")!.options![0];
|
RequiredMessageOption = cmds.find(c => (c.untranslatedName || c.displayName) === "me")!.options![0];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Failed to load CommandsApi");
|
new Logger("CommandsAPI").error("Failed to load CommandsApi", e, " - cmds is", cmds);
|
||||||
}
|
}
|
||||||
return cmds;
|
return cmds;
|
||||||
} as never;
|
} as never;
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
[class*="profileBadges"] {
|
|
||||||
flex: none;
|
|
||||||
}
|
|
|
@ -16,8 +16,6 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import "./fixBadgeOverflow.css";
|
|
||||||
|
|
||||||
import { _getBadges, BadgePosition, BadgeUserArgs, ProfileBadge } from "@api/Badges";
|
import { _getBadges, BadgePosition, BadgeUserArgs, ProfileBadge } from "@api/Badges";
|
||||||
import DonateButton from "@components/DonateButton";
|
import DonateButton from "@components/DonateButton";
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
|
@ -94,7 +92,7 @@ export default definePlugin({
|
||||||
replace: "...$1.props,$& $1.image??"
|
replace: "...$1.props,$& $1.image??"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /(?<=text:(\i)\.description,.{0,50})children:/,
|
match: /(?<=text:(\i)\.description,.{0,200})children:/,
|
||||||
replace: "children:$1.component ? $self.renderBadgeComponent({ ...$1 }) :"
|
replace: "children:$1.component ? $self.renderBadgeComponent({ ...$1 }) :"
|
||||||
},
|
},
|
||||||
// conditionally override their onClick with badge.onClick if it exists
|
// conditionally override their onClick with badge.onClick if it exists
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { OnlineMemberCountStore } from "./OnlineMemberCountStore";
|
||||||
export function MemberCount({ isTooltip, tooltipGuildId }: { isTooltip?: true; tooltipGuildId?: string; }) {
|
export function MemberCount({ isTooltip, tooltipGuildId }: { isTooltip?: true; tooltipGuildId?: string; }) {
|
||||||
const currentChannel = useStateFromStores([SelectedChannelStore], () => getCurrentChannel());
|
const currentChannel = useStateFromStores([SelectedChannelStore], () => getCurrentChannel());
|
||||||
|
|
||||||
const guildId = isTooltip ? tooltipGuildId! : currentChannel.guild_id;
|
const guildId = isTooltip ? tooltipGuildId! : currentChannel?.guild_id;
|
||||||
|
|
||||||
const totalCount = useStateFromStores(
|
const totalCount = useStateFromStores(
|
||||||
[GuildMemberCountStore],
|
[GuildMemberCountStore],
|
||||||
|
@ -33,7 +33,7 @@ export function MemberCount({ isTooltip, tooltipGuildId }: { isTooltip?: true; t
|
||||||
|
|
||||||
const threadGroups = useStateFromStores(
|
const threadGroups = useStateFromStores(
|
||||||
[ThreadMemberListStore],
|
[ThreadMemberListStore],
|
||||||
() => ThreadMemberListStore.getMemberListSections(currentChannel.id)
|
() => ThreadMemberListStore.getMemberListSections(currentChannel?.id)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!isTooltip && (groups.length >= 1 || groups[0].id !== "unknown")) {
|
if (!isTooltip && (groups.length >= 1 || groups[0].id !== "unknown")) {
|
||||||
|
|
|
@ -15,8 +15,8 @@ export const OnlineMemberCountStore = proxyLazy(() => {
|
||||||
const onlineMemberMap = new Map<string, number>();
|
const onlineMemberMap = new Map<string, number>();
|
||||||
|
|
||||||
class OnlineMemberCountStore extends Flux.Store {
|
class OnlineMemberCountStore extends Flux.Store {
|
||||||
getCount(guildId: string) {
|
getCount(guildId?: string) {
|
||||||
return onlineMemberMap.get(guildId);
|
return onlineMemberMap.get(guildId!);
|
||||||
}
|
}
|
||||||
|
|
||||||
async _ensureCount(guildId: string) {
|
async _ensureCount(guildId: string) {
|
||||||
|
@ -25,8 +25,8 @@ export const OnlineMemberCountStore = proxyLazy(() => {
|
||||||
await PrivateChannelsStore.preload(guildId, GuildChannelStore.getDefaultChannel(guildId).id);
|
await PrivateChannelsStore.preload(guildId, GuildChannelStore.getDefaultChannel(guildId).id);
|
||||||
}
|
}
|
||||||
|
|
||||||
ensureCount(guildId: string) {
|
ensureCount(guildId?: string) {
|
||||||
if (onlineMemberMap.has(guildId)) return;
|
if (!guildId || onlineMemberMap.has(guildId)) return;
|
||||||
|
|
||||||
preloadQueue.push(() =>
|
preloadQueue.push(() =>
|
||||||
this._ensureCount(guildId)
|
this._ensureCount(guildId)
|
||||||
|
|
|
@ -28,12 +28,12 @@ import { FluxStore } from "@webpack/types";
|
||||||
|
|
||||||
import { MemberCount } from "./MemberCount";
|
import { MemberCount } from "./MemberCount";
|
||||||
|
|
||||||
export const GuildMemberCountStore = findStoreLazy("GuildMemberCountStore") as FluxStore & { getMemberCount(guildId: string): number | null; };
|
export const GuildMemberCountStore = findStoreLazy("GuildMemberCountStore") as FluxStore & { getMemberCount(guildId?: string): number | null; };
|
||||||
export const ChannelMemberStore = findStoreLazy("ChannelMemberStore") as FluxStore & {
|
export const ChannelMemberStore = findStoreLazy("ChannelMemberStore") as FluxStore & {
|
||||||
getProps(guildId: string, channelId: string): { groups: { count: number; id: string; }[]; };
|
getProps(guildId?: string, channelId?: string): { groups: { count: number; id: string; }[]; };
|
||||||
};
|
};
|
||||||
export const ThreadMemberListStore = findStoreLazy("ThreadMemberListStore") as FluxStore & {
|
export const ThreadMemberListStore = findStoreLazy("ThreadMemberListStore") as FluxStore & {
|
||||||
getMemberListSections(channelId: string): { [sectionId: string]: { sectionId: string; userIds: string[]; }; };
|
getMemberListSections(channelId?: string): { [sectionId: string]: { sectionId: string; userIds: string[]; }; };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,3 +9,8 @@
|
||||||
.vc-mentionAvatars-role-icon {
|
.vc-mentionAvatars-role-icon {
|
||||||
margin: 0 2px 0.2rem 4px;
|
margin: 0 2px 0.2rem 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** don't display inside the ServerInfo modal owner mention */
|
||||||
|
.vc-gp-owner .vc-mentionAvatars-icon {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ export default definePlugin({
|
||||||
patches: [
|
patches: [
|
||||||
// Chat Mentions
|
// Chat Mentions
|
||||||
{
|
{
|
||||||
find: 'location:"UserMention',
|
find: ".USER_MENTION)",
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /onContextMenu:\i,color:\i,\.\.\.\i(?=,children:)(?<=user:(\i),channel:(\i).{0,500}?)/,
|
match: /onContextMenu:\i,color:\i,\.\.\.\i(?=,children:)(?<=user:(\i),channel:(\i).{0,500}?)/,
|
||||||
|
|
|
@ -86,7 +86,7 @@ interface NotificationObject {
|
||||||
title: string;
|
title: string;
|
||||||
content: string;
|
content: string;
|
||||||
useBase64Icon: boolean;
|
useBase64Icon: boolean;
|
||||||
icon: ArrayBuffer | string;
|
icon: string;
|
||||||
sourceApp: string;
|
sourceApp: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,23 +320,29 @@ function shouldIgnoreForChannelType(channel: Channel) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendMsgNotif(titleString: string, content: string, message: Message) {
|
function sendMsgNotif(titleString: string, content: string, message: Message) {
|
||||||
fetch(`https://cdn.discordapp.com/avatars/${message.author.id}/${message.author.avatar}.png?size=128`).then(response => response.arrayBuffer()).then(result => {
|
fetch(`https://cdn.discordapp.com/avatars/${message.author.id}/${message.author.avatar}.png?size=128`)
|
||||||
const msgData: NotificationObject = {
|
.then(response => response.blob())
|
||||||
type: 1,
|
.then(blob => new Promise<string>(resolve => {
|
||||||
timeout: settings.store.lengthBasedTimeout ? calculateTimeout(content) : settings.store.timeout,
|
const r = new FileReader();
|
||||||
height: calculateHeight(content),
|
r.onload = () => resolve((r.result as string).split(",")[1]);
|
||||||
opacity: settings.store.opacity,
|
r.readAsDataURL(blob);
|
||||||
volume: settings.store.volume,
|
})).then(result => {
|
||||||
audioPath: settings.store.soundPath,
|
const msgData: NotificationObject = {
|
||||||
title: titleString,
|
type: 1,
|
||||||
content: content,
|
timeout: settings.store.lengthBasedTimeout ? calculateTimeout(content) : settings.store.timeout,
|
||||||
useBase64Icon: true,
|
height: calculateHeight(content),
|
||||||
icon: new TextDecoder().decode(result),
|
opacity: settings.store.opacity,
|
||||||
sourceApp: "Vencord"
|
volume: settings.store.volume,
|
||||||
};
|
audioPath: settings.store.soundPath,
|
||||||
|
title: titleString,
|
||||||
|
content: content,
|
||||||
|
useBase64Icon: true,
|
||||||
|
icon: result,
|
||||||
|
sourceApp: "Vencord"
|
||||||
|
};
|
||||||
|
|
||||||
sendToOverlay(msgData);
|
sendToOverlay(msgData);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendOtherNotif(content: string, titleString: string) {
|
function sendOtherNotif(content: string, titleString: string) {
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
import { MessageObject } from "@api/MessageEvents";
|
import { MessageObject } from "@api/MessageEvents";
|
||||||
import { ChannelStore, ComponentDispatch, Constants, FluxDispatcher, GuildStore, InviteActions, MaskedLink, MessageActions, ModalImageClasses, PrivateChannelsStore, RestAPI, SelectedChannelStore, SelectedGuildStore, UserProfileActions, UserProfileStore, UserSettingsActionCreators, UserUtils } from "@webpack/common";
|
import { ChannelStore, ComponentDispatch, Constants, FluxDispatcher, GuildStore, InviteActions, MaskedLink, MessageActions, ModalImageClasses, PrivateChannelsStore, RestAPI, SelectedChannelStore, SelectedGuildStore, UserProfileActions, UserProfileStore, UserSettingsActionCreators, UserUtils } from "@webpack/common";
|
||||||
import { Guild, Message, User } from "discord-types/general";
|
import { Channel, Guild, Message, User } from "discord-types/general";
|
||||||
|
|
||||||
import { ImageModal, ModalRoot, ModalSize, openModal } from "./modal";
|
import { ImageModal, ModalRoot, ModalSize, openModal } from "./modal";
|
||||||
|
|
||||||
|
@ -54,12 +54,12 @@ export async function openInviteModal(code: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCurrentChannel() {
|
export function getCurrentChannel(): Channel | undefined {
|
||||||
return ChannelStore.getChannel(SelectedChannelStore.getChannelId());
|
return ChannelStore.getChannel(SelectedChannelStore.getChannelId());
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCurrentGuild(): Guild | undefined {
|
export function getCurrentGuild(): Guild | undefined {
|
||||||
return GuildStore.getGuild(getCurrentChannel()?.guild_id);
|
return GuildStore.getGuild(getCurrentChannel()?.guild_id!);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function openPrivateChannel(userId: string) {
|
export function openPrivateChannel(userId: string) {
|
||||||
|
|
18
src/webpack/common/types/components.d.ts
vendored
18
src/webpack/common/types/components.d.ts
vendored
|
@ -92,7 +92,7 @@ export type Tooltip = ComponentType<{
|
||||||
/** Tooltip.Colors.BLACK */
|
/** Tooltip.Colors.BLACK */
|
||||||
color?: string;
|
color?: string;
|
||||||
/** TooltipPositions.TOP */
|
/** TooltipPositions.TOP */
|
||||||
position?: string;
|
position?: PopoutPosition;
|
||||||
|
|
||||||
tooltipClassName?: string;
|
tooltipClassName?: string;
|
||||||
tooltipContentClassName?: string;
|
tooltipContentClassName?: string;
|
||||||
|
@ -111,7 +111,7 @@ export type TooltipContainer = ComponentType<PropsWithChildren<{
|
||||||
/** Tooltip.Colors.BLACK */
|
/** Tooltip.Colors.BLACK */
|
||||||
color?: string;
|
color?: string;
|
||||||
/** TooltipPositions.TOP */
|
/** TooltipPositions.TOP */
|
||||||
position?: string;
|
position?: PopoutPosition;
|
||||||
spacing?: number;
|
spacing?: number;
|
||||||
|
|
||||||
className?: string;
|
className?: string;
|
||||||
|
@ -252,7 +252,7 @@ export type Select = ComponentType<PropsWithChildren<{
|
||||||
look?: 0 | 1;
|
look?: 0 | 1;
|
||||||
className?: string;
|
className?: string;
|
||||||
popoutClassName?: string;
|
popoutClassName?: string;
|
||||||
popoutPosition?: "top" | "left" | "right" | "bottom" | "center" | "window_center";
|
popoutPosition?: PopoutPosition;
|
||||||
optionClassName?: string;
|
optionClassName?: string;
|
||||||
|
|
||||||
autoFocus?: boolean;
|
autoFocus?: boolean;
|
||||||
|
@ -293,7 +293,7 @@ export type SearchableSelect = ComponentType<PropsWithChildren<{
|
||||||
className?: string;
|
className?: string;
|
||||||
popoutClassName?: string;
|
popoutClassName?: string;
|
||||||
wrapperClassName?: string;
|
wrapperClassName?: string;
|
||||||
popoutPosition?: "top" | "left" | "right" | "bottom" | "center" | "window_center";
|
popoutPosition?: PopoutPosition;
|
||||||
optionClassName?: string;
|
optionClassName?: string;
|
||||||
|
|
||||||
autoFocus?: boolean;
|
autoFocus?: boolean;
|
||||||
|
@ -376,6 +376,8 @@ declare enum PopoutAnimation {
|
||||||
FADE = "4"
|
FADE = "4"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PopoutPosition = "top" | "bottom" | "left" | "right" | "center" | "window_center";
|
||||||
|
|
||||||
export type Popout = ComponentType<{
|
export type Popout = ComponentType<{
|
||||||
children(
|
children(
|
||||||
thing: {
|
thing: {
|
||||||
|
@ -387,7 +389,7 @@ export type Popout = ComponentType<{
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
isShown: boolean;
|
isShown: boolean;
|
||||||
position: string;
|
position: PopoutPosition;
|
||||||
}
|
}
|
||||||
): ReactNode;
|
): ReactNode;
|
||||||
shouldShow?: boolean;
|
shouldShow?: boolean;
|
||||||
|
@ -395,7 +397,7 @@ export type Popout = ComponentType<{
|
||||||
closePopout(): void;
|
closePopout(): void;
|
||||||
isPositioned: boolean;
|
isPositioned: boolean;
|
||||||
nudge: number;
|
nudge: number;
|
||||||
position: string;
|
position: PopoutPosition;
|
||||||
setPopoutRef(ref: any): void;
|
setPopoutRef(ref: any): void;
|
||||||
updatePosition(): void;
|
updatePosition(): void;
|
||||||
}): ReactNode;
|
}): ReactNode;
|
||||||
|
@ -404,13 +406,13 @@ export type Popout = ComponentType<{
|
||||||
onRequestClose?(): void;
|
onRequestClose?(): void;
|
||||||
|
|
||||||
/** "center" and others */
|
/** "center" and others */
|
||||||
align?: string;
|
align?: "left" | "right" | "center";
|
||||||
/** Popout.Animation */
|
/** Popout.Animation */
|
||||||
animation?: PopoutAnimation;
|
animation?: PopoutAnimation;
|
||||||
autoInvert?: boolean;
|
autoInvert?: boolean;
|
||||||
nudgeAlignIntoViewport?: boolean;
|
nudgeAlignIntoViewport?: boolean;
|
||||||
/** "bottom" and others */
|
/** "bottom" and others */
|
||||||
position?: string;
|
position?: PopoutPosition;
|
||||||
positionKey?: string;
|
positionKey?: string;
|
||||||
spacing?: number;
|
spacing?: number;
|
||||||
}> & {
|
}> & {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue