Skip to content

Commit

Permalink
minor refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
mlomb committed Nov 22, 2023
1 parent 2f302e1 commit cd99f45
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pipeline/parse/parsers/DiscordParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class DiscordParser extends Parser {
const pauthor: PAuthor = {
id: message.author.id,
bot: message.author.isBot,
name: name,
name,
avatar: avatar ? (" " + avatar).substring(1) : undefined, // avoid leak
};
this.emit("author", pauthor, this.lastMessageTimestampInFile);
Expand Down
10 changes: 6 additions & 4 deletions report/components/core/labels/AuthorLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ const _AuthorLabel = ({ index }: LabelProps) => {

// add discriminator in Discord
if (db.config.platform === "discord") {
const discr = author.n.split("#").pop();
const parts = author.n.split("#");
const nick = parts[0];
const discr: string | undefined = parts[1];

// only keep if it's 4 chars (and not a deleted ID)
if (discr && discr.length === 4) {
if (!isDemo && discr && discr.length === 4) {
name = (
<>
{author.n.slice(0, -5)}
<span className="Label__discriminator">#{`${isDemo ? "0000" : discr}`}</span>
{nick}
<span className="Label__discriminator">#{discr}</span>
</>
);
}
Expand Down

0 comments on commit cd99f45

Please sign in to comment.