Skip to content

Commit 410b70e

Browse files
committed
Use container instead of embed
1 parent ca3284c commit 410b70e

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

src/service/lootDegradation.ts

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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";
32

3+
import type { BotContext } from "#context.ts";
44
import * as time from "#utils/time.ts";
55
import * as lootService from "#service/loot.ts";
66
import { LootAttributeKind, LootKind, resolveLootTemplate } from "#service/lootData.ts";
@@ -70,14 +70,16 @@ export async function exposeWithRadiation(context: BotContext) {
7070
}
7171

7272
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+
),
8081
],
82+
flags: MessageFlags.IsComponentsV2,
8183
});
8284
}
8385

@@ -133,17 +135,20 @@ export async function runHalfLife(context: BotContext) {
133135

134136
logger.info({ replacedStats }, "replacedStats");
135137

136-
type Embed = NonNullable<BaseMessageOptions["embeds"]>[number];
137-
138-
const embeds: Embed[] = [];
138+
const components: ContainerBuilder[] = [];
139139
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+
);
143147
}
144148

145149
await context.textChannels.hauptchat.send({
146-
embeds,
150+
flags: MessageFlags.IsComponentsV2,
151+
components: components,
147152
allowedMentions: {
148153
users: replacedStats.keys().toArray(),
149154
},

0 commit comments

Comments
 (0)