no idea wtf is happening
This commit is contained in:
parent
6e8fbe15e7
commit
9db31abc02
5 changed files with 655 additions and 664 deletions
|
@ -1,6 +1,6 @@
|
||||||
const common = require("../../util/functions/common");
|
const common = require("../../util/functions/common");
|
||||||
const data = require("../../util/Data/data.json");
|
const data = require("../../util/Data/data.json");
|
||||||
const Discord = require("discord.js");
|
const { MessageEmbed } = require("discord.js");
|
||||||
|
|
||||||
let currGun,
|
let currGun,
|
||||||
currStats,
|
currStats,
|
||||||
|
@ -52,12 +52,15 @@ module.exports = {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
run: async (client, interaction, args) => {
|
run: async (client, interaction, args) => {
|
||||||
|
repEmb = null;
|
||||||
recoilAvailable = false;
|
recoilAvailable = false;
|
||||||
hasError = false;
|
hasError = false;
|
||||||
console.log(args);
|
if (args.length == 1)
|
||||||
const repEmb = statsHandler(args.join(" ").replace("\n", " "));
|
repEmb = statsHandler(args.join(" ").replace("\n", " "));
|
||||||
|
else repEmb = statsHandler(args.join(" + ").replace("\n", " "));
|
||||||
|
|
||||||
if (hasError) {
|
if (hasError) {
|
||||||
interaction.followUp({ embeds: [repEmb] });
|
interaction.followUp({ embeds: [new MessageEmbed(repEmb)] });
|
||||||
}
|
}
|
||||||
if (recoilAvailable) {
|
if (recoilAvailable) {
|
||||||
repEmb.fields.push({
|
repEmb.fields.push({
|
||||||
|
@ -68,7 +71,7 @@ module.exports = {
|
||||||
const recoilImageLink = await chart.getShortUrl();
|
const recoilImageLink = await chart.getShortUrl();
|
||||||
repEmb.image = { url: recoilImageLink };
|
repEmb.image = { url: recoilImageLink };
|
||||||
}
|
}
|
||||||
interaction.followUp({ embeds: [repEmb] });
|
interaction.followUp({ embeds: [new MessageEmbed(repEmb)] });
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
3
index.js
3
index.js
|
@ -1,7 +1,8 @@
|
||||||
|
const { HTTPError, DiscordAPIError } = require("discord.js");
|
||||||
const NYX = require("./client/NYX");
|
const NYX = require("./client/NYX");
|
||||||
const client = new NYX();
|
const client = new NYX();
|
||||||
module.exports = client;
|
module.exports = client;
|
||||||
process.on("unhandledRejection", err => {
|
process.on("unhandledRejection", err => {
|
||||||
console.log(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
client.start();
|
client.start();
|
||||||
|
|
|
@ -166,7 +166,7 @@ module.exports = {
|
||||||
inline: false,
|
inline: false,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.setThumbnail(`${d.preview}`)
|
.setThumbnail(d.preview)
|
||||||
.setFooter(`Made by ${client.author}`, client.user.displayAvatarURL())
|
.setFooter(`Made by ${client.author}`, client.user.displayAvatarURL())
|
||||||
.setColor(
|
.setColor(
|
||||||
d.type == "lethal"
|
d.type == "lethal"
|
||||||
|
|
44
util/dist/handler.js
vendored
44
util/dist/handler.js
vendored
|
@ -1,3 +1,4 @@
|
||||||
|
const { DiscordAPIError, HTTPError } = require("discord.js");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const cmds = [];
|
const cmds = [];
|
||||||
const ownercmds = [];
|
const ownercmds = [];
|
||||||
|
@ -30,27 +31,28 @@ module.exports = async client => {
|
||||||
client.on("ready", async () => {
|
client.on("ready", async () => {
|
||||||
const gg = client.guilds.cache.get("840225563193114624");
|
const gg = client.guilds.cache.get("840225563193114624");
|
||||||
await gg.commands.set(ownercmds);
|
await gg.commands.set(ownercmds);
|
||||||
await client.application.commands.set(cmds).then(async cmd => {
|
await client.application.commands
|
||||||
client.guilds.cache.forEach(g => {
|
.set(cmds)
|
||||||
const getroles = name => {
|
.then(async cmd => {
|
||||||
const perms = cmds.find(n => n.name == name).UserPerms;
|
client.guilds.cache.forEach(g => {
|
||||||
if (!perms) return null;
|
const getroles = name => {
|
||||||
return g.roles.cache.filter(
|
const perms = cmds.find(n => n.name == name).UserPerms;
|
||||||
z => z.permissions.has(perms) && !z.managed
|
if (!perms) return null;
|
||||||
);
|
return g.roles.cache.filter(
|
||||||
};
|
z => z.permissions.has(perms) && !z.managed
|
||||||
const fullPermissions = cmd.reduce((accumulator, v) => {
|
);
|
||||||
const roles = getroles(v.name);
|
};
|
||||||
if (!roles) return accumulator;
|
const fullPermissions = cmd.reduce((accumulator, v) => {
|
||||||
const permissions = roles.reduce((a, w) => {
|
const roles = getroles(v.name);
|
||||||
return [...a, { id: w.id, type: "ROLE", permission: true }];
|
if (!roles) return accumulator;
|
||||||
|
const permissions = roles.reduce((a, w) => {
|
||||||
|
return [...a, { id: w.id, type: "ROLE", permission: true }];
|
||||||
|
}, []);
|
||||||
|
return [...accumulator, { id: v.id, permissions }];
|
||||||
}, []);
|
}, []);
|
||||||
return [...accumulator, { id: v.id, permissions }];
|
g.commands.permissions.set({ fullPermissions }).catch(null);
|
||||||
}, []);
|
});
|
||||||
try {
|
})
|
||||||
g.commands.permissions.set({ fullPermissions });
|
.catch(null);
|
||||||
} catch {}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue