Fix: Refactor styling and update text for clarity

- Updated text for "text" variables to match modern conventions.
- Improved the styling for the Header component.
- Improved styling for other components
- Added a conditional for the onConfirm to fix a TypeScript error.
This commit is contained in:
kmmiio99o 2025-12-06 15:17:39 +01:00
parent 2592196066
commit 647a651102
2 changed files with 1313 additions and 1330 deletions

File diff suppressed because it is too large Load diff

View file

@ -42,7 +42,8 @@ export const firstMessageCommand = {
name: "user", name: "user",
displayName: "user", displayName: "user",
description: "Target user to get their first message in this server/dm", description: "Target user to get their first message in this server/dm",
displayDescription: "Target user to get their first message in this server/dm", displayDescription:
"Target user to get their first message in this server/dm",
type: 6, // USER type type: 6, // USER type
required: false, required: false,
}, },
@ -74,40 +75,24 @@ export const firstMessageCommand = {
const channelId = ctx.channel.id; const channelId = ctx.channel.id;
const isDM = ctx.channel.type === 1; const isDM = ctx.channel.type === 1;
let result = "https://discord.com/channels/"; // Channel option is not valid in DMs
if (isDM && channel) {
return { type: 4 };
}
let result = "https://discord.com/channels/";
let message; let message;
if (!user && !channel) {
if (isDM) { if (isDM) {
message = await getFirstDMMessage(channelId); // DM logic: only user parameter matters
result += `@me/${channelId}/${message.id}`; message = await getFirstDMMessage(channelId, user);
} else { result += `@me/${channelId}/${message.id}`;
message = await getFirstGuildMessage(guildId);
result += `${guildId}/${message.channel_id}/${message.id}`;
}
} else if (user) {
if (isDM) {
message = await getFirstDMMessage(channelId, user);
result += `@me/${channelId}/${message.id}`;
} else {
message = await getFirstGuildMessage(guildId, user);
result += `${guildId}/${message.channel_id}/${message.id}`;
}
} else if (channel) {
if (isDM) {
// Silent fail for invalid combination
return { type: 4 };
}
message = await getFirstGuildMessage(guildId, null, channel);
result += `${guildId}/${channel}/${message.id}`;
} else { } else {
// both user and channel specified // Guild logic: both user and channel parameters can be used
if (isDM) {
// Silent fail for invalid combination
return { type: 4 };
}
message = await getFirstGuildMessage(guildId, user, channel); message = await getFirstGuildMessage(guildId, user, channel);
result += `${guildId}/${channel}/${message.id}`; // Use the specified channel if provided, otherwise use the message's channel
const targetChannel = channel || message.channel_id;
result += `${guildId}/${targetChannel}/${message.id}`;
} }
if (send) { if (send) {
@ -116,13 +101,13 @@ export const firstMessageCommand = {
ctx.channel.id, ctx.channel.id,
{ content: result }, { content: result },
void 0, void 0,
{ nonce: fixNonce } { nonce: fixNonce },
); );
return { type: 4 };
} else { } else {
RN.Linking.openURL(result); // FIXED: use RN.Linking.openURL RN.Linking.openURL(result);
return { type: 4 };
} }
return { type: 4 };
} catch (error) { } catch (error) {
console.error("[FirstMessage] Error:", error); console.error("[FirstMessage] Error:", error);
// Silent fail - no error message in chat // Silent fail - no error message in chat