Skip to content

Commit 8943c19

Browse files
committed
Use userMention helper
1 parent ef3a06e commit 8943c19

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/commands/ehre.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
SlashCommandUserOption,
99
type TextChannel,
1010
type User,
11+
userMention,
1112
} from "discord.js";
1213

1314
import type { ApplicationCommand } from "@/commands/command.js";
@@ -18,7 +19,7 @@ import type { ReactionHandler } from "@/handler/ReactionHandler.js";
1819
import * as ehreService from "@/service/ehre.js";
1920

2021
function createUserPointString(e: EhrePoints) {
21-
return `<@${e.userId}> : ${ehreService.formatPoints(e.points)}`;
22+
return `${userMention(e.userId)}: ${ehreService.formatPoints(e.points)}`;
2223
}
2324

2425
async function createEhreTable(

src/commands/faulenzerping.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
RoleSelectMenuBuilder,
1212
type RoleSelectMenuInteraction,
1313
type Snowflake,
14+
userMention,
1415
} from "discord.js";
1516

1617
import type { BotContext } from "@/context.js";
@@ -153,7 +154,7 @@ export default class FaulenzerPingCommand implements ApplicationCommand {
153154
) {
154155
const userChunks = chunkArray(usersToNotify, 10);
155156
for (const users of userChunks) {
156-
const usersToNotifyMentions = users.map(userId => `<@${userId}>`).join(" ");
157+
const usersToNotifyMentions = users.map(userMention).join(" ");
157158

158159
await originalMessage.reply({
159160
content: `${message} ${usersToNotifyMentions}`,

src/commands/woisvote.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
time,
1313
TimestampStyles,
1414
type GuildTextBasedChannel,
15+
userMention,
1516
} from "discord.js";
1617

1718
import type { ReactionHandler } from "@/handler/ReactionHandler.js";
@@ -231,11 +232,8 @@ export const woisVoteScheduler = async (context: BotContext): Promise<void> => {
231232

232233
const chunks = chunkArray(interestedUsers, 10);
233234
for (const users of chunks) {
234-
const mentions = users.map(userId => `<@${userId}>`);
235-
// It's okay for readability
236-
237235
await woisMessage.reply({
238-
content: mentions.join(" "),
236+
content: users.map(userMention).join(" "),
239237
allowedMentions: {
240238
users,
241239
},

0 commit comments

Comments
 (0)