Skip to content

Commit c202847

Browse files
committed
Use username instead of real name
1 parent 4f8ae25 commit c202847

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/bot.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ app.command("/sock-team", async ({ ack, body, client, logger }) => {
561561
await ack();
562562

563563
const teamMembers =
564-
await sql`select u2.slack_id, u2.real_name, u2.tz_offset from users u1 join users u2 on u1.clan_id = u2.clan_id where u1.slack_id = ${body.user_id};`;
564+
await sql`select u2.slack_id, u2.username, u2.tz_offset from users u1 join users u2 on u1.clan_id = u2.clan_id where u1.slack_id = ${body.user_id};`;
565565

566566
const [clan] =
567567
await sql`select c.name from users u join clans c on u.clan_id = c.id where u.slack_id = ${body.user_id};`;
@@ -579,16 +579,16 @@ app.command("/sock-team", async ({ ack, body, client, logger }) => {
579579
teamMembers.map(
580580
async ({
581581
slack_id,
582-
real_name,
582+
username,
583583
tz_offset,
584584
}: {
585585
slack_id: string;
586-
real_name: string;
586+
username: string;
587587
tz_offset: number;
588588
}) => {
589589
return [
590590
slack_id,
591-
real_name,
591+
username,
592592
(await getSecondsCoded(slack_id, new Date())) ?? 0,
593593
(await getSecondsCodedTotal(slack_id)) ?? 0,
594594
];
@@ -599,7 +599,7 @@ app.command("/sock-team", async ({ ack, body, client, logger }) => {
599599
stats.sort((a, b) => b[3] - a[3]);
600600

601601
const board = stats
602-
.map(([slackId, real_name, coded, totalCoded], idx) => {
602+
.map(([slackId, username, coded, totalCoded], idx) => {
603603
let medal =
604604
idx === 0
605605
? ":first_place_medal: "
@@ -609,7 +609,7 @@ app.command("/sock-team", async ({ ack, body, client, logger }) => {
609609
? ":third_place_medal: "
610610
: "";
611611

612-
return `${medal} ${real_name} coded ${(totalCoded / 3600).toFixed(1)} hours total (${(coded / 60).toFixed(1)} mins today)`;
612+
return `${medal} \`@${username}\` coded ${(totalCoded / 3600).toFixed(1)} hours total (${(coded / 60).toFixed(1)} mins today)`;
613613
})
614614
.join("\n");
615615

0 commit comments

Comments
 (0)