nyx

The first CODM discrod bot -- cath.exe Template
git clone https://codeberg.org/night0721/nyx
Log | Files | Refs | LICENSE

commit ae320aa2f1ecce1437a6f8a18d7c26088ee0ea3a
parent 9ba5ff12d252b4e80d61318974e18de9681fc433
Author: night0721 <[email protected]>
Date:   Wed,  2 Feb 2022 04:23:33 +0800

bug fix intentionally

Diffstat:
DCODM/builds.js | 86-------------------------------------------------------------------------------
Mcommand/CODM/build.js | 18+++++++++---------
Mcommand/CODM/scorestreak.js | 2+-
3 files changed, 10 insertions(+), 96 deletions(-)

diff --git a/CODM/builds.js b/CODM/builds.js @@ -1,85 +0,0 @@ -const builds = require("../util/Data/builds.json"); -const guns = builds.Main; -const Discord = require("discord.js"); -const nmDt = require("../util/Data/aliases.json"); -const weaponActualName = nmDt.weaponActualName; -const weaponAlliasName = nmDt.weaponAlliasName; -module.exports = { - name: "build", - description: "Check gun builds", - usage: "(Gun)", - category: "CODM", - status: false, - Owner: true, - run: async (client, message, args) => { - const currGun = weaponIdentifier(args.join(" ").replace("\n", " ")); - if (!currGun) message.reply({ content: "Please specify a gun" }); - if (typeof currGun == "string") { - message.reply({ embeds: [currGun] }); - } else { - const attachNames = currGun.Attachments.map( - x => `**${x.Name}** [${builds.AttachmentTypes[x.Type]}]` - ); - const embed = new Discord.MessageEmbed() - .setTitle( - `Build for ${currGun.Name} (${builds.WeaponTypes[currGun.Type]})` - ) - .setColor(16580400) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) - .setTimestamp() - .setURL(client.web) - .setDescription( - attachNames.reduce( - (t, x, i, a) => t + (i < a.length - 1 ? "\n" : " \n") + x - ) - ) - .setImage(currGun.URL); - return message.reply({ embeds: [embed] }); - } - }, -}; -function weaponIdentifier(inpWeaponName) { - if (inpWeaponName.length < 2) { - return "The name `" + inpWeaponName + "` is too short."; - } - let probableWeapons = []; - for (let i = 0; i < guns.length; i++) { - if (inpWeaponName.Simplify() == guns[i].Name.Simplify()) { - return guns[i]; - } else if (guns[i].Name.Simplify().includes(inpWeaponName.Simplify())) { - probableWeapons.push(i); - } - } - - if (probableWeapons.length == 1) { - return guns[probableWeapons[0]]; - } - - for (let i = 0; i < weaponAlliasName.length; i++) { - for (let j = 0; j < weaponAlliasName[i].length; j++) { - if (weaponAlliasName[i][j].Simplify() == inpWeaponName.Simplify()) { - for (let i2 = 0; i2 < guns.length; i2++) { - if (weaponActualName[i].Simplify() == guns[i2].Name.Simplify()) { - return guns[i2]; - } - } - } - } - } - probableWeapons = [...new Set(probableWeapons)]; - if (probableWeapons.length == 1) { - return guns[probableWeapons[0]]; - } - if (probableWeapons.length > 1) { - return ( - "Did you mean `" + - probableWeapons - .map(x => guns[x].Name) - .reduce((out, x, i) => - [out, x].join(i === probableWeapons.length - 1 ? "` or `" : "`, `") - ) + - "`?" - ); - } - return "Couldn't identify the weapon: `" + '"' + inpWeaponName + '"`'; -} -\ No newline at end of file diff --git a/command/CODM/build.js b/command/CODM/build.js @@ -141,8 +141,8 @@ module.exports = { value: "passive", }, { - name: "Search & Destroy", - value: "snd", + name: "Search And Destroy", + value: "Search And Destroy", }, { name: "Respawn", @@ -264,8 +264,8 @@ module.exports = { value: "passive", }, { - name: "Search & Destroy", - value: "snd", + name: "Search And Destroy", + value: "Search And Destroy", }, { name: "Respawn", @@ -351,8 +351,8 @@ module.exports = { value: "passive", }, { - name: "Search & Destroy", - value: "snd", + name: "Search And Destroy", + value: "Search And Destroy", }, { name: "Respawn", @@ -434,8 +434,8 @@ module.exports = { value: "passive", }, { - name: "Search & Destroy", - value: "snd", + name: "Search And Destroy", + value: "Search And Destroy", }, { name: "Respawn", @@ -678,7 +678,7 @@ module.exports = { aggressive: "Aggressive", passive: "Passive", - snd: "Search And Destroy", + "Search And Destroy": "Search And Destroy", respawn: "Respawn", ads: "ADS", hipfire: "Hipfire", diff --git a/command/CODM/scorestreak.js b/command/CODM/scorestreak.js @@ -146,7 +146,7 @@ module.exports = { value: ` ${ d.manual - ? "<a:nyx_cross:897244999211696198> NO" + ? "<a:nyx_cross:897244999211696198> No" : "<a:nyx_checkmark:897240322411724841> Yes" }`, inline: true,