mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-03 15:07:26 +02:00
correction confession
This commit is contained in:
@@ -4,6 +4,9 @@ const { ActionRowBuilder, ButtonStyle, EmbedBuilder, ButtonBuilder} = require('d
|
||||
module.exports = {
|
||||
name: 'confession',
|
||||
description: 'Configure les paramètres pour le salon de confession.',
|
||||
category: 'gestion',
|
||||
emote: '🙏',
|
||||
usage: 'confession [channel|send] [channelID|#channel]',
|
||||
async execute(message, args) {
|
||||
const guildId = message.guild.id;
|
||||
if (!args.length) return message.reply('Veuillez spécifier une sous-commande: channel ou send.');
|
||||
@@ -37,7 +40,6 @@ async function setConfessionChannel(guildId, message, channelInput) {
|
||||
channelId = channelInput;
|
||||
}
|
||||
|
||||
// Vérifier si le salon existe
|
||||
const channel = message.guild.channels.cache.get(channelId);
|
||||
if (!channel) {
|
||||
return message.reply('Le salon spécifié n\'existe pas ou l\'ID est incorrect.');
|
||||
|
||||
@@ -7,15 +7,6 @@ module.exports = {
|
||||
name: Events.InteractionCreate,
|
||||
async execute(interaction, client) {
|
||||
const botId = client.user.id;
|
||||
let data = await new Promise((resolve, reject) => {
|
||||
db2.get('SELECT value FROM gestion WHERE id = ?', [botId], (err, row) => {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
reject(err);
|
||||
}
|
||||
resolve(row ? JSON.parse(row.value).owners || {} : {});
|
||||
});
|
||||
});
|
||||
let owners = await new Promise((resolve, reject) => {
|
||||
db2.get('SELECT value FROM gestion WHERE id = ?', [botId], (err, row) => {
|
||||
if (err) {
|
||||
@@ -47,13 +38,14 @@ module.exports = {
|
||||
await PrevnameDb.delete(userId)
|
||||
await interaction.reply({ content: "Vos prevname on etait correctement supprimer.", ephemeral: true });
|
||||
} else if (interaction.customId.startsWith('addconfession_')) {
|
||||
|
||||
let data = await new Promise((resolve, reject) => {
|
||||
db2.get('SELECT value FROM gestion WHERE id = ?', [botId], (err, row) => {
|
||||
if (err) {
|
||||
console.error(err.message);
|
||||
reject(err);
|
||||
}
|
||||
resolve(row ? JSON.parse(row.value).owners || {} : {});
|
||||
resolve(row ? JSON.parse(row.value) : {});
|
||||
});
|
||||
});
|
||||
const guildId= interaction.customId.split('_')[1];
|
||||
@@ -86,8 +78,8 @@ module.exports = {
|
||||
let ConfessionMessageToSend = reponse.fields.getTextInputValue('messageconfession')
|
||||
let ConfidentielAuthor = reponse.fields.getTextInputValue('status')
|
||||
let isConfidential = !ConfidentielAuthor.toLowerCase().startsWith('n');
|
||||
data.guildId = data.guildId || {};
|
||||
data.guildId.confession = data.guildId.confession || {};
|
||||
data.confession = data.confession || {};
|
||||
data.confession.channel = data.confession.channel || {};
|
||||
|
||||
console.log(guildId);
|
||||
console.log(data.guildId.confession.channel);
|
||||
|
||||
Reference in New Issue
Block a user