Advertisement
martin4700

main.js

May 19th, 2022
698
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require('discord.js');
  2.  
  3. const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES"] });
  4.  
  5. const prefix = '-';
  6.  
  7. const fs = require('fs');
  8.  
  9.  
  10. client.command = new Discord.Collection();
  11.  
  12.  
  13. const commandFiles = fs.readdirSync ('./commands/').filter(file => file.endsWith('.js'));
  14.  
  15. for (const file of commandFiles){
  16.  
  17.     const command = require (`./commands/${file}`);
  18.  
  19.     client.commands.set(command.name, command);
  20. }
  21.  
  22.  
  23.  
  24. client.once('ready' , () => {
  25.     console.log('nullpointbot is online');
  26. });
  27.  
  28.  
  29.  
  30. client.on('messageCreate', message =>{
  31.     if (!message.content.startsWith(prefix) || message.author.bot) return;
  32.    
  33.     const args = message.content.slice(prefix.length).split(/ +/);
  34.     const command = args.shift().toLowerCase();
  35.  
  36.  
  37.     if (command === 'ping') {
  38.      
  39.     client.commands.get('ping').execute(message, args);
  40.    
  41.     }else if (command=='youtube'){
  42.      
  43.  
  44.     }
  45.  
  46. });
  47.  
  48. client.login('OTc2NjM1MTc2MDU2NjUxODE3.GkWpps.GXoVehL-ExjblUKkn51-6T97PqsTzJP3LZqBXA');
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement