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