|
1 | | -import { type Snowflake, userMention } from "discord.js"; |
| 1 | +import { type BaseMessageOptions, type Snowflake, userMention } from "discord.js"; |
2 | 2 | import type { BotContext } from "@/context.js"; |
3 | 3 |
|
4 | 4 | import * as time from "@/utils/time.js"; |
@@ -137,24 +137,19 @@ export async function runHalfLife(context: BotContext) { |
137 | 137 | replacedStats.set(replaced.winnerId, replacedStats.getOrInsert(replaced.winnerId, 0) + 1); |
138 | 138 | } |
139 | 139 |
|
140 | | - const listFormatter = new Intl.ListFormat("de", { |
141 | | - style: "short", |
142 | | - type: "conjunction", |
143 | | - }); |
| 140 | + logger.info({ replacedStats }, "replacedStats"); |
144 | 141 |
|
145 | | - const decayStats = replacedStats |
146 | | - .entries() |
147 | | - .toArray() |
148 | | - .map(([user, count]) => `${count}x von ${userMention(user)}`); |
| 142 | + type Embed = NonNullable<BaseMessageOptions["embeds"]>[number]; |
149 | 143 |
|
150 | | - logger.info({ decayStats }, "decayStats"); |
| 144 | + const embeds: Embed[] = []; |
| 145 | + for (const [user, count] of replacedStats.entries()) { |
| 146 | + embeds.push({ |
| 147 | + description: `:radioactive: ${count}x Müll von ${userMention(user)} ist zu einem Stück Blei zerfallen. :radioactive:`, |
| 148 | + }); |
| 149 | + } |
151 | 150 |
|
152 | 151 | await context.textChannels.hauptchat.send({ |
153 | | - embeds: [ |
154 | | - { |
155 | | - description: `:radioactive: Der Müll ${decayStats.length === 1 ? "eines Users" : "einiger User"} ist zu einem Stück Blei zerfallen: ${listFormatter.format(decayStats)}. :radioactive:`, |
156 | | - }, |
157 | | - ], |
| 152 | + embeds, |
158 | 153 | allowedMentions: { |
159 | 154 | users: replacedStats.keys().toArray(), |
160 | 155 | }, |
|
0 commit comments