Skip to content

Commit

Permalink
fix: discord link name length (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldietzler authored Sep 12, 2024
1 parent a95fab3 commit 13d703a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/discord/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class DiscordCommands {
author: interaction.user.username,
});

return interaction.reply({ content: message });
return interaction.reply({ content: message, flags: [MessageFlags.SuppressEmbeds] });
}

@Slash({ name: 'link-remove', description: 'Remove an existing link' })
Expand All @@ -89,7 +89,7 @@ export class DiscordCommands {

const { message, isPrivate } = await this.service.removeLink({ name });

return interaction.reply({ content: message, ephemeral: isPrivate });
return interaction.reply({ content: message, ephemeral: isPrivate, flags: [MessageFlags.SuppressEmbeds] });
}

@Slash({ name: 'age', description: 'Immich age' })
Expand Down
11 changes: 7 additions & 4 deletions src/services/discord.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,13 @@ export class DiscordService {
);
}

return links.map(({ name, link }) => ({
name: `${name} - ${link}`,
value: name,
}));
return links.map(({ name, link }) => {
const formattedName = `${name}${link}`;
return {
name: formattedName.length < 100 ? formattedName : `${formattedName.slice(0, 97)}...`,
value: name,
};
});
}

async addLink({ name, link, author }: { name: string; link: string; author: string }) {
Expand Down

0 comments on commit 13d703a

Please sign in to comment.