Skip to content

Commit

Permalink
add components checking (#682)
Browse files Browse the repository at this point in the history
* Update interpreter.js

* Update AoiError.js
  • Loading branch information
tyowk authored Dec 25, 2024
1 parent 13fa104 commit bff74c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/classes/AoiError.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class AoiError {

let msg;
if (extraOptions.interaction) {
if (options.content === "" && options.embeds?.length === 0 && options.files?.length === 0) return;
if (options.content === "" && options.embeds?.length === 0 && options.files?.length === 0 && options.components?.length === 0) return;
if (extraOptions?.defer) {
await d.data.interaction.deferReply({
ephemeral: extraOptions.ephemeral ?? options.ephemeral
Expand All @@ -106,13 +106,13 @@ class AoiError {
}
} else {
if (channel instanceof BaseInteraction) {
if (options.content === "" && options.embeds?.length === 0 && options.files?.length === 0) return;
if (options.content === "" && options.embeds?.length === 0 && options.files?.length === 0 && options.components?.length === 0) return;
msg = await channel.reply(options).catch((e) => {
AoiError.consoleError("CreateMessageError", e);
return undefined;
});
} else {
if (options.content === " " && (options.embeds?.length ?? 0) === 0 && (options.files?.length ?? 0) === 0 && (options.stickers?.length ?? 0) === 0) return;
if (options.content === " " && (options.embeds?.length ?? 0) === 0 && (options.files?.length ?? 0) === 0 && (options.stickers?.length ?? 0) === 0 && (options.components?.length ?? 0) === 0) return;

if (extraOptions.reply?.message) {
if (extraOptions.reply?.mention) options.allowedMentions.repliedUser = true;
Expand Down
2 changes: 1 addition & 1 deletion src/core/interpreter.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ const Interpreter = async (client, message, args, command, _db, returnCode = fal
returnData.data = data;
}

if ((code.length || embeds?.length || attachments?.length) && !errorOccurred && !error) {
if ((code.length || embeds?.length || attachments?.length || components?.length) && !errorOccurred && !error) {
try {
const send = {
embeds: embeds,
Expand Down

0 comments on commit bff74c4

Please sign in to comment.