mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-22 18:19:33 +02:00
clear quel que consolelog
This commit is contained in:
@@ -21,7 +21,6 @@ module.exports = {
|
|||||||
const messages = await message.channel.messages.fetch({ limit: 100 });
|
const messages = await message.channel.messages.fetch({ limit: 100 });
|
||||||
amount = messages.size;
|
amount = messages.size;
|
||||||
}
|
}
|
||||||
console.log(amount)
|
|
||||||
await message.reply('🗑️ Clear en cours...');
|
await message.reply('🗑️ Clear en cours...');
|
||||||
await message.channel.bulkDelete(amount).catch((err) => {
|
await message.channel.bulkDelete(amount).catch((err) => {
|
||||||
message.reply('Une erreur est survenue lors du clear');
|
message.reply('Une erreur est survenue lors du clear');
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ const sqlite3 = require('sqlite3').verbose();
|
|||||||
const db = new sqlite3.Database('myDatabase.db');
|
const db = new sqlite3.Database('myDatabase.db');
|
||||||
const { ActionRowBuilder, ButtonStyle, EmbedBuilder, ButtonBuilder} = require('discord.js');
|
const { ActionRowBuilder, ButtonStyle, EmbedBuilder, ButtonBuilder} = require('discord.js');
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'confession',
|
name: 'setconfession',
|
||||||
description: 'Configure les paramètres pour le salon de confession.',
|
description: 'Configure les paramètres pour le salon de confession.',
|
||||||
category: 'gestion',
|
category: 'gestion',
|
||||||
emote: '🙏',
|
emote: '🙏',
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -94,13 +94,8 @@ module.exports = {
|
|||||||
let isConfidential = !ConfidentielAuthor.toLowerCase().startsWith('n');
|
let isConfidential = !ConfidentielAuthor.toLowerCase().startsWith('n');
|
||||||
data.confession = data.confession || {};
|
data.confession = data.confession || {};
|
||||||
data.confession.channel = data.confession.channel || {};
|
data.confession.channel = data.confession.channel || {};
|
||||||
|
|
||||||
console.log(guildId);
|
|
||||||
console.log(data.guildId.confession.channel);
|
|
||||||
const channelId = data.confession.channel[guildId];
|
const channelId = data.confession.channel[guildId];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle('**Nouvelle Confession**')
|
.setTitle('**Nouvelle Confession**')
|
||||||
.setDescription(ConfessionMessageToSend)
|
.setDescription(ConfessionMessageToSend)
|
||||||
@@ -114,7 +109,6 @@ module.exports = {
|
|||||||
|
|
||||||
if (channelId) {
|
if (channelId) {
|
||||||
const channel = interaction.guild.channels.cache.get(channelId);
|
const channel = interaction.guild.channels.cache.get(channelId);
|
||||||
console.log(channelId);
|
|
||||||
channel.send({ embeds: [embed] });
|
channel.send({ embeds: [embed] });
|
||||||
} else {
|
} else {
|
||||||
console.error(`Le salon avec l'ID ${channelId} n'a pas été trouvé.`);
|
console.error(`Le salon avec l'ID ${channelId} n'a pas été trouvé.`);
|
||||||
|
|||||||
Reference in New Issue
Block a user