Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Commit

Permalink
Beta Update
Browse files Browse the repository at this point in the history
Better error handling on logs.
  • Loading branch information
17teen committed Jun 20, 2021
1 parent 42d65b9 commit 4823052
Show file tree
Hide file tree
Showing 495 changed files with 72,891 additions and 17 deletions.
33 changes: 26 additions & 7 deletions Global/bladee.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ client.on("guildDelete", guild => {

const guildID = guild.id

const currentPath = path.join(__dirname, "Commands/Database/Guilds", `${guildID}.json`);
const destinationPath = path.join(__dirname, "Commands/Database/Backup Guilds", `${guildID}.json`);
const currentPath = path.join(__dirname, "commands/database/guilds", `${guildID}.json`);
const destinationPath = path.join(__dirname, "commands/database/backup_guilds", `${guildID}.json`);

mv(currentPath, destinationPath, function (err) {
if (err) {
Expand Down Expand Up @@ -264,6 +264,8 @@ client.on("guildBanAdd", async (guild, user) => {
if (err) {
return console.error(yellowBright('[WARNING]: Databse for Guild ID: ' + guildID + ' has not been set up as an Event has been triggered. Tip: Use [prefix]set for setting up a Database.'))
} else {

if (!fetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries."));

const banLog = fetchingLogs.entries.first();

Expand Down Expand Up @@ -362,15 +364,17 @@ client.on("guildMemberRemove", async member => {
return console.log(`${red("[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`)
});

if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries."));

const kickLog = FetchingLogs.entries.first();

const path = `./commands/database/guilds/${guildID}.json`;

fs.access(path, fs.F_OK, (err) => {
if (err) {
return console.error(yellowBright('[WARNING]: Databse for Guild ID: ' + guildID + ' has not been set up as an Event has been triggered. Tip: Use [prefix]set for setting up a Database.'))
} else {

const kickLog = FetchingLogs.entries.first();

if (!kickLog) {
return console.log(red(`[Fetch Log Error]: This Log Type: 'MEMBER_KICK' has not been previously seen before while the 'guildMemberRemove' event has been trigerred.`));
} else {
Expand Down Expand Up @@ -468,6 +472,8 @@ client.on("channelCreate", async (channel) => {
return console.log(`${red("[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`)
});

if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries."));

const path = `./commands/database/guilds/${guildID}.json`;

fs.access(path, fs.F_OK, (err) => {
Expand Down Expand Up @@ -723,6 +729,8 @@ client.on("channelDelete", async (channel) => {
return console.log(`${red("[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`)
});

if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries."));

const path = `./commands/database/guilds/${guildID}.json`;

fs.access(path, fs.F_OK, (err) => {
Expand Down Expand Up @@ -977,6 +985,8 @@ client.on("guildMemberAdd", async (member) => {
return console.log(`${red("[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`)
});

if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries."));

const path = `./commands/database/guilds/${guildID}.json`;

fs.access(path, fs.F_OK, (err) => {
Expand Down Expand Up @@ -1089,6 +1099,8 @@ client.on("roleCreate", async (role) => {
return console.log(`${red("[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`)
});

if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries."));

const path = `./commands/database/guilds/${guildID}.json`;

fs.access(path, fs.F_OK, (err) => {
Expand Down Expand Up @@ -1194,6 +1206,7 @@ client.on("roleUpdate", async (oldRole, newRole) => {
return console.log(`${red("[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`)
});

if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries."));

const path = `./commands/database/guilds/${guildID}.json`;

Expand Down Expand Up @@ -1483,15 +1496,17 @@ client.on("guildMemberUpdate", async (oldMember, newMember) => {
return console.log(`${red("[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`)
});

if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries."));

const MRU = FetchingLogs.entries.first();

const path = `./commands/database/guilds/${guildID}.json`;

fs.access(path, fs.F_OK, (err) => {
if (err) {
return console.error(yellowBright('[WARNING]: Databse for Guild ID: ' + guildID + ' has not been set up as an Event has been triggered. Tip: Use [prefix]set for setting up a Database.'))
} else {

const MRU = FetchingLogs.entries.first();

if (!MRU) {
return console.log(`${red(`[Fetch Log Error]: This Log Type: 'MEMBER_ROLE_UPDATE' has not been previously seen before while the 'guildMemberUpdate' event has been trigerred.`)}`);
} else {
Expand Down Expand Up @@ -1772,9 +1787,11 @@ client.on("webhookUpdate", async channel => {
limit: 1,
type: "WEBHOOK_CREATE"
}).catch((err) => {
return console.log(`${red("[Log Type]: 'WEBHOOK_DELETE'\n[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`)
return console.log(`${red("[Log Type]: 'WEBHOOK_CREATE'\n[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`)
});

if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries."));

fs.access(path, fs.F_OK, (err) => {
if (err) {
return console.error(yellowBright('[WARNING]: Databse for Guild ID: ' + guildID + ' has not been set up as an Event has been triggered. Tip: Use [prefix]set for setting up a Database.'))
Expand Down Expand Up @@ -1875,6 +1892,8 @@ client.on("webhookUpdate", async channel => {
return console.log(`${red("[Log Type]: 'WEBHOOK_DELETE'\n[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`)
});

if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries."));

const path = `./commands/database/guilds/${guildID}.json`;

fs.access(path, fs.F_OK, (err) => {
Expand Down
27 changes: 17 additions & 10 deletions Private/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ client.on("guildBanAdd", async (guild, user) => {
return console.log(`${red("[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`)
});

if (!fetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries."));

const banLog = fetchingLogs.entries.first();

if (!banLog) {
Expand Down Expand Up @@ -277,6 +279,8 @@ client.on("guildMemberRemove", async member => {
return console.log(`${red("[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`)
});

if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries."));

const kickLog = FetchingLogs.entries.first();

if (!kickLog) {
Expand Down Expand Up @@ -370,6 +374,8 @@ client.on("channelCreate", async (channel) => {
}).catch((err) => {
return console.log(`${red("[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`)
});

if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries."));

const ChannelLog = FetchingLogs.entries.first();

Expand Down Expand Up @@ -610,6 +616,8 @@ client.on("channelDelete", async (channel) => {
return console.log(`${red("[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`)
});

if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries."));

const ChannelLog = FetchingLogs.entries.first();

if (!ChannelLog) {
Expand Down Expand Up @@ -849,6 +857,7 @@ client.on("guildMemberAdd", async (member) => {
return console.log(`${red("[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`)
});

if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries."));

const botAddLog = FetchingLogs.entries.first();

Expand Down Expand Up @@ -949,6 +958,7 @@ client.on("roleCreate", async (role) => {
return console.log(`${red("[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`)
});

if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries."));

const roleCreateLogs = FetchingLogs.entries.first();

Expand Down Expand Up @@ -1039,6 +1049,8 @@ client.on("roleUpdate", async (oldRole, newRole) => {
return console.log(`${red("[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`)
});

if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries."));

const RoleUpdate = FetchingLogs.entries.first();

if (!RoleUpdate) {
Expand Down Expand Up @@ -1315,6 +1327,8 @@ client.on("guildMemberUpdate", async (oldMember, newMember) => {
return console.log(`${red("[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`)
});

if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries."));

const MRU = FetchingLogs.entries.first();

if (!MRU) {
Expand Down Expand Up @@ -1592,11 +1606,8 @@ client.on("webhookUpdate", async channel => {
}).catch((err) => {
return console.log(`${red("[Log Type]: 'WEBHOOK_DELETE'\n[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`)
});

if (err) {
return console.error(yellowBright('[WARNING]: Databse for Guild ID: ' + guildID + ' has not been set up as an Event has been triggered. Tip: Use [prefix]set for setting up a Database.'))
} else {


if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries."));
const WBU = FetchingLogs.entries.first();

if (!WBU) {
Expand Down Expand Up @@ -1673,7 +1684,6 @@ client.on("webhookUpdate", async channel => {
return console.log(`${grey(`[Event Validity]: False`)}\n${magenta("[Reason]: Event was triggered but the timestamps didn't match.")}\n${cyan("[Executor]: " + executor.tag)}\n${cyanBright("[Target]: " + target.tag + " (Bot)")}\n${grey("======================================")}\n`)
}
}
}

});

Expand All @@ -1688,9 +1698,7 @@ client.on("webhookUpdate", async channel => {
return console.log(`${red("[Log Type]: 'WEBHOOK_DELETE'\n[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`)
});

if (err) {
return console.error(yellowBright('[WARNING]: Databse for Guild ID: ' + guildID + ' has not been set up as an Event has been triggered. Tip: Use [prefix]set for setting up a Database.'))
} else {
if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries."));

const WBD = FetchingLogs.entries.first();

Expand Down Expand Up @@ -1768,7 +1776,6 @@ client.on("webhookUpdate", async channel => {
return console.log(`${grey(`[Event Validity]: False`)}\n${magenta("[Reason]: Event was triggered but the timestamps didn't match.")}\n${cyan("[Executor]: " + executor.tag)}\n${cyanBright("[Target]: " + target.tag + " (Bot)")}\n${grey("======================================")}\n`)
}
}
}
});


Expand Down
12 changes: 12 additions & 0 deletions node_modules/.bin/mkdirp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/mkdirp.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions node_modules/.bin/mkdirp.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions node_modules/.bin/ncp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/ncp.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions node_modules/.bin/ncp.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions node_modules/.bin/rimraf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/rimraf.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4823052

Please sign in to comment.