Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports = CommandHandler.addCommand({
- cmds: ['!verify','!verify '],
- requires: {
- guild: true,
- loud: false,
- },
- desc: 'Verify your ROBLOX account to your discord',
- args: '<STRING>',
- example: '!verify NodeSupport',
- func: (cmd, args, msgObj, speaker, channel, guild) => {
- const data = Utilities.getDataFromString(args, [
- function(str) {
- return str
- }
- ], true)
- if(!data || !data[0]) return Utilities.sendError(channel, speaker, msgObj, "Execution Failed", "Verify", "User not found");
- const robloxData = NiteUtil.getIDFromUsername(data[0]);
- if(!robloxData) return Utilities.sendError(channel, speaker, msgObj, "Execution Failed", "Verify", "User not found");
- if(robloxData == "Not Found") return Utilities.sendError(channel, speaker, msgObj, "Execution Failed", "Verify", "User not found");
- const user = data[0];
- const randomString = Utilities.generateRandomWord();
- const AvatarLink = `https://www.roblox.com/headshot-thumbnail/image?userId=${JSON.parse(robloxData).Id}&width=420&height=420&format=png`
- let robloxIDData = NiteUtil.getRobloxID(speaker.id)
- if(!robloxIDData) return Utilities.sendError(channel, speaker, msgObj, "Execution Failed", "Verify", "User not found");
- if(robloxData != "Not Found") {
- if(NiteUtil.getRobloxID(speaker.id) != "Not Found") {
- if(JSON.parse(NiteUtil.getRobloxID(speaker.id)) != "Not Found") {
- let currentId = JSON.parse(NiteUtil.getRobloxID(speaker.id)).RobloxID
- if(currentId == JSON.parse(robloxData).Id) return Utilities.sendError(channel, speaker, msgObj, "Execution Failed", "Verify", "You're already verified to that account!");
- };
- };
- };
- 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);
- //if(!JSON.parse(robloxData).Id) return Utilities.sendError(channel, speaker, msgObj, "Execution Failed", "Verify", "Error whilst verifying");
- function verificationLoop (i) {
- setTimeout(function () {
- rbx.getPlayerInfo(JSON.parse(robloxData).Id).then(function(info) {
- if(info.status.includes(randomString) || info.blurb.includes(randomString)) {
- 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);
- let usersData = NiteUtil.getGameDataFromID(JSON.parse(robloxData).Id)
- NiteUtil.verifyUser(speaker, robloxData)
- if(usersData) {
- if(usersData != "Not Found") {
- try{
- let verifiedRole = guild.roles.find(role => role.name === "Verified");
- if(verifiedRole && !speaker.roles.has(verifiedRole.id)) {
- speaker.addRole(verifiedRole)
- };
- } catch(e) {
- console.log(e)
- }
- }
- } else {
- let verifiedRole = guild.roles.find(role => role.name === "Verified");
- if(verifiedRole && !speaker.roles.has(verifiedRole.id)) {
- speaker.addRole(verifiedRole)
- };
- }
- } else {
- if (--i) {
- verificationLoop(i);
- }
- }
- });
- }, 1000 * 2)
- }
- verificationLoop(60 / 2)
- },
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement