Skip to content

Commit

Permalink
fix: stats user id
Browse files Browse the repository at this point in the history
  • Loading branch information
DamirLut committed Apr 16, 2024
1 parent 3e41f6f commit c7a7f67
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/scheduled-tasks/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ export class StatsTask extends ScheduledTask {
embed.addFields({
name: 'стата по чату',
value: this.buildTop(
this.sort(stats, 'chat').slice(0, 15),
this.sort(stats, 'chat')
.slice(0, 15)
.filter((stat) => stat.value > 0),
({ user, value }, position) => this.buildLine(user, value, position),
'никто не писал :(',
),
Expand All @@ -125,7 +127,9 @@ export class StatsTask extends ScheduledTask {
embed.addFields({
name: 'стата по войсу',
value: this.buildTop(
this.sort(stats, 'voice').slice(0, 15),
this.sort(stats, 'voice')
.slice(0, 15)
.filter((stat) => stat.value > 0),
({ user, value }, position) => {
return this.buildLine(user, formatTime(value), position);
},
Expand All @@ -137,7 +141,9 @@ export class StatsTask extends ScheduledTask {
const reactionsRaw = this.sort(stats, 'reactions');

const lastReaction = reactionsRaw.at(-1);
const reactions = reactionsRaw.slice(0, 15);
const reactions = reactionsRaw
.slice(0, 15)
.filter((stat) => stat.value !== 0);

if (
lastReaction.value < 0 ||
Expand Down Expand Up @@ -171,7 +177,7 @@ export class StatsTask extends ScheduledTask {
name: 'новореги',
value: this.buildTop(
newRegs,
(user, i) => `${i}. <@${user.id}>\n`,
(user, i) => `${i}. <@${user.user_id}>\n`,
'никто не пришел к нам :(',
),
inline: true,
Expand Down

0 comments on commit c7a7f67

Please sign in to comment.