From a1efe586216a6f32c4d546f400f64f062e847c5b Mon Sep 17 00:00:00 2001 From: night0721 Date: Sun, 20 Mar 2022 00:45:19 +0800 Subject: [PATCH] added sensitivity command and added now scam links --- command/APEX/sens.js | 6 +- command/Information/avatar.js | 2 +- command/Information/botinfo.js | 4 +- command/Information/help.js | 8 +- {APEX => data/APEX}/apex.json | 96 ++++++++-------- {CODM => data/CODM}/loadout.js | 0 {CODM => data/CODM}/new-stats.js | 0 {CODM => data/CODM}/stats.js | 181 ++++++++++++++++++------------- events/interactionCreate.js | 17 +-- index.js | 3 +- util/Data/domains.json | 2 + 11 files changed, 175 insertions(+), 144 deletions(-) rename {APEX => data/APEX}/apex.json (94%) rename {CODM => data/CODM}/loadout.js (100%) rename {CODM => data/CODM}/new-stats.js (100%) rename {CODM => data/CODM}/stats.js (60%) diff --git a/command/APEX/sens.js b/command/APEX/sens.js index e9a7998..e5cd885 100644 --- a/command/APEX/sens.js +++ b/command/APEX/sens.js @@ -1,9 +1,9 @@ const { MessageEmbed } = require("discord.js"); module.exports = { - name: "class", + name: "sensitivity", description: "Get the perfect sensitivity for APEXM", category: "APEX", - usage: "[Ironsight Sensitivity ]", + usage: "[Ironsight Sensitivity]", type: "CHAT_INPUT", options: [ { @@ -18,7 +18,7 @@ module.exports = { const embed = new MessageEmbed() .setTitle(`The base sensitivity (ironsight or 1x Scope): ${args[0]}`) .setDescription( - `<:nyx_description:897379659665264650> [Video guide](https://rebrand.ly/apexm-sens) by HawksNest on how to set your sensitivity. + `<:nyx_description:897379659665264650> [Video guide](https://rebrand.ly/apexm-sens) by HawksNest on how to set your sensitivity. \n**Basic Sensitivity** \`\`\` \nTPP without ADS ${args[0] * 2.09} \nFPP without ADS ${args[0] * 1.29} diff --git a/command/Information/avatar.js b/command/Information/avatar.js index 4404104..3e83af2 100644 --- a/command/Information/avatar.js +++ b/command/Information/avatar.js @@ -18,7 +18,7 @@ module.exports = { interaction.guild.members.cache.get(args[0]) || interaction.member; const embed = new MessageEmbed() .setAuthor({ - text: member.user.tag, + name: member.user.tag, iconURL: member.user.displayAvatarURL({ dynamic: true, size: 1024 }), }) .setColor(client.color) diff --git a/command/Information/botinfo.js b/command/Information/botinfo.js index 0291429..675376b 100644 --- a/command/Information/botinfo.js +++ b/command/Information/botinfo.js @@ -1,5 +1,5 @@ const { MessageEmbed, version: djsversion } = require("discord.js"); -const version = require("../../../package.json").version; +const version = require("../../package.json").version; const { utc } = require("moment"); module.exports = { name: "botinfo", @@ -36,7 +36,7 @@ module.exports = { .reduce((a, b) => a + b.memberCount, 0) .toLocaleString()} Channels ❯ \`${client.channels.cache.size.toLocaleString()}\` - Commands ❯ \`${client.commands.size}\` + Commands ❯ \`${client.slashCommands.size}\` `, inline: true, } diff --git a/command/Information/help.js b/command/Information/help.js index 418f990..3101408 100644 --- a/command/Information/help.js +++ b/command/Information/help.js @@ -80,10 +80,10 @@ module.exports = { .setThumbnail( "https://media.discordapp.net/attachments/896078559293104128/896392631565828146/nyx_logo_transparent.webp" ) - .setFooter( - `Requested by ${interaction.user.tag}`, - interaction.user.displayAvatarURL({ dynamic: true }) - ); + .setFooter({ + text: `Requested by ${interaction.user.tag}`, + iconURL: interaction.user.displayAvatarURL({ dynamic: true }), + }); const components = state => [ new Discord.MessageActionRow().addComponents( new Discord.MessageSelectMenu() diff --git a/APEX/apex.json b/data/APEX/apex.json similarity index 94% rename from APEX/apex.json rename to data/APEX/apex.json index 4dcc05e..1e75041 100644 --- a/APEX/apex.json +++ b/data/APEX/apex.json @@ -1,49 +1,49 @@ -{ - "legends": [ - "Bangalore", - "Bloodhound", - "Caustic", - "Crypto", - "Fuse", - "Gibraltar", - "Horizon", - "LIfeline", - "Loba", - "Mirage", - "Octane", - "Pathfinder", - "Rampart", - "Revenant", - "Valkyrie", - "Watton", - "Wraith" - ], - "guns": [ - "Bocek Bow", - "EVA-8", - "Kraber", - "Peacekeeper", - "Prowler", - "R-301 Carbine", - "R-99", - "Spitfire", - "Charge Rifle", - "Flatline", - "G7 Scout", - "Havoc", - "Mastiff", - "Sentinel", - "Triple Take", - "Volt", - "Wingman", - "Alternator", - "Devotion", - "Hemlok", - "Longbow", - "L-Star", - "RE-45", - "30-30 Repeater", - "Mozambique", - "P2020" - ] +{ + "legends": [ + "Bangalore", + "Bloodhound", + "Caustic", + "Crypto", + "Fuse", + "Gibraltar", + "Horizon", + "LIfeline", + "Loba", + "Mirage", + "Octane", + "Pathfinder", + "Rampart", + "Revenant", + "Valkyrie", + "Watton", + "Wraith" + ], + "guns": [ + "Bocek Bow", + "EVA-8", + "Kraber", + "Peacekeeper", + "Prowler", + "R-301 Carbine", + "R-99", + "Spitfire", + "Charge Rifle", + "Flatline", + "G7 Scout", + "Havoc", + "Mastiff", + "Sentinel", + "Triple Take", + "Volt", + "Wingman", + "Alternator", + "Devotion", + "Hemlok", + "Longbow", + "L-Star", + "RE-45", + "30-30 Repeater", + "Mozambique", + "P2020" + ] } \ No newline at end of file diff --git a/CODM/loadout.js b/data/CODM/loadout.js similarity index 100% rename from CODM/loadout.js rename to data/CODM/loadout.js diff --git a/CODM/new-stats.js b/data/CODM/new-stats.js similarity index 100% rename from CODM/new-stats.js rename to data/CODM/new-stats.js diff --git a/CODM/stats.js b/data/CODM/stats.js similarity index 60% rename from CODM/stats.js rename to data/CODM/stats.js index e83192a..9668297 100644 --- a/CODM/stats.js +++ b/data/CODM/stats.js @@ -1,6 +1,6 @@ -const common = require("../util/functions/common"); -const data = require("../util/Data/data.json"); -const Discord = require("discord.js"); +const common = require("../../util/functions/common"); +const data = require("../../util/Data/data.json"); +const { MessageEmbed } = require("discord.js"); let currGun, currStats, @@ -11,35 +11,68 @@ let currGun, recoilAvailable, chart, hasError; -const errMsg = "*Generic placeholder error message*"; module.exports = { name: "stats", - description: "Check gun stats", + description: "Check gun statistics", usage: "(Gun)", category: "CODM", - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args - */ - run: async (client, message, args) => { + options: [ + { + type: 3, + name: "gun_name", + description: "Name of the gun", + required: true, + choices: [], + }, + { + type: 3, + name: "1st_attchment", + description: "First attachment", + }, + { + type: 3, + name: "2nd_attchment", + description: "Second attachment", + }, + { + type: 3, + name: "3rd_attchment", + description: "Third attachment", + }, + { + type: 3, + name: "4th_attchment", + description: "Forth attachment", + }, + { + type: 3, + name: "5th_attchment", + description: "Fifth attachment", + }, + ], + run: async (client, interaction, args) => { + repEmb = null; recoilAvailable = false; hasError = false; - const repEmb = statsHandler(args.join(" ").replace("\n", " ")); - + if (args.length == 1) + repEmb = statsHandler(args.join(" ").replace("\n", " ")); + else repEmb = statsHandler(args.join(" + ").replace("\n", " ")); if (hasError) { - message.reply({ embeds: [repEmb] }); - } - if (recoilAvailable) { - repEmb.fields.push({ - name: "**Recoil Graph**", - value: - "```\nThe Recoil graph below is dynamic (change based on attachment equipped)```", + interaction.followUp({ + content: `**${repEmb || "An error has occured"}**`, }); - const recoilImageLink = await chart.getShortUrl(); - repEmb.image = { url: recoilImageLink }; + } else { + if (recoilAvailable) { + repEmb.fields.push({ + name: "**Recoil Graph**", + value: + "```\nThe Recoil graph below is dynamic (change based on attachment equipped)```", + }); + const recoilImageLink = await chart.getShortUrl(); + repEmb.image = { url: recoilImageLink }; + } + interaction.followUp({ embeds: [new MessageEmbed(repEmb)] }); } - message.reply({ embeds: [repEmb] }); }, }; @@ -49,38 +82,38 @@ function inpHandler(inpmsg) { function statsHandler(inpmsg) { let statsNames = [ - "Pellets", - "Detonation Range", - "Explosion Radius", - "Explosion Damage", - "Firing Mode", - "Rate of Fire", - "Bullet in Burst", - "Time Between Burst", - "Bullet Speed", - "Penetration Level", - "Bullet Spread", - "Idle Sway", - "Hipfire Pellet Spread", - "ADS Pellet Spread", - "ADS Time", - "Sprint-to-Fire Time", - "ADS Zoom", - "Magazine", - "Reserve", - "Reload Type", - "Cancel Reload Time", - "Reload Time", - "Full Reload Time", - "Drop Time", - "Raise Time", - "Sprinting Speed", - "Walking Speed", - "Straifing Speed", - "Damage per Tick", - "Number of Ticks", - "Time Between Ticks", - "Breath Hold Time", + "Pellets", //0 + "Detonation Range", //1 + "Explosion Radius", //2 + "Explosion Damage", //3 + "Firing Mode", //4 + "Rate of Fire", //5 + "Bullet in Burst", //6 + "Time Between Burst", //7 + "Bullet Speed", //8 + "Penetration Level", //9 + "Bullet Spread", //10 + "Idle Sway", //11 + "Hipfire Pellet Spread", //12 + "ADS Pellet Spread", //13 + "ADS Time", //14 + "Sprint-to-Fire Time", //15 + "ADS Zoom", //16 + "Magazine", //17 + "Reserve", //18 + "Reload Type", //19 + "Cancel Reload Time", //20 + "Reload Time", //21 + "Full Reload Time", //22 + "Drop Time", //23 + "Raise Time", //24 + "Sprinting Speed", //25 + "Walking Speed", //26 + "Straifing Speed", //27 + "Damage per Tick", //28 + "Number of Ticks", //29 + "Time Between Ticks", //30 + "Breath Hold Time", //31 "shouldNeverHappen0", "shouldNeverHappen1", "shouldNeverHappen2", @@ -95,7 +128,7 @@ function statsHandler(inpmsg) { return currGun; } currStats = currGun.stats; - currDRM = currGun.drm[0]; + currDRM = currGun.drm[0]; // base mag. currGun.drm[1] for more vairents currAttachments = []; currAttachments = common.attachmentsIdentifier(inpmsg, currGun); if (typeof currAttachments == "string") { @@ -155,8 +188,8 @@ function statsHandler(inpmsg) { inpIndx = inpIndx.filter(x => outReady[x]); return inpIndx.length ? { - name: "**" + inpName + "**", - value: "```\n" + inpIndx.map(x => outReady[x]).join("\n") + "```", + name: `**${inpName}**`, + value: `\`\`\`\n${inpIndx.map(x => outReady[x]).join("\n")}\`\`\``, } : ""; } @@ -187,17 +220,17 @@ function statsHandler(inpmsg) { function addUnit(j) { switch (j) { - case 07: + case 7: case 14: case 15: case 23: case 24: case 31: return " ms"; - case 27: - case 28: case 25: case 26: + case 27: + case 28: return " m/s"; case 20: case 21: @@ -205,9 +238,9 @@ function statsHandler(inpmsg) { return " s"; case 16: return "%"; - case 06: + case 6: return " Rounds"; - case 05: + case 5: return " RPM"; default: return ""; @@ -224,16 +257,11 @@ function statsHandler(inpmsg) { currRecoilArr[2] ); recoilAvailable = true; - } else { - recoilAvailable = false; - } - if (chart == "none") { - recoilAvailable = false; - } - if (chart == "err" || currAttachments == "err") { - hasError = true; - return "Cocaineeee"; - } + } else recoilAvailable = false; + + if (chart == "none") recoilAvailable = false; + if (chart == "err") hasError = true; + const dmg = common.damageHandler( currDRM.damage, @@ -249,7 +277,7 @@ function statsHandler(inpmsg) { currGun.description ? { name: "**Description:**", - value: "```\n" + currGun.description + "```", + value: `\`\`\`\n${currGun.description}\`\`\``, } : {}, { name: "**Damage Profile:**", value: dmg }, @@ -261,10 +289,9 @@ function statsHandler(inpmsg) { color: 5814783, fields: out, footer: { - text: "All data courtesy of Project Lighthouse and CoDM Research Crew", + text: "[OUTDATED] All data courtesy of Project Lighthouse 2.0 and CoDM Research Crew", icon_url: - "https://media.discordapp.net/attachments/735590814662656102/806960573753327657/cc.png?width=638&height=638", + "https://media.discordapp.net/attachments/735590814662656102/806960573753327657/cc.png", }, }; } -// console.log(statsHandler("Holger").fields); diff --git a/events/interactionCreate.js b/events/interactionCreate.js index 1c6b247..334da24 100644 --- a/events/interactionCreate.js +++ b/events/interactionCreate.js @@ -63,19 +63,19 @@ client.on("interactionCreate", async interaction => { embeds: [ new MessageEmbed() .setURL(client.web) - .setAuthor( - interaction.user.tag, - interaction.user.displayAvatarURL({ dynamic: true }) - ) + .setAuthor({ + name: interaction.user.tag, + iconURL: interaction.user.displayAvatarURL({ dynamic: true }), + }) .setColor(client.color) .setDescription( `You aren't a premium user. You can either boost support server or subscribe to developer's team [Ko-fi](https://ko-fi.com/cathteam) or gift a nitro to one of the developer team to be premium user` ) .setTimestamp() - .setFooter( - `Made by ${client.author}`, - client.user.displayAvatarURL() - ), + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }), ], }); } @@ -209,5 +209,6 @@ function sendE(e) { .setTimestamp() .setColor(client.color) .setFooter({ text: client.user.username }); + interaction.channel.send({ embeds: [embed] }); client.channels.cache.get(client.config.ErrorLog).send({ embeds: [embed] }); } diff --git a/index.js b/index.js index 5741d85..533025a 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,6 @@ const NYX = require("./client/NYX"); const client = new NYX(); module.exports = client; -process.on("unhandledRejection", () => {}); +// Add // when need to debug +//process.on("unhandledRejection", () => {}); client.start(); diff --git a/util/Data/domains.json b/util/Data/domains.json index 31acfcc..b84a45d 100644 --- a/util/Data/domains.json +++ b/util/Data/domains.json @@ -1,5 +1,7 @@ { "scam": [ + "gibthub.com", + "egift-premium.com", "disceord.gift", "discode.gift", "discosb.gift",