Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let config = require('discord.js'); // on charge le token depuis le fichier config.json
  2. const fs = require('fs');   // pour lire dans les fichiers
  3.  
  4.  
  5. const Discord = require('discord.js');
  6. const client = new Discord.Client();
  7.  
  8. //////////////////////////////////////////////////
  9. // les fonctions nécésaires
  10.  
  11. async function isMailCorrupted(mail) {
  12.  
  13.     let filehandle = null;
  14.     var contents = fs.readFileSync('accounts.txt', 'utf8');
  15.  
  16.     let lines = contents.replace('\r', '').split('\n');
  17.  
  18.     for (let line of lines) {
  19.         if (line != '' && line == mail) {
  20.             return true;
  21.         }
  22.     }
  23.     return false;
  24. }
  25.  
  26. //////////////////////////////////////////////////
  27.  
  28. client.on('ready', () => {
  29.     console.log(`Logged in as ${client.user.tag}!`);
  30. });
  31.  
  32. client.on('message', async msg => {
  33.     if (msg.content.startsWith('.search')) {
  34.         let email = msg.content.replace('.search ', '').strip();    // on récupère ce qu'il y a après le .search
  35.  
  36.         if (isMailCorrupted(mail)) {
  37.             await msg.channel.send('email corrompus!')
  38.         } else {
  39.             await msg.channel.send('email non corrompus')
  40.         }
  41.  
  42.     }
  43. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement