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) => {
repEmb = null;
recoilAvailable = false;
hasError = false;
console.log(args, args.join("+"));
const repEmb = statsHandler(args.join(" ").replace("\n", " "));
if (args.length == 1)
repEmb = statsHandler(args.join(" ").replace("\n", " "));
else repEmb = statsHandler(args.join(" + ").replace("\n", " "));
if (hasError) {
interaction.followUp({ embeds: [new MessageEmbed(repEmb)] });
}

View file

@ -1,7 +1,8 @@
const { HTTPError, DiscordAPIError } = require("discord.js");
const NYX = require("./client/NYX");
const client = new NYX();
module.exports = client;
process.on("unhandledRejection", err => {
console.log(err);
console.error(err);
});
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 cmds = [];
const ownercmds = [];
@ -30,27 +31,28 @@ module.exports = async client => {
client.on("ready", async () => {
const gg = client.guilds.cache.get("840225563193114624");
await gg.commands.set(ownercmds);
await client.application.commands.set(cmds).then(async cmd => {
client.guilds.cache.forEach(g => {
const getroles = name => {
const perms = cmds.find(n => n.name == name).UserPerms;
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 permissions = roles.reduce((a, w) => {
return [...a, { id: w.id, type: "ROLE", permission: true }];
await client.application.commands
.set(cmds)
.then(async cmd => {
client.guilds.cache.forEach(g => {
const getroles = name => {
const perms = cmds.find(n => n.name == name).UserPerms;
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 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 }];
}, []);
try {
g.commands.permissions.set({ fullPermissions });
} catch {}
});
});
g.commands.permissions.set({ fullPermissions }).catch(null);
});
})
.catch(null);
});
};

File diff suppressed because it is too large Load diff