Advertisement
Guest User

Untitled

a guest
May 19th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.64 KB | None | 0 0
  1. const config = require('../config/config.json')
  2. prefixes = config.prefixes;
  3. const { RichEmbed } = require("discord.js");
  4. const { red_dark } = require("../colors.json");
  5.  
  6. const Discord = require('discord.js');
  7. const cooldowns = new Discord.Collection();
  8.  
  9. module.exports = (client, message) => {
  10. var min = 1;
  11. var max = 6;
  12. var rand = Math.floor(Math.random() * (+max - +min)) + +min;
  13. let prefix = false;
  14. let embed = new RichEmbed();
  15. for(const thisPrefix of prefixes) {
  16. if(message.content.startsWith(thisPrefix)) prefix = thisPrefix;
  17. }
  18. if (message.channel.type !== 'text' && !message.content.startsWith(prefix) && !message.author.bot && message.author.id != config.ownerID) {
  19.  
  20. embed.setColor(red_dark)
  21. .setAuthor(`${message.author.username} Needs Help`, message.author.avatarURL)
  22. .setThumbnail(message.author.avatarURL)
  23. .setTimestamp()
  24. .setDescription(`NEW DM MESSAGE!`)
  25. .addField('Author','Tag: ' + message.author.tag + ' ID: ' + message.author.id)
  26. .addField('Message', `\`\`\`${message.content}\`\`\``)
  27. .setFooter(`DM Message`, client.user.avatarURL)
  28.  
  29. message.channel.send(`Sending Message To Canine`)
  30.  
  31. return client.users.get('343180696556404736').send(embed).catch(err => {
  32. console.error('Coundn\'t DM Canine: ' + err);
  33. });
  34.  
  35.  
  36. //mychannel.send(msg.content);
  37. }
  38.  
  39. if(message.content.toLowerCase().includes('everyone') && message.channel.type == 'text') {
  40. var server = message.guild.id;
  41. message.reply(`wants something <@&${server}>`);
  42. }
  43.  
  44. if(message.content.toLowerCase().includes('good bot') || message.content.toLowerCase().includes('best bot') || message.content.toLowerCase().includes('bestest bot') || message.content.toLowerCase().includes('good doggo') || message.content.toLowerCase().includes('good pupper') || message.content.toLowerCase().includes('bestest doggo') || message.content.toLowerCase().includes('best doggo')) {
  45. switch (rand) {
  46. case 1:
  47. message.channel.send('Bestest Hooman');
  48. break;
  49. case 2:
  50. message.reply('is a good hooman');
  51. break;
  52. case 3:
  53. message.channel.send('u thot i was doggo but i am bot doggo, Bamboozeled again');
  54. break;
  55. case 4:
  56. message.channel.send('I luv ou hooman');
  57. break;
  58. default:
  59. message.channel.send('good hooman');
  60. break;
  61. }
  62. }
  63.  
  64. if(!prefix) return;
  65. if (!message.content.startsWith(prefix) || message.author.bot) return;
  66.  
  67. const args = message.content.slice(prefix.length).split(/ +/);
  68. const commandName = args.shift().toLowerCase();
  69. client = client;
  70.  
  71. const command = client.commands.get(commandName)
  72. || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));
  73.  
  74. console.log(`Attempting to run ${commandName}`);
  75.  
  76. if (!command) return console.log(`Attempted to run ${commandName} But it doesnt exist or Could not be found!`);
  77.  
  78. if (command.guildOnly && message.channel.type !== 'text') {
  79. return message.reply('I can\'t execute that command inside DMs!');
  80. }
  81.  
  82. if (command.ownerOnly && message.author.id != config.ownerID) {
  83. return console.log(`Someone Tried to use The Owner Command: ${commandName}`);
  84. }
  85.  
  86. if (message.channel.type == 'text' && message.author.id != config.ownerID && command.adminOnly &! message.member.hasPermission('MANAGE_GUILD')) {
  87. return message.channel.send(`${message.author.tag} tried to use an Admin Command`);
  88. }
  89.  
  90. if (command.args && !args.length) {
  91. let reply = `This Command Requires Arguments, ${message.author} You Mortal!`;
  92.  
  93. if (command.usage) {
  94. reply += `\nThe proper usage would be: \`${prefix}${command.name} ${command.usage}\``;
  95. }
  96.  
  97. return message.channel.send(reply);
  98. }
  99.  
  100. if (!cooldowns.has(command.name)) {
  101. cooldowns.set(command.name, new Discord.Collection());
  102. }
  103.  
  104. const now = Date.now();
  105. const timestamps = cooldowns.get(command.name);
  106. const cooldownAmount = (command.cooldown || 3) * 1000;
  107.  
  108. if (timestamps.has(message.author.id)) {
  109. const expirationTime = timestamps.get(message.author.id) + cooldownAmount;
  110.  
  111. if (message.author.id != config.ownerID && now < expirationTime) {
  112. const timeLeft = (expirationTime - now) / 1000;
  113. return message.reply(`please wait ${timeLeft.toFixed(1)} more second(s) before reusing the \`${command.name}\` command.`);
  114. }
  115. }
  116.  
  117. timestamps.set(message.author.id, now);
  118. setTimeout(() => timestamps.delete(message.author.id), cooldownAmount);
  119.  
  120. try {
  121. command.execute(client, message, args);
  122. console.log(`Ran ${commandName}`);
  123. } catch (error) {
  124. console.error(error);
  125. message.reply('there was an error trying to execute that command!');
  126. }
  127. // Run the command
  128. // command.run(client, msg, args);
  129. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement