Melo
Melo
DIAdiscord.js - Imagine a bot
Created by Melo on 9/5/2024 in #djs-questions
Discordjs REST error iirc
Unhandled Rejection at: Promise { <rejected> } Reason: 261 | return params;
262 | }
263 | __name(makeURLSearchParams, "makeURLSearchParams");
264 | async function parseResponse(res) {
266 | return res.json();
^
SyntaxError: Unexpected end of JSON input
at C:\Users\komono\node_modules\@discordjs\rest\dist\index.js:266:16
at parseResponse (C:\Users\komono\node_modules\@discordjs\rest\dist\index.js:264:30)
Unhandled Rejection at: Promise { <rejected> } Reason: 261 | return params;
262 | }
263 | __name(makeURLSearchParams, "makeURLSearchParams");
264 | async function parseResponse(res) {
266 | return res.json();
^
SyntaxError: Unexpected end of JSON input
at C:\Users\komono\node_modules\@discordjs\rest\dist\index.js:266:16
at parseResponse (C:\Users\komono\node_modules\@discordjs\rest\dist\index.js:264:30)
I've been getting this error randomly when i start my bot since i updated djs
8 replies
DIAdiscord.js - Imagine a bot
Created by Melo on 9/4/2024 in #djs-voice
Voice reqs
I tried to test a tts code and looks like djs vooice requires ffmpeg, i cant download anything rn so im curious if theres any package that i could use as ffmpeg or sum like that
6 replies
DIAdiscord.js - Imagine a bot
Created by Melo on 5/27/2024 in #djs-questions
Automod command(i closed my other forums btw)
4 replies
DIAdiscord.js - Imagine a bot
Created by Melo on 5/26/2024 in #djs-questions
Automod issue again
https://sourceb.in/M8SCsPB8Y6 - full code https://sourceb.in/UI1i8qlcEI - is the problematic part of the code https://sourceb.in/f7bWUca9hP - is the error
5 replies
DIAdiscord.js - Imagine a bot
Created by Melo on 5/22/2024 in #djs-questions
Automod command
No description
45 replies
DIAdiscord.js - Imagine a bot
Created by Melo on 5/1/2024 in #djs-questions
deferReply issue
const utils = require("../utils/utils");
const embed = require("../utils/embed");
const loaders = require("../utils/loaders");
const EventBuild = require("../utils/event");

module.exports = new EventBuild(
"commandInteraction",
"interactionCreate",
async (interaction) => {
if(interaction.isCommand( )) {
await interaction.deferReply({ ephemeral: true });

const name = interaction.commandName;

if(!name) {
return utils.editOrReply(interaction, {
embeds: [embed.error({
content: "You need to inform the command that you want to use."
})]
});
};

const command = loaders.commands.find((command) => {
return command.name == name;
});

if (!command) {
return utils.editOrReply(interaction, {
embeds: [embed.error({
content: `Sorry! I couldn't find the command '${name}'.`
})]
});
};

try {
await command.execute(interaction);
} catch (error) {
console.error(`Error executing command '${command.name}':`, error);

return utils.editOrReply(interaction, {
embeds: [embed.error({
content: `Sorry! An error occurred while I tried to execute the command.`
})]
});
};
};
}
);
const utils = require("../utils/utils");
const embed = require("../utils/embed");
const loaders = require("../utils/loaders");
const EventBuild = require("../utils/event");

module.exports = new EventBuild(
"commandInteraction",
"interactionCreate",
async (interaction) => {
if(interaction.isCommand( )) {
await interaction.deferReply({ ephemeral: true });

const name = interaction.commandName;

if(!name) {
return utils.editOrReply(interaction, {
embeds: [embed.error({
content: "You need to inform the command that you want to use."
})]
});
};

const command = loaders.commands.find((command) => {
return command.name == name;
});

if (!command) {
return utils.editOrReply(interaction, {
embeds: [embed.error({
content: `Sorry! I couldn't find the command '${name}'.`
})]
});
};

try {
await command.execute(interaction);
} catch (error) {
console.error(`Error executing command '${command.name}':`, error);

return utils.editOrReply(interaction, {
embeds: [embed.error({
content: `Sorry! An error occurred while I tried to execute the command.`
})]
});
};
};
}
);
with this code im either getting the error https://pastebin.com/fPdH2ver or its just not editing deferReplies
31 replies