Skip to content

Commit 8ae80b1

Browse files
committed
Resolve fetchReply deprecation
1 parent f297a5f commit 8ae80b1

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

src/commands/inventar.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,17 @@ export default class InventarCommand implements ApplicationCommand {
113113

114114
let pageIndex = 0;
115115

116-
const message = await interaction.reply({
116+
const callbackResponse = await interaction.reply({
117117
...buildMessageData(pageIndex),
118-
fetchReply: true,
118+
withResponse: true,
119119
tts: false,
120120
});
121121

122+
const message = callbackResponse.resource?.message;
123+
if (message === null || message === undefined) {
124+
throw new Error("Expected message to be present.");
125+
}
126+
122127
const collector = message.createMessageComponentCollector({
123128
componentType: ComponentType.Button,
124129
time: 45_000,

src/commands/never.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,17 @@ export default class NeverCommand implements ApplicationCommand, MessageCommand
8686

8787
const prompt = await getPrompt(customInput);
8888
const embed = buildEmbed(prompt, author);
89-
const sentReply = await command.reply({
90-
fetchReply: true,
89+
const callbackResponse = await command.reply({
90+
withResponse: true,
9191
embeds: [embed],
9292
});
93-
const sentMessage = sentReply as Message<boolean>;
94-
await Promise.all([sentMessage.react("🍻"), sentMessage.react("🚱")]);
93+
94+
const sentReply = callbackResponse.resource?.message;
95+
if (sentReply === null || sentReply === undefined) {
96+
throw new Error("Expected message to be present.");
97+
}
98+
99+
await Promise.all([sentReply.react("🍻"), sentReply.react("🚱")]);
95100
}
96101

97102
async handleMessage(message: ProcessableMessage, context: BotContext) {

0 commit comments

Comments
 (0)