v1 ok
This commit is contained in:
parent
3bdae268b2
commit
65849b460a
2 changed files with 4 additions and 29 deletions
3
app.js
3
app.js
|
|
@ -22,4 +22,5 @@ client.on(Events.ClientReady, () => {
|
|||
console.log(`Hello World !`);
|
||||
});
|
||||
*/
|
||||
client.login(process.env.DISCORDTOKEN);
|
||||
|
||||
// client.login(process.env.DISCORDTOKEN);
|
||||
30
index.js
30
index.js
|
|
@ -1,7 +1,6 @@
|
|||
import { Client, GatewayIntentBits, WebhookClient, AuditLogEvent, OAuth2Scopes, Options, Events } from 'discord.js';
|
||||
import firstDetector from './detectors/allDetector.js';
|
||||
|
||||
// const webhookClient = process.env.LOGS_WEBHOOK ? new WebhookClient({ url: process.env.LOGS_WEBHOOK }) : null;
|
||||
import 'dotenv/config';
|
||||
|
||||
const client = new Client({
|
||||
makeCache: Options.cacheWithLimits({
|
||||
|
|
@ -14,32 +13,7 @@ const client = new Client({
|
|||
]
|
||||
});
|
||||
|
||||
// Démarrage
|
||||
client.on('ready', async () => {
|
||||
console.log(`Logged in as ${client.user?.tag ?? 'unknown'}`);
|
||||
|
||||
webhookClient?.send({
|
||||
content: `Logged in as ${client.user?.tag ?? 'unknown'}`
|
||||
});
|
||||
|
||||
await client.guilds.fetch();
|
||||
|
||||
console.log('Bot is ready!');
|
||||
console.log(client.generateInvite({
|
||||
scopes: [OAuth2Scopes.Bot],
|
||||
permissions: [
|
||||
'SendMessages',
|
||||
'ViewAuditLog',
|
||||
'ViewChannel',
|
||||
'UseApplicationCommands',
|
||||
'EmbedLinks',
|
||||
'ReadMessageHistory'
|
||||
]
|
||||
}));
|
||||
});
|
||||
|
||||
// Gestion des Messages (Listeners)
|
||||
|
||||
// Fonction locale pour traiter un message (remplace newMessageListener)
|
||||
async function handleMessage(message) {
|
||||
try {
|
||||
|
|
@ -73,7 +47,7 @@ client.on('messageUpdate', async (oldMessage, newMessage) => {
|
|||
if (oldMessage.content === message.content) return; // Pas de changement de texte
|
||||
if (!message.content) return;
|
||||
|
||||
// Si l'ancien message déclenchait déjà un "quoi" (regex simple), on évite de spammer
|
||||
// on évite de spammer
|
||||
if (oldMessage.content && oldMessage.content.match(/(\b|^)quoi(\b|$)/i)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue