Finally realise I mistype BotPerms in kick command and wtf discord devs removed command perms!?!?!?!?!

This commit is contained in:
night0721 2022-07-02 10:06:48 +01:00
parent 868d66acda
commit 092581c5fb
2 changed files with 23 additions and 24 deletions

View file

@ -3,7 +3,7 @@ module.exports = {
name: "kick",
description: "Kick an user",
UserPerms: ["KICK_MEMBERS"],
BotPems: ["KICK_MEMBERS"],
BotPerms: ["KICK_MEMBERS"],
usage: "(User) {Reason}",
category: "Moderation",
options: [

45
util/dist/handler.js vendored
View file

@ -29,28 +29,27 @@ module.exports = async client => {
});
client.on("ready", async () => {
await client.guilds.cache.get("840225563193114624").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 }];
}, []);
return [...accumulator, { id: v.id, permissions }];
}, []);
g.commands.permissions.set({ fullPermissions }).catch(null);
});
})
.catch(null);
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 }];
// }, []);
// g.commands.permissions.set({ fullPermissions }).catch(null);
// });
// })
// .catch(null);
});
};