no idea wtf is happening

This commit is contained in:
night0721 2022-01-23 09:06:11 +08:00
parent 6e8fbe15e7
commit 9db31abc02
5 changed files with 655 additions and 664 deletions

View file

@ -1,6 +1,6 @@
const common = require("../../util/functions/common");
const data = require("../../util/Data/data.json");
const Discord = require("discord.js");
const { MessageEmbed } = require("discord.js");
let currGun,
currStats,
@ -52,12 +52,15 @@ module.exports = {
},
],
run: async (client, interaction, args) => {
repEmb = null;
recoilAvailable = false;
hasError = false;
console.log(args);
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: [repEmb] });
interaction.followUp({ embeds: [new MessageEmbed(repEmb)] });
}
if (recoilAvailable) {
repEmb.fields.push({
@ -68,7 +71,7 @@ module.exports = {
const recoilImageLink = await chart.getShortUrl();
repEmb.image = { url: recoilImageLink };
}
interaction.followUp({ embeds: [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 client = new NYX();
module.exports = client;
process.on("unhandledRejection", err => {
console.log(err);
console.error(err);
});
client.start();

View file

@ -166,7 +166,7 @@ module.exports = {
inline: false,
}
)
.setThumbnail(`${d.preview}`)
.setThumbnail(d.preview)
.setFooter(`Made by ${client.author}`, client.user.displayAvatarURL())
.setColor(
d.type == "lethal"

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