File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88 SlashCommandUserOption ,
99 type TextChannel ,
1010 type User ,
11+ userMention ,
1112} from "discord.js" ;
1213
1314import type { ApplicationCommand } from "@/commands/command.js" ;
@@ -18,7 +19,7 @@ import type { ReactionHandler } from "@/handler/ReactionHandler.js";
1819import * as ehreService from "@/service/ehre.js" ;
1920
2021function createUserPointString ( e : EhrePoints ) {
21- return `<@ ${ e . userId } > : ${ ehreService . formatPoints ( e . points ) } ` ;
22+ return `${ userMention ( e . userId ) } : ${ ehreService . formatPoints ( e . points ) } ` ;
2223}
2324
2425async function createEhreTable (
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import {
1111 RoleSelectMenuBuilder ,
1212 type RoleSelectMenuInteraction ,
1313 type Snowflake ,
14+ userMention ,
1415} from "discord.js" ;
1516
1617import 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 } ` ,
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
1212 time ,
1313 TimestampStyles ,
1414 type GuildTextBasedChannel ,
15+ userMention ,
1516} from "discord.js" ;
1617
1718import 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 } ,
You can’t perform that action at this time.
0 commit comments