This commit is contained in:
night0721 2022-01-25 06:43:04 +08:00
commit 0baa253d2c
4 changed files with 651 additions and 660 deletions

View file

@ -52,10 +52,13 @@ 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, args.join("+")); 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: [new MessageEmbed(repEmb)] }); interaction.followUp({ embeds: [new MessageEmbed(repEmb)] });
} }

View file

@ -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();

44
util/dist/handler.js vendored
View file

@ -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