const { Client, Events, GatewayIntentBits, EmbedBuilder, } = require("discord.js"); const token = process.env.TOKEN; const prefix = process.env.PREFIX; // Create a new client instance const client = new Client({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent, ], }); // When the client is ready, run this code (only once). // The distinction between `client: Client` and `readyClient: Client` is important for TypeScript developers. // It makes some properties non-nullable. client.once(Events.ClientReady, (readyClient) => { console.log(`Ready! Logged in as ${readyClient.user.tag}`); }); client.on(Events.MessageCreate, (message) => { if (message.author.bot) return; if (message.content.indexOf(prefix) !== 0) return; const args = message.content.slice(prefix.length).trim().split(/ +/g); const command = args.shift().toLowerCase(); if (command == "bonus") { if (!args[0]) return message.channel.send( "Not enough arguments, consult < { if (isNaN(parseInt(arg))) return message.channel.send( "Please provide atleast 1 number." ); arg = parseInt(arg); }); } catch (e) { return message.channel.send("Please provide 1 number."); } let sum = 0; args.forEach((arg) => { if (arg > 2000) arg = 2000; sum += parseInt(arg); }); message.channel.send( `Will reach ${sum}, ${Math.ceil(sum * 1.4)} with bonus.` ); } if (command == "ev") { return message.channel.send("not implemented."); if (!args[0] || !args[1]) return message.channel.send( "Not enough arguments, consult < { if (res == null) return; if (res > 29) return message.channel.send( "Please provide a number between 0 and 29. LMAO" ); if (res < 29) { if (res < 0) { let underzero = Math.abs(res); if (underzero < 13) { resUpgrades += 23 + Math.abs(res); } else { if (underzero == 13 || underzero == 14) { resUpgrades += 23 + 13; } if (underzero == 15 || underzero == 16) { resUpgrades += 23 + 13 + 1; } if (underzero == 17 || underzero == 18) { resUpgrades += 23 + 13 + 2; } if ( underzero == 19 || underzero == 20 || underzero == 22 ) { resUpgrades += 23 + 13 + 3; } if (underzero == 21 || underzero == 23) { resUpgrades += 23 + 13 + 4; } if (underzero > 23) { resUpgrades += 29 - underzero; } } // from 1% to 23% takes 17-18 ups // from 23% to 29% takes 6 ups // from 1% to 29% takes 23 ups // 23 + Math.abs(res) console.log( "gotta spend " + (23 + Math.abs(res)) + " upgrades to max res for negative" ); } else { //14 skips 15 to 16 //15 skips 16 to 17 //17 skips 18 to 19 //19 skips 20 to 21 //21 skips to 24 // list: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,18,20,23 // possible if 15,17,19,21,24 //amount of numbers: 18 // skipped 5 upgrades //example 4 // 5,6,7,8,9,10,11,12,13,14,16,18,20,23 // count: 14 // to 29% + 6, result 20 if (res < 14) { let am = 14 - res; resUpgrades += am + 4 + 6; console.log( "gotta spend " + (am + 4 + 6) + " upgrades to max res for positive, am: " + am ); } else { if (res == 14) { resUpgrades += 4 + 6; } if (res == 15 || res == 16) { resUpgrades += 3 + 6; } if (res == 17 || res == 18) { resUpgrades += 2 + 6; } if (res == 19 || res == 20 || res == 22) { resUpgrades += 1 + 6; } if (res == 21 || res == 23) { resUpgrades += 6; } if (res > 23) { resUpgrades += 29 - res; } console.log( "gotta spend " + resUpgrades + " upgrades to max res for positive, res: " + res ); } } } }); upgrades -= resUpgrades; mainStat += upgrades; let over = 0; if (mainStat > 999) { let over = mainStat - 999; mainStat -= over; substat += over; } message.channel.send( `With ${resUpgrades} upgrades spent in resistances, your piece will reach ${ mainStat + substat }, or ${Math.ceil(mainStat * 1.4 + substat * 1.4)} with set bonus!` ); } if (command == "cat") { if (!args[0] || !args[1]) return message.channel.send( "Not enough arguments, consult < 4) players = 4; message.channel.send( `Should be atleast ${ boost + extraboost }. Will boost atleast ${players} players.` ); } if (command == "bident") { if (!args[0] || !args[1]) return message.channel.send( "Not enough arguments, consult < [res] | [hero stat] [levels] [second hero stat])", }, { name: "bonus", value: ":star: Sums and calculates bonus for numbers. (< [inf optional extra numbers])", }, { name: "cat", value: ":cat: Calculates boost for cat. (< )", }, { name: "cdrag", value: ":dragon: Calculate damage for crystaline dragon taking into account upgrades and additional projectiles. (< )", }, { name: "cb", value: ":crossed_swords: Calculate calamity blade damage taking in to account speed. (< [proj speed])", }, { name: "bident", value: ":trident: Calculate bident damage taking in to account speed and charge speed. (< [proj speed] [charge speed])", }, { name: "ms", value: ":tada: Calculate moon staff damage taking in to account speed (< [proj speed])", }, { name: "help", value: ":scroll: Shows this message. (bot is a tbot replacement for this server :P)", } ); embed.setColor(0x00ff00); message.channel.send({ embeds: [embed] }); } }); // Log in to Discord with your client's token client.login(token);