remove validation bypass as it is a big validation issue

This commit is contained in:
Parker2991
2025-10-16 10:54:53 -05:00
parent e33988d103
commit 2f21f670e0
3 changed files with 1 additions and 100 deletions
-59
View File
@@ -1,59 +0,0 @@
const CommandContext = require("../../commandUtil/CommandContext");
const trustLevel = require("../../commandUtil/CommandTrustLevel");
class auth extends CommandContext {
constructor() {
super(
"auth",
["authentication"],
"auth through the bot so you dont need to use a hash everytime",
trustLevel.trusted,
[""],
);
}
execute(context) {
const bot = context.bot;
const args = context.arguments;
const source = context.source;
const config = context.config;
const uuid = source.player.uuid;
let component = []
if (source.player.validateBypass)
throw new CommandError(`You are already authed!`);
if (source.player.trustLevel === 1) {
bot.auth.add({
player: uuid,
trustLevel: "trusted",
});
component.push({
text: "Authed as Trusted",
color: config.colors.help.trusted
})
} else if (source.player.trustLevel === 2) {
bot.auth.add({
player: uuid,
trustLevel: "admin",
});
component.push({
text: "Authed as Admin",
color: config.colors.help.admin
})
} else if (source.player.trustLevel === 3) {
bot.auth.add({
player: source.player.uuid,
trustLevel: "owner",
});
component.push({
text: "Authed as Owner",
color: config.colors.help.owner
})
}
source.sendFeedback(component)
}
}
module.exports = auth;
-32
View File
@@ -1,32 +0,0 @@
class auth {
constructor(context) {
const bot = context.bot;
const options = context.options;
const config = context.config;
bot.auth = {
list: [],
find(player) {
this.list.find();
},
add(player) {
this.list.push(player);
},
remove(player) {
this.list.splice(player, 1);
},
clear() {
this.list = [];
},
};
bot.on("end", () => bot.auth.clear());
bot.on("player_left", (data) => {
const players = bot.auth.list.find((e) => e?.player === data[0])?.player;
if (players === data[0]) bot.auth.remove(data);
});
}
}
module.exports = auth;
+1 -9
View File
@@ -21,7 +21,6 @@ class commandManager {
const command = this.getCommand(commandName.toLowerCase());
try {
const authFind = bot.auth.list.find((e) => e.player === source.player.uuid)
if (!command) {
throw new CommandError({
translate: "%s%s%s %s",
@@ -35,15 +34,8 @@ class commandManager {
})
}
if (authFind) {
source.player.validateBypass = true
if (authFind.trustLevel === "trusted") source.player.trustLevel = 1;
else if (authFind.trustLevel === "admin") source.player.trustLevel = 2;
else if (authFind.trustLevel === "owner") source.player.trustLevel = 3;
}
if (command?.data?.trustLevel !== 0 && command?.data.trustLevel < 4) {
if (!source.player.validateBypass && !source.sources.console && !source.sources.discord) {
if (!source.sources.console && !source.sources.discord) {
if (args[0] === bot.validation.trusted)
source.player.trustLevel = 1
else if (args[0] === bot.validation.admin)