diff --git a/package.json b/package.json index 65a2f4512..e65e1b0a7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vencord", "private": "true", - "version": "1.9.9", + "version": "1.10.1", "description": "The cutest Discord client mod", "homepage": "https://github.com/Vendicated/Vencord#readme", "bugs": { diff --git a/src/api/Commands/index.ts b/src/api/Commands/index.ts index ef4db171c..e5803ba02 100644 --- a/src/api/Commands/index.ts +++ b/src/api/Commands/index.ts @@ -16,6 +16,7 @@ * along with this program. If not, see . */ +import { Logger } from "@utils/Logger"; import { makeCodeblock } from "@utils/text"; import { sendBotMessage } from "./commandHelpers"; @@ -46,10 +47,10 @@ export let RequiredMessageOption: Option = ReqPlaceholder; export const _init = function (cmds: Command[]) { try { BUILT_IN = cmds; - OptionalMessageOption = cmds.find(c => c.name === "shrug")!.options![0]; - RequiredMessageOption = cmds.find(c => c.name === "me")!.options![0]; + OptionalMessageOption = cmds.find(c => (c.untranslatedName || c.displayName) === "shrug")!.options![0]; + RequiredMessageOption = cmds.find(c => (c.untranslatedName || c.displayName) === "me")!.options![0]; } catch (e) { - console.error("Failed to load CommandsApi"); + new Logger("CommandsAPI").error("Failed to load CommandsApi", e, " - cmds is", cmds); } return cmds; } as never; @@ -138,6 +139,8 @@ export function registerCommand(command: C, plugin: string) { throw new Error(`Command '${command.name}' already exists.`); command.isVencordCommand = true; + command.untranslatedName ??= command.name; + command.untranslatedDescription ??= command.description; command.id ??= `-${BUILT_IN.length + 1}`; command.applicationId ??= "-1"; // BUILT_IN; command.type ??= ApplicationCommandType.CHAT_INPUT; diff --git a/src/api/Commands/types.ts b/src/api/Commands/types.ts index bd349e250..70b73775a 100644 --- a/src/api/Commands/types.ts +++ b/src/api/Commands/types.ts @@ -93,8 +93,10 @@ export interface Command { isVencordCommand?: boolean; name: string; + untranslatedName?: string; displayName?: string; description: string; + untranslatedDescription?: string; displayDescription?: string; options?: Option[]; diff --git a/src/plugins/_api/badges/fixBadgeOverflow.css b/src/plugins/_api/badges/fixBadgeOverflow.css deleted file mode 100644 index 348d0ff38..000000000 --- a/src/plugins/_api/badges/fixBadgeOverflow.css +++ /dev/null @@ -1,3 +0,0 @@ -[class*="profileBadges"] { - flex: none; -} diff --git a/src/plugins/_api/badges/index.tsx b/src/plugins/_api/badges/index.tsx index cf00a0e29..c44d98b90 100644 --- a/src/plugins/_api/badges/index.tsx +++ b/src/plugins/_api/badges/index.tsx @@ -16,8 +16,6 @@ * along with this program. If not, see . */ -import "./fixBadgeOverflow.css"; - import { _getBadges, BadgePosition, BadgeUserArgs, ProfileBadge } from "@api/Badges"; import DonateButton from "@components/DonateButton"; import ErrorBoundary from "@components/ErrorBoundary"; @@ -79,7 +77,7 @@ export default definePlugin({ 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 }) :" }, // conditionally override their onClick with badge.onClick if it exists diff --git a/src/plugins/dearrow/index.tsx b/src/plugins/dearrow/index.tsx index 10175c846..b7e90e096 100644 --- a/src/plugins/dearrow/index.tsx +++ b/src/plugins/dearrow/index.tsx @@ -78,7 +78,7 @@ async function embedDidMount(this: Component) { const replacementProxyURL = `https://dearrow-thumb.ajay.app/api/v1/getThumbnail?videoID=${videoId}&time=${thumbnails[0].timestamp}`; embed.dearrow.oldThumb = dearrowByDefault ? embed.thumbnail.proxyURL : replacementProxyURL; - if (embed.thumbnail.proxyURL) embed.thumbnail.proxyURL = replacementProxyURL; + if (dearrowByDefault) embed.thumbnail.proxyURL = replacementProxyURL; } this.forceUpdate(); diff --git a/src/plugins/memberCount/MemberCount.tsx b/src/plugins/memberCount/MemberCount.tsx index 084e7ecc4..0a3f5e620 100644 --- a/src/plugins/memberCount/MemberCount.tsx +++ b/src/plugins/memberCount/MemberCount.tsx @@ -14,7 +14,7 @@ import { OnlineMemberCountStore } from "./OnlineMemberCountStore"; export function MemberCount({ isTooltip, tooltipGuildId }: { isTooltip?: true; tooltipGuildId?: string; }) { const currentChannel = useStateFromStores([SelectedChannelStore], () => getCurrentChannel()); - const guildId = isTooltip ? tooltipGuildId! : currentChannel.guild_id; + const guildId = isTooltip ? tooltipGuildId! : currentChannel?.guild_id; const totalCount = useStateFromStores( [GuildMemberCountStore], @@ -33,7 +33,7 @@ export function MemberCount({ isTooltip, tooltipGuildId }: { isTooltip?: true; t const threadGroups = useStateFromStores( [ThreadMemberListStore], - () => ThreadMemberListStore.getMemberListSections(currentChannel.id) + () => ThreadMemberListStore.getMemberListSections(currentChannel?.id) ); if (!isTooltip && (groups.length >= 1 || groups[0].id !== "unknown")) { diff --git a/src/plugins/memberCount/OnlineMemberCountStore.ts b/src/plugins/memberCount/OnlineMemberCountStore.ts index 8790f5e29..d74bea2a0 100644 --- a/src/plugins/memberCount/OnlineMemberCountStore.ts +++ b/src/plugins/memberCount/OnlineMemberCountStore.ts @@ -15,8 +15,8 @@ export const OnlineMemberCountStore = proxyLazy(() => { const onlineMemberMap = new Map(); class OnlineMemberCountStore extends Flux.Store { - getCount(guildId: string) { - return onlineMemberMap.get(guildId); + getCount(guildId?: string) { + return onlineMemberMap.get(guildId!); } async _ensureCount(guildId: string) { @@ -25,8 +25,8 @@ export const OnlineMemberCountStore = proxyLazy(() => { await PrivateChannelsStore.preload(guildId, GuildChannelStore.getDefaultChannel(guildId).id); } - ensureCount(guildId: string) { - if (onlineMemberMap.has(guildId)) return; + ensureCount(guildId?: string) { + if (!guildId || onlineMemberMap.has(guildId)) return; preloadQueue.push(() => this._ensureCount(guildId) diff --git a/src/plugins/memberCount/index.tsx b/src/plugins/memberCount/index.tsx index 1fa449889..0f38b9933 100644 --- a/src/plugins/memberCount/index.tsx +++ b/src/plugins/memberCount/index.tsx @@ -28,15 +28,14 @@ import { FluxStore } from "@webpack/types"; import { MemberCount } from "./MemberCount"; -export const GuildMemberCountStore = findStore("GuildMemberCountStore") as FluxStore & { getMemberCount(guildId: string): number | null; }; +export const GuildMemberCountStore = findStore("GuildMemberCountStore") as FluxStore & { getMemberCount(guildId?: string): number | null; }; export const ChannelMemberStore = findStore("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 = findStore("ThreadMemberListStore") as FluxStore & { - getMemberListSections(channelId: string): { [sectionId: string]: { sectionId: string; userIds: string[]; }; }; + getMemberListSections(channelId?: string): { [sectionId: string]: { sectionId: string; userIds: string[]; }; }; }; - const settings = definePluginSettings({ toolTip: { type: OptionType.BOOLEAN, diff --git a/src/plugins/mentionAvatars/styles.css b/src/plugins/mentionAvatars/styles.css index 64eb41416..cf6e2c14c 100644 --- a/src/plugins/mentionAvatars/styles.css +++ b/src/plugins/mentionAvatars/styles.css @@ -9,3 +9,8 @@ .vc-mentionAvatars-role-icon { margin: 0 2px 0.2rem 4px; } + +/** don't display inside the ServerInfo modal owner mention */ +.vc-gp-owner .vc-mentionAvatars-icon { + display: none; +} diff --git a/src/plugins/roleColorEverywhere/index.tsx b/src/plugins/roleColorEverywhere/index.tsx index 3e7d216b7..b5f66c098 100644 --- a/src/plugins/roleColorEverywhere/index.tsx +++ b/src/plugins/roleColorEverywhere/index.tsx @@ -57,7 +57,7 @@ export default definePlugin({ patches: [ // Chat Mentions { - find: 'location:"UserMention', + find: ".USER_MENTION)", replacement: [ { match: /onContextMenu:\i,color:\i,\.\.\.\i(?=,children:)(?<=user:(\i),channel:(\i).{0,500}?)/, diff --git a/src/plugins/xsOverlay/index.tsx b/src/plugins/xsOverlay/index.tsx index 5298b6429..7c2c23634 100644 --- a/src/plugins/xsOverlay/index.tsx +++ b/src/plugins/xsOverlay/index.tsx @@ -85,7 +85,7 @@ interface NotificationObject { title: string; content: string; useBase64Icon: boolean; - icon: ArrayBuffer | string; + icon: string; sourceApp: string; } @@ -318,23 +318,29 @@ function shouldIgnoreForChannelType(channel: Channel) { } 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 => { - const msgData: NotificationObject = { - type: 1, - timeout: settings.store.lengthBasedTimeout ? calculateTimeout(content) : settings.store.timeout, - height: calculateHeight(content), - opacity: settings.store.opacity, - volume: settings.store.volume, - audioPath: settings.store.soundPath, - title: titleString, - content: content, - useBase64Icon: true, - icon: new TextDecoder().decode(result), - sourceApp: "Vencord" - }; + fetch(`https://cdn.discordapp.com/avatars/${message.author.id}/${message.author.avatar}.png?size=128`) + .then(response => response.blob()) + .then(blob => new Promise(resolve => { + const r = new FileReader(); + r.onload = () => resolve((r.result as string).split(",")[1]); + r.readAsDataURL(blob); + })).then(result => { + const msgData: NotificationObject = { + type: 1, + timeout: settings.store.lengthBasedTimeout ? calculateTimeout(content) : settings.store.timeout, + height: calculateHeight(content), + opacity: settings.store.opacity, + 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) { diff --git a/src/utils/discord.tsx b/src/utils/discord.tsx index 4ca4458a0..da92adc20 100644 --- a/src/utils/discord.tsx +++ b/src/utils/discord.tsx @@ -18,7 +18,7 @@ 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 { Guild, Message, User } from "discord-types/general"; +import { Channel, Guild, Message, User } from "discord-types/general"; import { ImageModal, ImageModalProps, 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()); } export function getCurrentGuild(): Guild | undefined { - return GuildStore.getGuild(getCurrentChannel()?.guild_id); + return GuildStore.getGuild(getCurrentChannel()?.guild_id!); } export function openPrivateChannel(userId: string) { diff --git a/src/webpack/common/types/components.d.ts b/src/webpack/common/types/components.d.ts index adb2122b0..286ad3f98 100644 --- a/src/webpack/common/types/components.d.ts +++ b/src/webpack/common/types/components.d.ts @@ -98,7 +98,7 @@ export type Tooltip = ComponentType<{ /** Tooltip.Colors.BLACK */ color?: string; /** TooltipPositions.TOP */ - position?: string; + position?: PopoutPosition; tooltipClassName?: string; tooltipContentClassName?: string; @@ -117,7 +117,7 @@ export type TooltipContainer = ComponentType & {