Untitled
unknown
plain_text
7 months ago
2.3 kB
16
Indexable
Never
const { MessageEmbed } = require('discord.js'); const fs = require('fs'); keys={}; keys_config = require('../keys.json'); module.exports = { name: 'get-info', execute(message, args, client) { const allowedChannelId = '1217891744587190283'; const allowedRoleId = '1217889947885899786'; if (message.channel.id !== allowedChannelId) { return message.channel.send("You can't execute this command in this channel !"); } if (!message.member.roles.cache.has(allowedRoleId)) { return message.channel.send("You don't have the permissions to execute this command !"); } const key = args[0].trim(); if(!key) { return message.channel.send("Please specify a key."); } if(key.includes(' ')) return message.channel.send("The key can't contain spaces.Try to remove the spaces at the end of the key"); let keys; let usedKeys; try { keys = fs.readFileSync('commands/keys.txt', 'utf8').split('\n').map(key => key.trim()).filter(Boolean); usedKeys = fs.readFileSync('commands/used_keys.txt', 'utf8').split('\n').map(key => key.trim()).filter(Boolean); } catch (err) { return message.channel.send("Error reading key files."); } let embed = new MessageEmbed() .setColor('#992D22') .setTitle(`**🔑📝・Key Infos **`) .setFooter(`${client.config["server_config"].copyright} | Made By Aze Services Owner`, client.config["server_config"].server_icon) if(!keys.includes(key)) { embed.addField(`Order Key :`, key); embed.addField('Key Exists', '❌ No', true); }else { embed.addField(`Order Key :`, key); embed.addField('Key Exists', '✅ Yes', true); const data = keys_config[key.trim()]; const user = data.user; const creator = data.creator; const date = new Date(data.date).toLocaleString(); if(usedKeys.includes(key)) { embed.addField('Key Claimed', '✅ Yes', true); } else { embed.addField('Key Claimed', '❌ No', true); } embed.addField('Buyer : ', `<@${user}>`); embed.addField('Creator: ', `<@${creator}>`); embed.addField('Created The: ', date); } message.channel.send({embeds: [embed]}); } }
Leave a Comment