fix jump to first message

This commit is contained in:
kmmiio99o 2025-10-06 21:16:58 +02:00
parent b577148e1f
commit 8d38f366ef

View file

@ -1,5 +1,5 @@
import { findByProps } from "@vendetta/metro"; import { findByProps } from "@vendetta/metro";
import { url } from "@vendetta/metro/common"; import { ReactNative as RN } from "@vendetta/metro/common";
const APIUtils = findByProps("getAPIBaseURL", "get"); const APIUtils = findByProps("getAPIBaseURL", "get");
const MessageActions = findByProps("sendMessage"); const MessageActions = findByProps("sendMessage");
@ -12,7 +12,7 @@ const getFirstGuildMessage = async (
) => { ) => {
const userParam = userId ? `&author_id=${userId}` : ""; const userParam = userId ? `&author_id=${userId}` : "";
const channelParam = channelId ? `&channel_id=${channelId}` : ""; const channelParam = channelId ? `&channel_id=${channelId}` : "";
const minIdParam = userId ? "" : "&min_id=0"; const minIdParam = userId ? "" : `&min_id=0`;
return ( return (
await APIUtils.get({ await APIUtils.get({
url: `/guilds/${guildId}/messages/search`, url: `/guilds/${guildId}/messages/search`,
@ -23,7 +23,7 @@ const getFirstGuildMessage = async (
const getFirstDMMessage = async (dmId: string, userId?: string) => { const getFirstDMMessage = async (dmId: string, userId?: string) => {
const userParam = userId ? `&author_id=${userId}` : ""; const userParam = userId ? `&author_id=${userId}` : "";
const minIdParam = userId ? "" : "&min_id=0"; const minIdParam = userId ? "" : `&min_id=0`;
return ( return (
await APIUtils.get({ await APIUtils.get({
url: `/channels/${dmId}/messages/search`, url: `/channels/${dmId}/messages/search`,
@ -120,7 +120,7 @@ export const firstMessageCommand = {
); );
return { type: 4 }; return { type: 4 };
} else { } else {
url.openDeeplink(result); RN.Linking.openURL(result); // FIXED: use RN.Linking.openURL
return { type: 4 }; return { type: 4 };
} }
} catch (error) { } catch (error) {