Advertisement
ECLIP3S

Untitled

Oct 17th, 2019
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. const Discord = require('discord.js');
  2. const client = new Discord.Client({
  3. partials: ["MESSAGE", "CHANNEL"]
  4. });
  5. client.commands = new Discord.Collection();
  6. const cooldowns = new Discord.Collection();
  7. const { prefix, token } = require('./config.json') // for vps
  8. const Enmap = require("enmap");
  9. const invoices = new Enmap({
  10. name: "invoices",
  11. autoFetch: true,
  12. fetchAll: true
  13. });
  14.  
  15. const warnings = new Enmap({
  16. name: "warnings",
  17. autoFetch: true,
  18. fetchAll: true
  19. })
  20.  
  21. const tickets = new Enmap({
  22. name: "tickets",
  23. autoFetch: true,
  24. fetchAll: true
  25. });
  26.  
  27. const fs = require('fs');
  28.  
  29.  
  30. const commandFiles = fs.readdirSync('./commands');
  31.  
  32. for (const file of commandFiles) {
  33. const command = require(`./commands/${file}`);
  34. client.commands.set(command.name, command);
  35. }
  36. client.on('messageReactionAdd', (reaction, user) => {
  37. if(reaction.message.partial) { reaction.message.fetch(); }
  38. console.log(reaction.emoji.name);
  39. })
  40. client.on('guildMemberAdd', member => {
  41. const welcomechannel = member.guild.channels.get("621913481620226069");
  42. const welcomebed = new Discord.MessageEmbed()
  43. .setTitle(`Welcome ${member.user.tag}`)
  44. .setDescription(`Welcome ${member} to Endurable Services. Make sure to read <#621913561295487007> before ordering. To order type \`-order\` in <#621924425142370315>.`)
  45.  
  46. welcomechannel.send(welcomebed);
  47. member.roles.add("621914044852338698");
  48. })
  49. client.on('ready', async () => {
  50. console.log("Ready!");
  51. client.user.setActivity("-new | -order", {type: 'PLAYING'});
  52.  
  53. })
  54.  
  55. client.on('message', async message => {
  56.  
  57.  
  58.  
  59. const args = message.content.slice(prefix.length).split(/ +/);
  60. const commandName = args.shift().toLowerCase();
  61.  
  62. if (!client.commands.has(commandName)) return;
  63.  
  64. const command = client.commands.get(commandName);
  65. if (command.args && !args.length) {
  66. let reply = `You didn't provide any arguments, ${message.author}!`;
  67.  
  68. if (command.usage) {
  69. reply += `\nThe proper usage would be: \`${prefix}${command.name} ${command.usage}\``;
  70. }
  71.  
  72. return message.channel.send(reply);
  73. }
  74.  
  75. try {
  76. command.execute(client, message, args);
  77. }
  78. catch (error) {
  79. console.error(error);
  80. message.reply('there was an error trying to execute that command!');
  81. }
  82. });
  83. client.login(token);
  84.  
  85. module.exports.invoices = invoices;
  86. module.exports.tickets = tickets;
  87. module.exports.warnings = warnings;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement