Refactor konochan commands to use sendBotMessage API
This commit is contained in:
parent
295665363a
commit
643330f51a
1 changed files with 13 additions and 11 deletions
|
|
@ -1,7 +1,13 @@
|
|||
import { findByProps } from "@vendetta/metro";
|
||||
import { sendMessage } from "../utils/messages";
|
||||
import { alerts } from "@vendetta/ui";
|
||||
|
||||
const MessageActions = findByProps("sendMessage");
|
||||
const messageUtil = findByProps(
|
||||
"sendBotMessage",
|
||||
"sendMessage",
|
||||
"receiveMessage",
|
||||
);
|
||||
|
||||
/**
|
||||
* Fetches a random image from KonoChan.
|
||||
* @param isNSFW - Whether to include NSFW content.
|
||||
|
|
@ -68,22 +74,18 @@ export const konoSelfCommand = {
|
|||
const imageUrl = await fetchImage(isNSFW);
|
||||
|
||||
if (!imageUrl) {
|
||||
return sendMessage(
|
||||
messageUtil.sendBotMessage(
|
||||
ctx.channel.id,
|
||||
"No image found. Try again later.",
|
||||
undefined,
|
||||
undefined,
|
||||
true,
|
||||
);
|
||||
return { type: 4 };
|
||||
}
|
||||
|
||||
return sendMessage(
|
||||
messageUtil.sendBotMessage(
|
||||
ctx.channel.id,
|
||||
`Here's your random image: ${imageUrl}`,
|
||||
undefined,
|
||||
undefined,
|
||||
true,
|
||||
);
|
||||
return { type: 4 };
|
||||
},
|
||||
applicationId: "-1",
|
||||
inputType: 1,
|
||||
|
|
@ -110,10 +112,10 @@ export const konoSendCommand = {
|
|||
const imageUrl = await fetchImage(isNSFW);
|
||||
|
||||
if (!imageUrl) {
|
||||
return sendMessage(ctx.channel.id, "No image found. Try again later.");
|
||||
return { type: 4, data: { content: "No image found. Try again later." } };
|
||||
}
|
||||
|
||||
return sendMessage(ctx.channel.id, imageUrl);
|
||||
return { type: 4, data: { content: imageUrl } };
|
||||
},
|
||||
applicationId: "-1",
|
||||
inputType: 1,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue