Edr0b0t
DIAdiscord.js - Imagine an app
•Created by Edr0b0t on 1/28/2024 in #djs-questions
problem with BASE_TYPE_REQUIRED
I'm sorry, but I can't remember when or in which file I restricted the error size, but despite that, have you miraculously found a solution?
9 replies
DIAdiscord.js - Imagine an app
•Created by Edr0b0t on 1/28/2024 in #djs-questions
problem with BASE_TYPE_REQUIRED
9 replies
DIAdiscord.js - Imagine an app
•Created by Edr0b0t on 1/23/2024 in #djs-questions
problem with ChannelType.GuildText
I've done what you said the command work but the console reply
and here is my code :
/home/container/node_modules/@discordjs/rest/dist/index.js:722
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^
DiscordAPIError[10008]: Unknown Message
at handleErrors (/home/container/node_modules/@discordjs/rest/dist/index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:1120:23)
at async SequentialHandler.queueRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:953:14)
at async _REST.request (/home/container/node_modules/@discordjs/rest/dist/index.js:1266:22)
at async InteractionWebhook.send (/home/container/node_modules/discord.js/src/structures/Webhook.js:222:15) {
requestBody: {
files: [],
json: {
content: "J'ai bien supprimé `1` message(s) dans le salon #général !",
tts: false,
nonce: undefined,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 64,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined
}
},
rawError: { message: 'Unknown Message', code: 10008 },
code: 10008,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/webhooks/1122496790911008829/aW50ZXJhY3Rpb246MTE5OTQxMzQxMTU1NDAwNTExMjp0YktzOHJDMkVIOHdET1lJenA3d0dSUUZCcUE3Wkh3am1rV3hWU096cmlrcFdHYThpaEpTbnZUYXk4RXZlaEdycVRrZmU1aFE3T0hvMjA0clNFZVJ0Y3lqMkhxd2hGQ3ZjTm5la05oWTEzckZTd1RWVHYzYTgzdHRXYm03RlZFVA?wait=true'
}
/home/container/node_modules/@discordjs/rest/dist/index.js:722
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^
DiscordAPIError[10008]: Unknown Message
at handleErrors (/home/container/node_modules/@discordjs/rest/dist/index.js:722:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:1120:23)
at async SequentialHandler.queueRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:953:14)
at async _REST.request (/home/container/node_modules/@discordjs/rest/dist/index.js:1266:22)
at async InteractionWebhook.send (/home/container/node_modules/discord.js/src/structures/Webhook.js:222:15) {
requestBody: {
files: [],
json: {
content: "J'ai bien supprimé `1` message(s) dans le salon #général !",
tts: false,
nonce: undefined,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 64,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined
}
},
rawError: { message: 'Unknown Message', code: 10008 },
code: 10008,
status: 404,
method: 'POST',
url: 'https://discord.com/api/v10/webhooks/1122496790911008829/aW50ZXJhY3Rpb246MTE5OTQxMzQxMTU1NDAwNTExMjp0YktzOHJDMkVIOHdET1lJenA3d0dSUUZCcUE3Wkh3am1rV3hWU096cmlrcFdHYThpaEpTbnZUYXk4RXZlaEdycVRrZmU1aFE3T0hvMjA0clNFZVJ0Y3lqMkhxd2hGQ3ZjTm5la05oWTEzckZTd1RWVHYzYTgzdHRXYm03RlZFVA?wait=true'
}
const { Client, Interaction, ApplicationCommandOptionType, PermissionFlagsBits, ChannelType } = require('discord.js');
module.exports = {
name: 'clear',
description: 'Supprime un certain nombre de messages dans un salon.',
options: [
{
name: 'nombre',
description: 'Effacer des messages.',
type: ApplicationCommandOptionType.Integer,
required: true,
},
{
name: 'channel',
description: 'Le channel dans lequel vous souhaitez supprimer les messages.',
type: ApplicationCommandOptionType.Channel,
},
],
permissionsRequired: [PermissionFlagsBits.ManageMessages],
botPermissions: [PermissionFlagsBits.ManageMessages],
callback: async (client, interaction) => {
const channel = interaction.options.getChannel("channel") || interaction.channel;
const number = interaction.options.getInteger("nombre");
if (channel.type === ChannelType.GuildText) {
} else {
return interaction.reply({ content: "Vous ne pouvez supprimer des messages que dans un salon texte.", ephemeral: true });
}
if (number <= 0 || number > 100) {
return interaction.reply({ content: "Le nombre doit être compris entre 0 et 100 inclus.", ephemeral: true });
}
await interaction.deferReply();
try {
const messages = await channel.bulkDelete(number);
const response = `J'ai bien supprimé \`${messages.size}\` message(s) dans le salon ${channel} !`;
if (response.length <= 2000) {
interaction.followUp({ content: response, ephemeral: true });
} else {
interaction.followUp({ content: "La réponse est trop longue pour être affichée.", ephemeral: true });
}
} catch (error) {
console.error(error);
interaction.followUp({ content: "Une erreur s'est produite lors de la suppression des messages.", ephemeral: true });
}
}
};
const { Client, Interaction, ApplicationCommandOptionType, PermissionFlagsBits, ChannelType } = require('discord.js');
module.exports = {
name: 'clear',
description: 'Supprime un certain nombre de messages dans un salon.',
options: [
{
name: 'nombre',
description: 'Effacer des messages.',
type: ApplicationCommandOptionType.Integer,
required: true,
},
{
name: 'channel',
description: 'Le channel dans lequel vous souhaitez supprimer les messages.',
type: ApplicationCommandOptionType.Channel,
},
],
permissionsRequired: [PermissionFlagsBits.ManageMessages],
botPermissions: [PermissionFlagsBits.ManageMessages],
callback: async (client, interaction) => {
const channel = interaction.options.getChannel("channel") || interaction.channel;
const number = interaction.options.getInteger("nombre");
if (channel.type === ChannelType.GuildText) {
} else {
return interaction.reply({ content: "Vous ne pouvez supprimer des messages que dans un salon texte.", ephemeral: true });
}
if (number <= 0 || number > 100) {
return interaction.reply({ content: "Le nombre doit être compris entre 0 et 100 inclus.", ephemeral: true });
}
await interaction.deferReply();
try {
const messages = await channel.bulkDelete(number);
const response = `J'ai bien supprimé \`${messages.size}\` message(s) dans le salon ${channel} !`;
if (response.length <= 2000) {
interaction.followUp({ content: response, ephemeral: true });
} else {
interaction.followUp({ content: "La réponse est trop longue pour être affichée.", ephemeral: true });
}
} catch (error) {
console.error(error);
interaction.followUp({ content: "Une erreur s'est produite lors de la suppression des messages.", ephemeral: true });
}
}
};
9 replies
DIAdiscord.js - Imagine an app
•Created by Edr0b0t on 1/23/2024 in #djs-questions
problem with timestamp
thank you 😁
3 replies
DIAdiscord.js - Imagine an app
•Created by Edr0b0t on 1/20/2024 in #djs-questions
Problem with Reddit API
there's no typo in the filename it's just the apostrophe at the end
7 replies
DIAdiscord.js - Imagine an app
•Created by Edr0b0t on 1/20/2024 in #djs-questions
Problem with Reddit API
And do you know how to fix that
7 replies