abstract away prefix + ev cmd
All checks were successful
Deploy bot / build-and-deploy (push) Successful in 14s
All checks were successful
Deploy bot / build-and-deploy (push) Successful in 14s
This commit is contained in:
@ -1,13 +1,19 @@
|
|||||||
exports.name = "bonus";
|
exports.name = "bonus";
|
||||||
exports.description =
|
exports.description =
|
||||||
":star: Sums and calculates bonus for player stat numbers.";
|
":star: Sums and calculates bonus for player stat numbers.";
|
||||||
exports.usage = "<<bonus <number> <number> [inf optional extra numbers]";
|
exports.usage =
|
||||||
exports.example = "<<bonus 100 100";
|
"CLIENT_PREFIX:bonus <number> <number> [inf optional extra numbers]";
|
||||||
|
exports.example = "CLIENT_PREFIX:bonus 100 100";
|
||||||
exports.hidden = false;
|
exports.hidden = false;
|
||||||
exports.run = (client, message, args) => {
|
exports.run = (client, message, args) => {
|
||||||
let is1nan = false;
|
let is1nan = false;
|
||||||
if (!args[0])
|
if (!args[0])
|
||||||
return message.channel.send("Not enough arguments, consult <<help.");
|
return message.channel.send(
|
||||||
|
"Not enough arguments, consult CLIENT_PREFIX:help.".replaceAll(
|
||||||
|
"CLIENT_PREFIX:",
|
||||||
|
client.prefix
|
||||||
|
)
|
||||||
|
);
|
||||||
args.forEach((arg) => {
|
args.forEach((arg) => {
|
||||||
if (isNaN(parseInt(arg))) {
|
if (isNaN(parseInt(arg))) {
|
||||||
is1nan = true;
|
is1nan = true;
|
||||||
@ -16,7 +22,10 @@ exports.run = (client, message, args) => {
|
|||||||
});
|
});
|
||||||
if (is1nan)
|
if (is1nan)
|
||||||
return message.channel.send(
|
return message.channel.send(
|
||||||
"You have provided invalid arguments to this command, please consult <<help."
|
"You have provided invalid arguments to this command, please consult CLIENT_PREFIX:help.".replaceAll(
|
||||||
|
"CLIENT_PREFIX:",
|
||||||
|
client.prefix
|
||||||
|
)
|
||||||
);
|
);
|
||||||
let sum = 0;
|
let sum = 0;
|
||||||
args.forEach((arg) => {
|
args.forEach((arg) => {
|
||||||
|
@ -1,16 +1,24 @@
|
|||||||
exports.name = "cat";
|
exports.name = "cat";
|
||||||
exports.description = ":cat: Calculates boost for cat.";
|
exports.description = ":cat: Calculates boost for cat.";
|
||||||
exports.usage = "<<cat <boost> <levels>";
|
exports.usage = "CLIENT_PREFIX:cat <boost> <levels>";
|
||||||
exports.example = "<<cat 80 120";
|
exports.example = "CLIENT_PREFIX:cat 80 120";
|
||||||
exports.hidden = false;
|
exports.hidden = false;
|
||||||
exports.run = (client, message, args) => {
|
exports.run = (client, message, args) => {
|
||||||
if (!args[0] || !args[1])
|
if (!args[0] || !args[1])
|
||||||
return message.channel.send("Not enough arguments, consult <<help.");
|
return message.channel.send(
|
||||||
|
"Not enough arguments, consult CLIENT_PREFIX:help.".replaceAll(
|
||||||
|
"CLIENT_PREFIX:",
|
||||||
|
client.prefix
|
||||||
|
)
|
||||||
|
);
|
||||||
let boost = parseInt(args[0]);
|
let boost = parseInt(args[0]);
|
||||||
let levels = parseInt(args[1]);
|
let levels = parseInt(args[1]);
|
||||||
if (isNaN(boost) || isNaN(levels))
|
if (isNaN(boost) || isNaN(levels))
|
||||||
return message.channel.send(
|
return message.channel.send(
|
||||||
"Boost or levels is not a number. Consult <<help."
|
"Boost or levels is not a number. Consult CLIENT_PREFIX:help.".replaceAll(
|
||||||
|
"CLIENT_PREFIX:",
|
||||||
|
client.prefix
|
||||||
|
)
|
||||||
);
|
);
|
||||||
let extraboost = Math.floor(levels / 3 - 3);
|
let extraboost = Math.floor(levels / 3 - 3);
|
||||||
let players = Math.floor(levels / 29) + 1;
|
let players = Math.floor(levels / 29) + 1;
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
exports.name = "cb";
|
exports.name = "cb";
|
||||||
exports.description =
|
exports.description =
|
||||||
":crossed_swords: Calculate calamity blade damage taking in to account projectile speed.";
|
":crossed_swords: Calculate calamity blade damage taking in to account projectile speed.";
|
||||||
exports.usage = "<<cb <damage> <ups> [projectile speed]";
|
exports.usage = "CLIENT_PREFIX:cb <damage> <ups> [projectile speed]";
|
||||||
exports.example = "<<cb 10000 250 10000";
|
exports.example = "CLIENT_PREFIX:cb 10000 250 10000";
|
||||||
exports.hidden = false;
|
exports.hidden = false;
|
||||||
exports.run = (client, message, args) => {
|
exports.run = (client, message, args) => {
|
||||||
if (!args[0] || !args[1])
|
if (!args[0] || !args[1])
|
||||||
return message.channel.send("Not enough arguments, consult <<help.");
|
return message.channel.send(
|
||||||
|
"Not enough arguments, consult CLIENT_PREFIX:help.".replaceAll(
|
||||||
|
"CLIENT_PREFIX:",
|
||||||
|
client.prefix
|
||||||
|
)
|
||||||
|
);
|
||||||
let cb = parseInt(args[0]);
|
let cb = parseInt(args[0]);
|
||||||
let ups = parseInt(args[1]);
|
let ups = parseInt(args[1]);
|
||||||
if (isNaN(cb) || isNaN(ups))
|
if (isNaN(cb) || isNaN(ups))
|
||||||
|
@ -128,9 +128,10 @@ function weightedInterpolatePrice(pricesArr, inputNum, p = 2) {
|
|||||||
exports.name = "estimate";
|
exports.name = "estimate";
|
||||||
exports.description =
|
exports.description =
|
||||||
":money_with_wings: Give an estimated price of certain items in cv.";
|
":money_with_wings: Give an estimated price of certain items in cv.";
|
||||||
exports.usage = "<<estimate [summary of item you want the price of]";
|
exports.usage =
|
||||||
|
"CLIENT_PREFIX:estimate [summary of item you want the price of]";
|
||||||
exports.example =
|
exports.example =
|
||||||
"<<estimate 1600 ab2\n<<estimate 1100 thp\n<<estimate 2400 app builder staff\n(you can also include `showtable` anywhere to show raw price data)\n(always put number first, do not put conflicting data to avoid confusion)";
|
"CLIENT_PREFIX:estimate 1600 ab2\nCLIENT_PREFIX:estimate 1100 thp\nCLIENT_PREFIX:estimate 2400 app builder staff\n(you can also include `showtable` anywhere to show raw price data)\n(always put number first, do not put conflicting data to avoid confusion)";
|
||||||
exports.hidden = false;
|
exports.hidden = false;
|
||||||
exports.run = async (client, message, args) => {
|
exports.run = async (client, message, args) => {
|
||||||
if (!args[0]) {
|
if (!args[0]) {
|
||||||
@ -139,7 +140,7 @@ exports.run = async (client, message, args) => {
|
|||||||
tbl += p.returnKeyWord + "\n";
|
tbl += p.returnKeyWord + "\n";
|
||||||
});
|
});
|
||||||
return message.channel
|
return message.channel
|
||||||
.send(`Available items in pricing table:\n\`\`\`\n${tbl}\`\`\`\nFor usage, consult \`<<help estimate\`
|
.send(`Available items in pricing table:\n\`\`\`\n${tbl}\`\`\`\nFor usage, consult \`CLIENT_PREFIX:help estimate\`.replaceAll("CLIENT_PREFIX:", client.prefix)
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
const combined = args.join(" ");
|
const combined = args.join(" ");
|
||||||
@ -156,7 +157,10 @@ exports.run = async (client, message, args) => {
|
|||||||
});
|
});
|
||||||
if (!gameValue) {
|
if (!gameValue) {
|
||||||
return message.channel.send(
|
return message.channel.send(
|
||||||
"You didn't include any numbers in your query. Try again or consult `<<help estimate`."
|
"You didn't include any numbers in your query. Try again or consult `CLIENT_PREFIX:help estimate`.".replaceAll(
|
||||||
|
"CLIENT_PREFIX:",
|
||||||
|
client.prefix
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
priceTable.forEach((price, idx) => {
|
priceTable.forEach((price, idx) => {
|
||||||
@ -200,6 +204,9 @@ exports.run = async (client, message, args) => {
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
message.channel.send(
|
message.channel.send(
|
||||||
"Your query couldn't be matched with anything, please refine your query or reffer to `<<help estimate` or use `<<estimate` to see all available price tables for more information."
|
"Your query couldn't be matched with anything, please refine your query or reffer to `CLIENT_PREFIX:help estimate` or use `CLIENT_PREFIX:estimate` to see all available price tables for more information.".replaceAll(
|
||||||
|
"CLIENT_PREFIX:",
|
||||||
|
client.prefix
|
||||||
|
)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
113
commands/ev.js
Normal file
113
commands/ev.js
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
const BASEDMG = 1e9; // absurdly high to avoid base damage bottleneck
|
||||||
|
|
||||||
|
function getHeroDamageScaling(statVal) {
|
||||||
|
return (
|
||||||
|
1.0 +
|
||||||
|
0.33 *
|
||||||
|
(Math.pow(4.0, 0.1 * 1.1) -
|
||||||
|
1.0 +
|
||||||
|
0.68 * (Math.pow(statVal + 1, 0.375 * 1.1) - 1.0))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAb2Scaling(statVal) {
|
||||||
|
return (
|
||||||
|
1.0 +
|
||||||
|
0.66 * (Math.pow(4.0, 0.0825) - 1.0) +
|
||||||
|
0.75 * (Math.pow(statVal + 1, 0.3375) - 1.0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTotalDamage(hdmgStat, baseDamage) {
|
||||||
|
return Math.max(
|
||||||
|
Math.max(32.0, Math.max(1.0, baseDamage)) *
|
||||||
|
getHeroDamageScaling(hdmgStat) *
|
||||||
|
(1.2 * 0.8 * 0.155),
|
||||||
|
1.0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBeamDamage(hdmg, ab2) {
|
||||||
|
return (
|
||||||
|
getTotalDamage(hdmg, BASEDMG) * 0.6 * Math.pow(getAb2Scaling(ab2), 0.93)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find optimal split of totalStats between hdmg and ab2
|
||||||
|
* using a binary/golden section search.
|
||||||
|
*/
|
||||||
|
function findOptimalDistribution(totalStats) {
|
||||||
|
let left = 0;
|
||||||
|
let right = totalStats;
|
||||||
|
const phi = (Math.sqrt(5) - 1) / 2; // golden ratio for faster convergence
|
||||||
|
let x1 = right - phi * (right - left);
|
||||||
|
let x2 = left + phi * (right - left);
|
||||||
|
|
||||||
|
while (Math.abs(right - left) > 1e-3) {
|
||||||
|
const f1 = getBeamDamage(x1, totalStats - x1);
|
||||||
|
const f2 = getBeamDamage(x2, totalStats - x2);
|
||||||
|
|
||||||
|
if (f1 < f2) {
|
||||||
|
left = x1;
|
||||||
|
x1 = x2;
|
||||||
|
x2 = left + phi * (right - left);
|
||||||
|
} else {
|
||||||
|
right = x2;
|
||||||
|
x2 = x1;
|
||||||
|
x1 = right - phi * (right - left);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const hdmg = (left + right) / 2;
|
||||||
|
const ab2 = totalStats - hdmg;
|
||||||
|
return {
|
||||||
|
hdmg: hdmg,
|
||||||
|
ab2: ab2,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.name = "ev";
|
||||||
|
exports.description =
|
||||||
|
":robot: Calculate how much hero damage/ab2 you should aim for.";
|
||||||
|
exports.usage =
|
||||||
|
"CLIENT_PREFIX:ev <hdmg> <ab2> OR CLIENT_PREFIX:ev <total stats>";
|
||||||
|
exports.example = "CLIENT_PREFIX:ev 6000 5000\nCLIENT_PREFIX:ev 10000";
|
||||||
|
exports.hidden = false;
|
||||||
|
exports.run = (client, message, args) => {
|
||||||
|
if (!args[0])
|
||||||
|
return message.channel.send(
|
||||||
|
"Not enough arguments, consult CLIENT_PREFIX:help.".replaceAll(
|
||||||
|
"CLIENT_PREFIX:",
|
||||||
|
client.prefix
|
||||||
|
)
|
||||||
|
);
|
||||||
|
let total = parseInt(args[0]);
|
||||||
|
if (isNaN(total))
|
||||||
|
return message.channel.send(
|
||||||
|
"One of the arguments is not a number. Consult CLIENT_PREFIX:help.".replaceAll(
|
||||||
|
"CLIENT_PREFIX:",
|
||||||
|
client.prefix
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if (args[1]) {
|
||||||
|
if (isNaN(parseInt(args[1]))) {
|
||||||
|
return message.channel.send(
|
||||||
|
"One of the arguments is not a number. Consult CLIENT_PREFIX:help.".replaceAll(
|
||||||
|
"CLIENT_PREFIX:",
|
||||||
|
client.prefix
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else total += parseInt(args[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const distribution = findOptimalDistribution(total);
|
||||||
|
|
||||||
|
message.channel.send(
|
||||||
|
`You should aim for **${
|
||||||
|
Math.round(distribution.hdmg) - 3
|
||||||
|
}** hero damage and **${
|
||||||
|
Math.round(distribution.ab2) + 3
|
||||||
|
}** ab2. *(approximately)*`
|
||||||
|
);
|
||||||
|
};
|
@ -27,16 +27,24 @@ function get_damage_multiplier(stat_val) {
|
|||||||
|
|
||||||
exports.name = "hb";
|
exports.name = "hb";
|
||||||
exports.description = ":muscle: Calculate hero boost's damage multiplier.";
|
exports.description = ":muscle: Calculate hero boost's damage multiplier.";
|
||||||
exports.usage = "<<hb <points>";
|
exports.usage = "CLIENT_PREFIX:hb <points>";
|
||||||
exports.example = "<<hb 5000";
|
exports.example = "CLIENT_PREFIX:hb 5000";
|
||||||
exports.hidden = false;
|
exports.hidden = false;
|
||||||
exports.run = (client, message, args) => {
|
exports.run = (client, message, args) => {
|
||||||
if (!args[0])
|
if (!args[0])
|
||||||
return message.channel.send("Not enough arguments, consult <<help.");
|
return message.channel.send(
|
||||||
|
"Not enough arguments, consult CLIENT_PREFIX:help.".replaceAll(
|
||||||
|
"CLIENT_PREFIX:",
|
||||||
|
client.prefix
|
||||||
|
)
|
||||||
|
);
|
||||||
let hbPoints = parseInt(args[0]);
|
let hbPoints = parseInt(args[0]);
|
||||||
if (isNaN(hbPoints))
|
if (isNaN(hbPoints))
|
||||||
return message.channel.send(
|
return message.channel.send(
|
||||||
"Given argument is not a number. Consult <<help."
|
"Given argument is not a number. Consult CLIENT_PREFIX:help.".replaceAll(
|
||||||
|
"CLIENT_PREFIX:",
|
||||||
|
client.prefix
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
message.channel.send(
|
message.channel.send(
|
||||||
|
@ -2,8 +2,8 @@ const { EmbedBuilder } = require("discord.js");
|
|||||||
exports.name = "help";
|
exports.name = "help";
|
||||||
exports.description =
|
exports.description =
|
||||||
":scroll: Shows this message and provides insight into other commands.";
|
":scroll: Shows this message and provides insight into other commands.";
|
||||||
exports.usage = "<<help [optional other command]";
|
exports.usage = "CLIENT_PREFIX:help [optional other command]";
|
||||||
exports.example = "<<help res";
|
exports.example = "CLIENT_PREFIX:help res";
|
||||||
exports.hidden = false;
|
exports.hidden = false;
|
||||||
exports.run = (client, message, args) => {
|
exports.run = (client, message, args) => {
|
||||||
let embed = new EmbedBuilder();
|
let embed = new EmbedBuilder();
|
||||||
@ -12,7 +12,10 @@ exports.run = (client, message, args) => {
|
|||||||
const cmd = client.commands.get(args[0]);
|
const cmd = client.commands.get(args[0]);
|
||||||
if (!cmd)
|
if (!cmd)
|
||||||
return message.channel.send(
|
return message.channel.send(
|
||||||
"Command not found, try `<<help` first."
|
"Command not found, try `CLIENT_PREFIX:help` first.".replaceAll(
|
||||||
|
"CLIENT_PREFIX:",
|
||||||
|
client.prefix
|
||||||
|
)
|
||||||
);
|
);
|
||||||
if (cmd.hidden && message.author.id != client.ownerID) return;
|
if (cmd.hidden && message.author.id != client.ownerID) return;
|
||||||
embed.setTitle(`Help for \`${cmd.name}\` command`);
|
embed.setTitle(`Help for \`${cmd.name}\` command`);
|
||||||
@ -20,11 +23,11 @@ exports.run = (client, message, args) => {
|
|||||||
embed.addFields(
|
embed.addFields(
|
||||||
{
|
{
|
||||||
name: "Usage",
|
name: "Usage",
|
||||||
value: cmd.usage,
|
value: cmd.usage.replaceAll("CLIENT_PREFIX:", client.prefix),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Example",
|
name: "Example",
|
||||||
value: cmd.example,
|
value: cmd.example.replaceAll("CLIENT_PREFIX:", client.prefix),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -34,7 +37,10 @@ exports.run = (client, message, args) => {
|
|||||||
if (cmd.hidden && message.author.id != client.ownerID) return;
|
if (cmd.hidden && message.author.id != client.ownerID) return;
|
||||||
embed.addFields({
|
embed.addFields({
|
||||||
name: cmd.name,
|
name: cmd.name,
|
||||||
value: cmd.description,
|
value: cmd.description.replaceAll(
|
||||||
|
"CLIENT_PREFIX:",
|
||||||
|
client.prefix
|
||||||
|
),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
exports.name = "ms";
|
exports.name = "ms";
|
||||||
exports.description =
|
exports.description =
|
||||||
":tada: Calculate moon staff damage taking in to account projectile speed.";
|
":tada: Calculate moon staff damage taking in to account projectile speed.";
|
||||||
exports.usage = "<<ms <elemental damage> <ups> [projectile speed]";
|
exports.usage = "CLIENT_PREFIX:ms <elemental damage> <ups> [projectile speed]";
|
||||||
exports.example = "<<ms 10000 250 10000";
|
exports.example = "CLIENT_PREFIX:ms 10000 250 10000";
|
||||||
exports.hidden = false;
|
exports.hidden = false;
|
||||||
exports.run = (client, message, args) => {
|
exports.run = (client, message, args) => {
|
||||||
if (!args[0] || !args[1])
|
if (!args[0] || !args[1])
|
||||||
return message.channel.send("Not enough arguments, consult <<help.");
|
return message.channel.send(
|
||||||
|
"Not enough arguments, consult CLIENT_PREFIX:help.".replaceAll(
|
||||||
|
"CLIENT_PREFIX:",
|
||||||
|
client.prefix
|
||||||
|
)
|
||||||
|
);
|
||||||
let moonstaff = parseInt(args[0]);
|
let moonstaff = parseInt(args[0]);
|
||||||
let ups = parseInt(args[1]);
|
let ups = parseInt(args[1]);
|
||||||
if (isNaN(moonstaff) || isNaN(ups))
|
if (isNaN(moonstaff) || isNaN(ups))
|
||||||
|
@ -11,8 +11,8 @@ function format(seconds) {
|
|||||||
|
|
||||||
exports.name = "ping";
|
exports.name = "ping";
|
||||||
exports.description = ":ping_pong: View service statistics.";
|
exports.description = ":ping_pong: View service statistics.";
|
||||||
exports.usage = "<<ping";
|
exports.usage = "CLIENT_PREFIX:ping";
|
||||||
exports.example = "<<ping";
|
exports.example = "CLIENT_PREFIX:ping";
|
||||||
exports.hidden = true;
|
exports.hidden = true;
|
||||||
exports.run = async (client, message, args) => {
|
exports.run = async (client, message, args) => {
|
||||||
message.channel.send("Fetching data...").then((m) => {
|
message.channel.send("Fetching data...").then((m) => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
exports.name = "refetch";
|
exports.name = "refetch";
|
||||||
exports.description = ":ninja: Refetch user react data.";
|
exports.description = ":ninja: Refetch user react data.";
|
||||||
exports.usage = "<<refetch";
|
exports.usage = "CLIENT_PREFIX:refetch";
|
||||||
exports.example = "<<refetch";
|
exports.example = "CLIENT_PREFIX:refetch";
|
||||||
exports.hidden = true;
|
exports.hidden = true;
|
||||||
exports.run = async (client, message, args) => {
|
exports.run = async (client, message, args) => {
|
||||||
if (message.author.id != client.ownerID) return;
|
if (message.author.id != client.ownerID) return;
|
||||||
|
@ -2,8 +2,8 @@ exports.name = "res";
|
|||||||
exports.description =
|
exports.description =
|
||||||
":shield: Calculates how much upgrades you need to max your resistances. For Ult pieces and better. (slightly inaccurate but this is hard to calculate)";
|
":shield: Calculates how much upgrades you need to max your resistances. For Ult pieces and better. (slightly inaccurate but this is hard to calculate)";
|
||||||
exports.usage =
|
exports.usage =
|
||||||
"<<res <res> <res> <res> [res] | <hero stat> <levels> [second hero stat]";
|
"CLIENT_PREFIX:res <res> <res> <res> [res] | <hero stat> <levels> [second hero stat]";
|
||||||
exports.example = "<<res -3 1 -16 14 | 406 440";
|
exports.example = "CLIENT_PREFIX:res -3 1 -16 14 | 406 440";
|
||||||
exports.hidden = false;
|
exports.hidden = false;
|
||||||
exports.run = (client, message, args) => {
|
exports.run = (client, message, args) => {
|
||||||
for (let i = 0; i < args.length; i++) {
|
for (let i = 0; i < args.length; i++) {
|
||||||
|
@ -28,16 +28,24 @@ function get_damage_multiplier(stat_val) {
|
|||||||
|
|
||||||
exports.name = "tb";
|
exports.name = "tb";
|
||||||
exports.description = ":fire: Calculate tower boost's damage multiplier.";
|
exports.description = ":fire: Calculate tower boost's damage multiplier.";
|
||||||
exports.usage = "<<tb <points>";
|
exports.usage = "CLIENT_PREFIX:tb <points>";
|
||||||
exports.example = "<<tb 5000";
|
exports.example = "CLIENT_PREFIX:tb 5000";
|
||||||
exports.hidden = false;
|
exports.hidden = false;
|
||||||
exports.run = (client, message, args) => {
|
exports.run = (client, message, args) => {
|
||||||
if (!args[0])
|
if (!args[0])
|
||||||
return message.channel.send("Not enough arguments, consult <<help.");
|
return message.channel.send(
|
||||||
|
"Not enough arguments, consult CLIENT_PREFIX:help.".replaceAll(
|
||||||
|
"CLIENT_PREFIX:",
|
||||||
|
client.prefix
|
||||||
|
)
|
||||||
|
);
|
||||||
let tbPoints = parseInt(args[0]);
|
let tbPoints = parseInt(args[0]);
|
||||||
if (isNaN(tbPoints))
|
if (isNaN(tbPoints))
|
||||||
return message.channel.send(
|
return message.channel.send(
|
||||||
"Given argument is not a number. Consult <<help."
|
"Given argument is not a number. Consult CLIENT_PREFIX:help.".replaceAll(
|
||||||
|
"CLIENT_PREFIX:",
|
||||||
|
client.prefix
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
message.channel.send(
|
message.channel.send(
|
||||||
|
10
index.js
10
index.js
@ -20,6 +20,7 @@ const client = new Client({
|
|||||||
});
|
});
|
||||||
client.commands = new Collection();
|
client.commands = new Collection();
|
||||||
client.ownerID = 263247134147608578;
|
client.ownerID = 263247134147608578;
|
||||||
|
client.prefix = prefix;
|
||||||
|
|
||||||
fs.readdir("./commands/", (err, files) => {
|
fs.readdir("./commands/", (err, files) => {
|
||||||
if (err) return console.error(err);
|
if (err) return console.error(err);
|
||||||
@ -73,8 +74,13 @@ client.on(Events.MessageCreate, async (message) => {
|
|||||||
const cmd = client.commands.get(command);
|
const cmd = client.commands.get(command);
|
||||||
|
|
||||||
if (!cmd) return;
|
if (!cmd) return;
|
||||||
|
try {
|
||||||
await cmd.run(client, message, args);
|
await cmd.run(client, message, args);
|
||||||
|
} catch (e) {
|
||||||
|
message.channel.send(
|
||||||
|
"Command " + cmd.name + " exited with an exception: " + e
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Log in to Discord with your client's token
|
// Log in to Discord with your client's token
|
||||||
|
20
old.js
20
old.js
@ -28,7 +28,7 @@ client.on(Events.MessageCreate, (message) => {
|
|||||||
return message.channel.send("not implemented.");
|
return message.channel.send("not implemented.");
|
||||||
if (!args[0] || !args[1])
|
if (!args[0] || !args[1])
|
||||||
return message.channel.send(
|
return message.channel.send(
|
||||||
"Not enough arguments, consult <<help."
|
"Not enough arguments, consult CLIENT_PREFIX:help."
|
||||||
);
|
);
|
||||||
let ab1 = parseInt(args[0]);
|
let ab1 = parseInt(args[0]);
|
||||||
let ab2 = parseInt(args[1]);
|
let ab2 = parseInt(args[1]);
|
||||||
@ -42,7 +42,7 @@ client.on(Events.MessageCreate, (message) => {
|
|||||||
return message.channel.send("not implemented.");
|
return message.channel.send("not implemented.");
|
||||||
if (!args[0] || !args[1])
|
if (!args[0] || !args[1])
|
||||||
return message.channel.send(
|
return message.channel.send(
|
||||||
"Not enough arguments, consult <<help."
|
"Not enough arguments, consult CLIENT_PREFIX:help."
|
||||||
);
|
);
|
||||||
let ab1 = parseInt(args[0]);
|
let ab1 = parseInt(args[0]);
|
||||||
let ab2 = parseInt(args[1]);
|
let ab2 = parseInt(args[1]);
|
||||||
@ -57,7 +57,7 @@ client.on(Events.MessageCreate, (message) => {
|
|||||||
if (command == "ms") {
|
if (command == "ms") {
|
||||||
if (!args[0] || !args[1])
|
if (!args[0] || !args[1])
|
||||||
return message.channel.send(
|
return message.channel.send(
|
||||||
"Not enough arguments, consult <<help."
|
"Not enough arguments, consult CLIENT_PREFIX:help."
|
||||||
);
|
);
|
||||||
let cb = parseInt(args[0]);
|
let cb = parseInt(args[0]);
|
||||||
let ups = parseInt(args[1]);
|
let ups = parseInt(args[1]);
|
||||||
@ -209,7 +209,7 @@ client.on(Events.MessageCreate, (message) => {
|
|||||||
if (command == "cat") {
|
if (command == "cat") {
|
||||||
if (!args[0] || !args[1])
|
if (!args[0] || !args[1])
|
||||||
return message.channel.send(
|
return message.channel.send(
|
||||||
"Not enough arguments, consult <<help."
|
"Not enough arguments, consult CLIENT_PREFIX:help."
|
||||||
);
|
);
|
||||||
let boost = parseInt(args[0]);
|
let boost = parseInt(args[0]);
|
||||||
let levels = parseInt(args[1]);
|
let levels = parseInt(args[1]);
|
||||||
@ -225,7 +225,7 @@ client.on(Events.MessageCreate, (message) => {
|
|||||||
if (command == "bident") {
|
if (command == "bident") {
|
||||||
if (!args[0] || !args[1])
|
if (!args[0] || !args[1])
|
||||||
return message.channel.send(
|
return message.channel.send(
|
||||||
"Not enough arguments, consult <<help."
|
"Not enough arguments, consult CLIENT_PREFIX:help."
|
||||||
);
|
);
|
||||||
let damage = parseInt(args[0]);
|
let damage = parseInt(args[0]);
|
||||||
let ups = parseInt(args[1]);
|
let ups = parseInt(args[1]);
|
||||||
@ -250,7 +250,7 @@ client.on(Events.MessageCreate, (message) => {
|
|||||||
if (command == "cdrag") {
|
if (command == "cdrag") {
|
||||||
if (!args[0] || !args[1] || !args[2])
|
if (!args[0] || !args[1] || !args[2])
|
||||||
return message.channel.send(
|
return message.channel.send(
|
||||||
"Not enough arguments, consult <<help."
|
"Not enough arguments, consult CLIENT_PREFIX:help."
|
||||||
);
|
);
|
||||||
let damage = parseInt(args[0]);
|
let damage = parseInt(args[0]);
|
||||||
let upgrades = parseInt(args[1]);
|
let upgrades = parseInt(args[1]);
|
||||||
@ -270,19 +270,19 @@ client.on(Events.MessageCreate, (message) => {
|
|||||||
embed.addFields(
|
embed.addFields(
|
||||||
{
|
{
|
||||||
name: "cat",
|
name: "cat",
|
||||||
value: ":cat: Calculates boost for cat. (<<cat <boost> <levels>)",
|
value: ":cat: Calculates boost for cat. (CLIENT_PREFIX:cat <boost> <levels>)",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "cdrag",
|
name: "cdrag",
|
||||||
value: ":dragon: Calculate damage for crystaline dragon taking into account upgrades and additional projectiles. (<<cdrag <base> <ups> <extra projectiles>)",
|
value: ":dragon: Calculate damage for crystaline dragon taking into account upgrades and additional projectiles. (CLIENT_PREFIX:cdrag <base> <ups> <extra projectiles>)",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "cb",
|
name: "cb",
|
||||||
value: ":crossed_swords: Calculate calamity blade damage taking in to account speed. (<<cb <damage> <ups> [proj speed])",
|
value: ":crossed_swords: Calculate calamity blade damage taking in to account speed. (CLIENT_PREFIX:cb <damage> <ups> [proj speed])",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "bident",
|
name: "bident",
|
||||||
value: ":trident: Calculate bident damage taking in to account speed and charge speed. (<<bident <damage> <ups> [proj speed] [charge speed])",
|
value: ":trident: Calculate bident damage taking in to account speed and charge speed. (CLIENT_PREFIX:bident <damage> <ups> [proj speed] [charge speed])",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "ms",
|
name: "ms",
|
||||||
|
Reference in New Issue
Block a user