This commit is contained in:
@ -3,6 +3,7 @@ exports.description =
|
||||
":star: Sums and calculates bonus for player stat numbers.";
|
||||
exports.usage = "<<bonus <number> <number> [inf optional extra numbers]";
|
||||
exports.example = "<<bonus 100 100";
|
||||
exports.hidden = false;
|
||||
exports.run = (client, message, args) => {
|
||||
let is1nan = false;
|
||||
if (!args[0])
|
||||
|
@ -2,6 +2,7 @@ exports.name = "cat";
|
||||
exports.description = ":cat: Calculates boost for cat.";
|
||||
exports.usage = "<<cat <boost> <levels>";
|
||||
exports.example = "<<cat 80 120";
|
||||
exports.hidden = false;
|
||||
exports.run = (client, message, args) => {
|
||||
if (!args[0] || !args[1])
|
||||
return message.channel.send("Not enough arguments, consult <<help.");
|
||||
|
@ -3,6 +3,7 @@ exports.description =
|
||||
":crossed_swords: Calculate calamity blade damage taking in to account projectile speed.";
|
||||
exports.usage = "<<cb <damage> <ups> [projectile speed]";
|
||||
exports.example = "<<cb 10000 250 10000";
|
||||
exports.hidden = false;
|
||||
exports.run = (client, message, args) => {
|
||||
if (!args[0] || !args[1])
|
||||
return message.channel.send("Not enough arguments, consult <<help.");
|
||||
|
@ -4,6 +4,7 @@ exports.description =
|
||||
":scroll: Shows this message. (this bot is a crude imitation of tbolt's better bot :P)";
|
||||
exports.usage = "<<help [optional other command]";
|
||||
exports.example = "<<help res";
|
||||
exports.hidden = false;
|
||||
exports.run = (client, message, args) => {
|
||||
let embed = new EmbedBuilder();
|
||||
embed.setTitle("Commands Helper");
|
||||
@ -13,6 +14,7 @@ exports.run = (client, message, args) => {
|
||||
return message.channel.send(
|
||||
"Command not found, try `<<help` first."
|
||||
);
|
||||
if (cmd.hidden && message.author.id != client.ownerID) return;
|
||||
embed.setTitle(`Help for \`${cmd.name}\` command`);
|
||||
embed.setDescription(cmd.description);
|
||||
embed.addFields(
|
||||
@ -27,6 +29,7 @@ exports.run = (client, message, args) => {
|
||||
);
|
||||
} else {
|
||||
client.commands.forEach((cmd) => {
|
||||
if (cmd.hidden && message.author.id != client.ownerID) return;
|
||||
embed.addFields({
|
||||
name: cmd.name,
|
||||
value: cmd.description,
|
||||
|
@ -3,6 +3,7 @@ exports.description =
|
||||
":tada: Calculate moon staff damage taking in to account projectile speed.";
|
||||
exports.usage = "<<ms <elemental damage> <ups> [projectile speed]";
|
||||
exports.example = "<<ms 10000 250 10000";
|
||||
exports.hidden = false;
|
||||
exports.run = (client, message, args) => {
|
||||
if (!args[0] || !args[1])
|
||||
return message.channel.send("Not enough arguments, consult <<help.");
|
||||
|
20
commands/refetch.js
Normal file
20
commands/refetch.js
Normal file
@ -0,0 +1,20 @@
|
||||
exports.name = "refetch";
|
||||
exports.description = ":ninja: Refetch user react data.";
|
||||
exports.usage = "<<refetch";
|
||||
exports.example = "<<refetch";
|
||||
exports.hidden = true;
|
||||
exports.run = async (client, message, args) => {
|
||||
const url = "https://drive.overflow.fun/public/react.json";
|
||||
client.usersToReactTo = [];
|
||||
const res = await fetch(url);
|
||||
const data = await res.json();
|
||||
|
||||
client.usersToReactTo = data.map((entry) => {
|
||||
const [userId, emoji] = entry.split(":");
|
||||
return { userId, emoji };
|
||||
});
|
||||
|
||||
message.channel.send(
|
||||
"Refetched react data. " + JSON.stringify(client.usersToReactTo)
|
||||
);
|
||||
};
|
@ -4,6 +4,7 @@ exports.description =
|
||||
exports.usage =
|
||||
"<<res <res> <res> <res> [res] | <hero stat> <levels> [second hero stat]";
|
||||
exports.example = "<<res -3 1 -16 14 | 406 440";
|
||||
exports.hidden = false;
|
||||
exports.run = (client, message, args) => {
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
if (args[i] == "|") continue;
|
||||
|
17
index.js
17
index.js
@ -19,6 +19,7 @@ const client = new Client({
|
||||
],
|
||||
});
|
||||
client.commands = new Collection();
|
||||
client.ownerID = 263247134147608578;
|
||||
|
||||
fs.readdir("./commands/", (err, files) => {
|
||||
if (err) return console.error(err);
|
||||
@ -32,12 +33,12 @@ fs.readdir("./commands/", (err, files) => {
|
||||
});
|
||||
|
||||
const url = "https://drive.overflow.fun/public/react.json";
|
||||
let userstoreact = [];
|
||||
client.usersToReactTo = [];
|
||||
client.once(Events.ClientReady, async (readyClient) => {
|
||||
const res = await fetch(url);
|
||||
const data = await res.json();
|
||||
|
||||
userstoreact = data.map((entry) => {
|
||||
client.usersToReactTo = data.map((entry) => {
|
||||
const [userId, emoji] = entry.split(":");
|
||||
return { userId, emoji };
|
||||
});
|
||||
@ -46,12 +47,14 @@ client.once(Events.ClientReady, async (readyClient) => {
|
||||
|
||||
client.on(Events.MessageCreate, async (message) => {
|
||||
if (message.author.bot) return;
|
||||
console.log(message.mentions.users);
|
||||
|
||||
userstoreact.forEach(async (usr) => {
|
||||
if (message.mentions.users.find((u) => u.id == usr.userId)) {
|
||||
client.usersToReactTo.forEach(async (item) => {
|
||||
if (
|
||||
message.mentions.users.find((u) => u.id == item.userId) &&
|
||||
!message.reference
|
||||
) {
|
||||
try {
|
||||
await message.react(usr.emoji);
|
||||
await message.react(item.emoji);
|
||||
} catch (err) {
|
||||
console.error("Failed to react to message:", err);
|
||||
}
|
||||
@ -67,7 +70,7 @@ client.on(Events.MessageCreate, async (message) => {
|
||||
|
||||
if (!cmd) return;
|
||||
|
||||
cmd.run(client, message, args);
|
||||
await cmd.run(client, message, args);
|
||||
});
|
||||
|
||||
// Log in to Discord with your client's token
|
||||
|
Reference in New Issue
Block a user