TypingTweaks: fix (#1883)

This commit is contained in:
TheKodeToad 2023-10-25 19:43:48 +01:00 committed by GitHub
parent c7a20769f9
commit ab1b002ed1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 19 deletions

View file

@ -17,13 +17,14 @@
*/
import { MessageObject } from "@api/MessageEvents";
import { findByCodeLazy, findByPropsLazy } from "@webpack";
import { findByPropsLazy } from "@webpack";
import { ChannelStore, ComponentDispatch, FluxDispatcher, GuildStore, MaskedLink, ModalImageClasses, PrivateChannelsStore, RestAPI, SelectedChannelStore, SelectedGuildStore, UserProfileStore, UserSettingsActionCreators, UserUtils } from "@webpack/common";
import { Guild, Message, User } from "discord-types/general";
import { ImageModal, ModalRoot, ModalSize, openModal } from "./modal";
const MessageActions = findByPropsLazy("editMessage", "sendMessage");
const UserProfileActions = findByPropsLazy("openUserProfileModal", "closeUserProfileModal");
export function getCurrentChannel() {
return ChannelStore.getChannel(SelectedChannelStore.getChannelId());
@ -99,14 +100,12 @@ export function openImageModal(url: string, props?: Partial<React.ComponentProps
));
}
const openProfile = findByCodeLazy("friendToken", "USER_PROFILE_MODAL_OPEN");
export async function openUserProfile(id: string) {
const user = await UserUtils.getUser(id);
if (!user) throw new Error("No such user: " + id);
const guildId = SelectedGuildStore.getGuildId();
openProfile({
UserProfileActions.openUserProfileModal({
userId: id,
guildId,
channelId: SelectedChannelStore.getChannelId(),