Skip to content

Commit

Permalink
fix(network): truncate user/server names to 90 chars
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-737 committed Jan 7, 2024
1 parent ac2e898 commit 9e1a466
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/managers/NetworkManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,11 @@ export default class NetworkManager extends Factory {
}
}

const username = settings.has('UseNicknames')
? message.member?.displayName || message.author.displayName
: message.author.username;
const username = (
settings.has('UseNicknames')
? message.member?.displayName || message.author.displayName
: message.author.username
).slice(0, 50);

// embeds for the normal mode
const { embed, censoredEmbed } = this.buildNetworkEmbed(message, username, {
Expand Down Expand Up @@ -214,7 +216,8 @@ export default class NetworkManager extends Factory {
(connection.profFilter ? message.censoredContent : message.content) +
// append the attachment url if there is one
`${attachment ? `\n${attachmentURL}` : ''}`,
username: `@${username}${message.guild}`,
// username is already limited to 50 characters, server name is limited to 40 (char limit is 100)
username: `@${username}${message.guild?.name.slice(0, 40)}`,
avatarURL: message.author.displayAvatarURL(),
threadId: connection.parentId ? connection.channelId : undefined,
allowedMentions: { parse: [] },
Expand Down

0 comments on commit 9e1a466

Please sign in to comment.