feat: Ajout serveur transcript
This commit is contained in:
+3
-1
@@ -1,3 +1,5 @@
|
||||
BOT_START_MESSAGE=QuantumCraft Studios - Bot lancé
|
||||
DISCORD_TOKEN=votre_token_ici
|
||||
CLIENT_ID=votre_id_client_ici
|
||||
CLIENT_ID=votre_id_client_ici
|
||||
TRANSCRIPT_DOMAIN=http://localhost
|
||||
TRANSCRIPT_PORT=5417
|
||||
@@ -1,6 +1,7 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const express = require('express');
|
||||
const { config } = require('../../handlers/configLoader');
|
||||
|
||||
module.exports = {
|
||||
name: 'clientReady',
|
||||
@@ -12,9 +13,7 @@ module.exports = {
|
||||
app.use('/transcript', express.static(transcriptsPath));
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.send(
|
||||
'✅ Serveur Transcript actif. Utilise /transcript/:id pour voir un ticket.'
|
||||
);
|
||||
res.send('✅ Serveur Transcript actif. Utilise /transcript/:id pour voir un ticket.');
|
||||
});
|
||||
|
||||
app.get('/transcript/:id', (req, res) => {
|
||||
@@ -27,8 +26,10 @@ module.exports = {
|
||||
});
|
||||
|
||||
const PORT = process.env.TRANSCRIPT_PORT || 3000;
|
||||
const DOMAIN = process.env.TRANSCRIPT_DOMAIN || 'http://localhost';
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`🌐 Serveur Transcript dispo sur http://localhost:${PORT}`);
|
||||
console.log(`🌐 Serveur Transcript dispo sur ${DOMAIN}:${PORT}`);
|
||||
});
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -110,6 +110,10 @@ async function generateTranscript(channel, user) {
|
||||
const filePath = path.join(transcriptsDir, `${channel.id}.html`);
|
||||
fs.writeFileSync(filePath, html, 'utf8');
|
||||
|
||||
// === Lecture domaine/port depuis .env ===
|
||||
const DOMAIN = process.env.TRANSCRIPT_DOMAIN || 'http://localhost';
|
||||
const PORT = process.env.TRANSCRIPT_PORT || 3000;
|
||||
|
||||
// Logs
|
||||
const logChannel = await channel.client.channels
|
||||
.fetch(config.logsChannel)
|
||||
@@ -126,7 +130,7 @@ async function generateTranscript(channel, user) {
|
||||
},
|
||||
{
|
||||
name: 'Transcript',
|
||||
value: `http://localhost:3000/transcript/${channel.id}`,
|
||||
value: `${DOMAIN}:${PORT}/transcript/${channel.id}`,
|
||||
}
|
||||
)
|
||||
.setColor(0xe74c3c)
|
||||
@@ -141,4 +145,4 @@ async function closeTicketWithTranscript(channel, user) {
|
||||
await channel.delete().catch(() => {});
|
||||
}
|
||||
|
||||
module.exports = { closeTicketWithTranscript };
|
||||
module.exports = { closeTicketWithTranscript };
|
||||
Reference in New Issue
Block a user