|
1 | | -import { type BaseMessageOptions, type Snowflake, userMention } from "discord.js"; |
2 | | -import type { BotContext } from "#context.ts"; |
| 1 | +import { ContainerBuilder, MessageFlags, type Snowflake, userMention } from "discord.js"; |
3 | 2 |
|
| 3 | +import type { BotContext } from "#context.ts"; |
4 | 4 | import * as time from "#utils/time.ts"; |
5 | 5 | import * as lootService from "#service/loot.ts"; |
6 | 6 | import { LootAttributeKind, LootKind, resolveLootTemplate } from "#service/lootData.ts"; |
@@ -70,14 +70,16 @@ export async function exposeWithRadiation(context: BotContext) { |
70 | 70 | } |
71 | 71 |
|
72 | 72 | await context.textChannels.hauptchat.send({ |
73 | | - embeds: [ |
74 | | - { |
75 | | - description: `:radioactive: ${targetLoot.displayName} von ${userMention(targetLoot.winnerId)} wurde verstrahlt. :radioactive:`, |
76 | | - footer: { |
77 | | - text: "Du solltest deinen Müll besser entsorgen", |
78 | | - }, |
79 | | - }, |
| 73 | + components: [ |
| 74 | + new ContainerBuilder().addTextDisplayComponents( |
| 75 | + t => |
| 76 | + t.setContent( |
| 77 | + `:radioactive: ${targetLoot.displayName} von ${userMention(targetLoot.winnerId)} wurde verstrahlt. :radioactive:`, |
| 78 | + ), |
| 79 | + t => t.setContent("-# Du solltest deinen Müll besser entsorgen"), |
| 80 | + ), |
80 | 81 | ], |
| 82 | + flags: MessageFlags.IsComponentsV2, |
81 | 83 | }); |
82 | 84 | } |
83 | 85 |
|
@@ -133,17 +135,20 @@ export async function runHalfLife(context: BotContext) { |
133 | 135 |
|
134 | 136 | logger.info({ replacedStats }, "replacedStats"); |
135 | 137 |
|
136 | | - type Embed = NonNullable<BaseMessageOptions["embeds"]>[number]; |
137 | | - |
138 | | - const embeds: Embed[] = []; |
| 138 | + const components: ContainerBuilder[] = []; |
139 | 139 | for (const [user, count] of replacedStats.entries()) { |
140 | | - embeds.push({ |
141 | | - description: `:radioactive: ${count}x Müll von ${userMention(user)} ist zu einem Stück Blei zerfallen. :radioactive:`, |
142 | | - }); |
| 140 | + components.push( |
| 141 | + new ContainerBuilder().addTextDisplayComponents(t => |
| 142 | + t.setContent( |
| 143 | + `:radioactive: ${count}x Müll von ${userMention(user)} ist zu einem Stück Blei zerfallen. :radioactive:`, |
| 144 | + ), |
| 145 | + ), |
| 146 | + ); |
143 | 147 | } |
144 | 148 |
|
145 | 149 | await context.textChannels.hauptchat.send({ |
146 | | - embeds, |
| 150 | + flags: MessageFlags.IsComponentsV2, |
| 151 | + components: components, |
147 | 152 | allowedMentions: { |
148 | 153 | users: replacedStats.keys().toArray(), |
149 | 154 | }, |
|
0 commit comments