clear quel que consolelog

This commit is contained in:
VALOU3336
2024-03-03 10:51:42 +01:00
parent ec01447f7a
commit b3fd7d79a8
4 changed files with 72 additions and 8 deletions
-1
View File
@@ -21,7 +21,6 @@ module.exports = {
const messages = await message.channel.messages.fetch({ limit: 100 });
amount = messages.size;
}
console.log(amount)
await message.reply('🗑️ Clear en cours...');
await message.channel.bulkDelete(amount).catch((err) => {
message.reply('Une erreur est survenue lors du clear');
+1 -1
View File
@@ -2,7 +2,7 @@ const sqlite3 = require('sqlite3').verbose();
const db = new sqlite3.Database('myDatabase.db');
const { ActionRowBuilder, ButtonStyle, EmbedBuilder, ButtonBuilder} = require('discord.js');
module.exports = {
name: 'confession',
name: 'setconfession',
description: 'Configure les paramètres pour le salon de confession.',
category: 'gestion',
emote: '🙏',
+71
View File
@@ -0,0 +1,71 @@
const sqlite3 = require('sqlite3').verbose();
const db = new sqlite3.Database('myDatabase.db');
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: 'confession',
description: 'Evnoie une comfession.',
category: 'utils',
emote: '🙏',
utilisation: 'confession <confession>',
async execute(message, args, client) {
const ConfessionMessageToSend = args.join(' ');
let data = await new Promise((resolve, reject) => {
db.get('SELECT value FROM gestion WHERE id = ?', [client.user.id], (err, row) => {
if (err) {
console.error(err.message);
reject(err);
}
resolve(row ? JSON.parse(row.value) : {});
});
});
data.confession = data.confession || {};
data.confession.channel = data.confession.channel || {};
const guildId = message.guild.id;
const channelId = data.confession.channel[guildId];
if (!channelId) {
try {
await message.delete();
const sentMessage = await message.channel.send({ content: "Le salon de confession n'est pas défini." });
setTimeout(async () => {
await sentMessage.delete();
}, 2500);
} catch(err) {
}
return;
}
const embed = new EmbedBuilder()
.setTitle('**Nouvelle Confession**')
.setAuthor({ name: 'Confidentiel' })
.setDescription(ConfessionMessageToSend)
.setFooter({ text: `${message.client.user.username} - ${message.guild.name}` })
.setColor('#0099ff');
const channel = message.guild.channels.cache.get(channelId);
if (channel) {
try {
await message.delete();
channel.send({ embeds: [embed] });
const sentMessage = await message.channel.send({ content: "Votre confession a été envoyée."});
setTimeout(async () => {
await sentMessage.delete();
}, 2500);
} catch(err) {
message.reply("Une erreur est survenue lors de l'envoie de la confession")
}
} else {
try {
await message.delete();
const sentMessage= await message.channel.send({ content: "Le salon spécifié n'a pas été trouvé."});
setTimeout(async () => {
await sentMessage.delete();
}, 2500);
} catch(err) {
}
}
},
};
-6
View File
@@ -94,13 +94,8 @@ module.exports = {
let isConfidential = !ConfidentielAuthor.toLowerCase().startsWith('n');
data.confession = data.confession || {};
data.confession.channel = data.confession.channel || {};
console.log(guildId);
console.log(data.guildId.confession.channel);
const channelId = data.confession.channel[guildId];
const embed = new EmbedBuilder()
.setTitle('**Nouvelle Confession**')
.setDescription(ConfessionMessageToSend)
@@ -114,7 +109,6 @@ module.exports = {
if (channelId) {
const channel = interaction.guild.channels.cache.get(channelId);
console.log(channelId);
channel.send({ embeds: [embed] });
} else {
console.error(`Le salon avec l'ID ${channelId} n'a pas été trouvé.`);