SHARE
TWEET

Untitled

a guest Aug 23rd, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module.exports = CommandHandler.addCommand({
  2.     cmds: ['!verify','!verify '],
  3.     requires: {
  4.       guild: true,
  5.       loud: false,
  6.     },
  7.     desc: 'Verify your ROBLOX account to your discord',
  8.     args: '<STRING>',
  9.     example: '!verify NodeSupport',
  10.  
  11.     func: (cmd, args, msgObj, speaker, channel, guild) => {
  12.       const data = Utilities.getDataFromString(args, [
  13.         function(str) {
  14.           return str
  15.         }
  16.       ], true)
  17.       if(!data || !data[0]) return Utilities.sendError(channel, speaker, msgObj, "Execution Failed", "Verify", "User not found");
  18.       const robloxData = NiteUtil.getIDFromUsername(data[0]);
  19.       if(!robloxData) return Utilities.sendError(channel, speaker, msgObj, "Execution Failed", "Verify", "User not found");
  20.       if(robloxData == "Not Found") return Utilities.sendError(channel, speaker, msgObj, "Execution Failed", "Verify", "User not found");
  21.       const user = data[0];
  22.       const randomString = Utilities.generateRandomWord();
  23.       const AvatarLink = `https://www.roblox.com/headshot-thumbnail/image?userId=${JSON.parse(robloxData).Id}&width=420&height=420&format=png`
  24.       let robloxIDData = NiteUtil.getRobloxID(speaker.id)
  25.       if(!robloxIDData) return Utilities.sendError(channel, speaker, msgObj, "Execution Failed", "Verify", "User not found");
  26.       if(robloxData != "Not Found") {
  27.         if(NiteUtil.getRobloxID(speaker.id) != "Not Found") {
  28.           if(JSON.parse(NiteUtil.getRobloxID(speaker.id)) != "Not Found") {
  29.             let currentId = JSON.parse(NiteUtil.getRobloxID(speaker.id)).RobloxID
  30.             if(currentId == JSON.parse(robloxData).Id) return Utilities.sendError(channel, speaker, msgObj, "Execution Failed", "Verify", "You're already verified to that account!");
  31.           };
  32.         };
  33.       };
  34.       EmbededUtil.sendEmbed(channel, 'Roblox Verify', `Please update your profile description for **${user}** within the next minute to have the following text:\n\n**` + randomString + `**\n`, EmbededUtil.makeEmbedFooter(speaker,msgObj), AvatarLink, NormalColor, null);
  35.       //if(!JSON.parse(robloxData).Id) return Utilities.sendError(channel, speaker, msgObj, "Execution Failed", "Verify", "Error whilst verifying");
  36.       function verificationLoop (i) {          
  37.         setTimeout(function () {
  38.           rbx.getPlayerInfo(JSON.parse(robloxData).Id).then(function(info) {
  39.             if(info.status.includes(randomString) || info.blurb.includes(randomString)) {
  40.               EmbededUtil.sendEmbed(channel, 'Roblox Verify', `Successfully verified your account **${user}** to your discord!\nIf you wish to get your level role then please do !getroles`, EmbededUtil.makeEmbedFooter(speaker,msgObj), AvatarLink, NormalColor, null);
  41.               let usersData = NiteUtil.getGameDataFromID(JSON.parse(robloxData).Id)
  42.               NiteUtil.verifyUser(speaker, robloxData)
  43.               if(usersData) {
  44.                 if(usersData != "Not Found") {
  45.                   try{
  46.                     let verifiedRole = guild.roles.find(role => role.name === "Verified");
  47.                     if(verifiedRole && !speaker.roles.has(verifiedRole.id)) {
  48.                       speaker.addRole(verifiedRole)
  49.                     };
  50.                   } catch(e) {
  51.                     console.log(e)
  52.                   }
  53.                 }
  54.               } else {
  55.                 let verifiedRole = guild.roles.find(role => role.name === "Verified");
  56.                 if(verifiedRole && !speaker.roles.has(verifiedRole.id)) {
  57.                   speaker.addRole(verifiedRole)
  58.                 };
  59.               }
  60.             } else {
  61.               if (--i) {
  62.                 verificationLoop(i);
  63.               }
  64.             }
  65.           });
  66.         }, 1000 * 2)
  67.       }
  68.      
  69.       verificationLoop(60 / 2)
  70.     },
  71.   });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top