Skip to content

Commit

Permalink
Add support for usernames without discriminator (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
randomairborne committed Jun 15, 2023
1 parent e0f797a commit 788d366
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions src/commands/MentionCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,13 @@ export default class MentionCommand extends Command {
}

if ( embed === undefined ) return false;

embed.setFooter( { text: message.author.tag, iconURL: message.author.avatarURL() ?? undefined } )
let messageAuthorNormalizedTag: string;
if ( message.author.discriminator === '0' ) {
messageAuthorNormalizedTag = message.author.username;
} else {
messageAuthorNormalizedTag = message.author.tag;
}
embed.setFooter( { text: messageAuthorNormalizedTag, iconURL: message.author.avatarURL() ?? undefined } )
.setTimestamp( message.createdAt );

try {
Expand Down

0 comments on commit 788d366

Please sign in to comment.