DudeThatsErin

Untitled

Apr 29th, 2021 (edited)
602
17 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require('discord.js');
  2. const connection = require('../database.js');
  3.  
  4. module.exports = {
  5.     name: 'manualadd',
  6.     description: 'Tests commands',
  7.     aliases: ['m', 'mana'],
  8.     usage: '!manualadd',
  9.     async execute (message, args) {
  10.         console.log('before perms are checked...\n');
  11.  
  12.         if(!message.member.hasPermission("MANAGE_MESSAGES") ){
  13.             message.channel.send('You can\'t use this command, only mods can use this command. If you are a mod and you are seeing this, it is because only users with the \`MANAGE_MESSAGES\` permission can use this command.');
  14.         } else {
  15.             console.log('after perms are checked and before user ID is taken...\n')
  16.             const mmbr = message.mentions.members.first() || message.guild.members.cache.get(args[0]);
  17.             console.log(mmbr);
  18.             if(!mmbr) {
  19.                 message.reply('You need to include a user ID or mention of the user you want to add to the database.');
  20.             } else {
  21.                     let embed = new Discord.MessageEmbed()
  22.                         .setColor('GREEN')
  23.                         .setTitle(`User I have added to the database`)
  24.                         .setDescription(`${mmbr}`)
  25.                         .setFooter('Only users that have been online at least once since this bot was last rebooted will be shown here. Other users can be added using the add-participants command.');
  26.                     message.channel.send(embed);
  27.                     await (await connection).query(
  28.                         `INSERT INTO Challenges (guildId, player) VALUES (?, ?);`,
  29.                         [message.guild.id, mmbr]
  30.                     );
  31.                     console.log('successfully added users in embed to the database!');
  32.                 }
  33.  
  34.         }
  35.     }
  36. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×