Use logger instead of default log + exceptions handling

main
Killian 4 years ago
parent 0c057fb38e
commit e0803fd509

@ -4,7 +4,7 @@ module.exports = class {
}
async emit(user) {
console.log(`${user.fullName} (${user.username}) wants to follow you.`)
this.client.logger.log(`${user.fullName} (${user.username}) wants to follow you.`, `log`)
user.approveFollow();
}
}

@ -4,6 +4,6 @@ module.exports = class {
}
async emit(user, message) {
console.log(`${user.fullName} (${user.username}) liked a message from ${message.author.fullName} (${message.author.username})`)
this.client.logger.log(`${user.fullName} (${user.username}) liked a message from ${message.author.fullName} (${message.author.username})`, `log`)
}
}

@ -4,6 +4,6 @@ module.exports = class {
}
async emit(user, message) {
console.log(`${user.fullName} (${user.username}) disliked a message from ${message.author.fullName} (${message.author.username})`)
this.client.logger.log(`${user.fullName} (${user.username}) disliked a message from ${message.author.fullName} (${message.author.username})`, `log`)
}
}

@ -5,6 +5,6 @@ module.exports = class {
async emit(cachedMessage) {
if (!cachedMessage) return;
console.log(`@${cachedMessage.author.username} has just deleted their message: ${cachedMessage.content}`);
this.client.logger.log(`@${cachedMessage.author.username} has just deleted their message: ${cachedMessage.content}`, `log`);
}
}

@ -4,7 +4,7 @@ module.exports = class {
}
async emit(user) {
console.log(`${user.fullName} (${user.username}) started following you.`)
this.client.logger.log(`${user.fullName} (${user.username}) started following you.`, `log`)
user.follow();
}
}

@ -36,9 +36,26 @@ const initialize = async () => {
};
initialize();
client.logger.log(` ___ _ `)
client.logger.log(` |_ _|_ __ ___| |_ __ _ __ _ _ __ __ _ _ __ ___ `)
client.logger.log(` | || '_ \\/ __| __/ _\` |/ _\` | '__/ _\` | '_ \` _ \\ `)
client.logger.log(` | || | | \\__ \\ || (_| | (_| | | | (_| | | | | | |`)
client.logger.log(` |___|_| |_|___/\\__\\__,_|\\__, |_| \\__,_|_| |_| |_|`)
client.logger.log(` |___/ `)
client.logger.log(` ___ _ `);
client.logger.log(` |_ _|_ __ ___| |_ __ _ __ _ _ __ __ _ _ __ ___ `);
client.logger.log(` | || '_ \\/ __| __/ _\` |/ _\` | '__/ _\` | '_ \` _ \\ `);
client.logger.log(` | || | | \\__ \\ || (_| | (_| | | | (_| | | | | | |`);
client.logger.log(` |___|_| |_|___/\\__\\__,_|\\__, |_| \\__,_|_| |_| |_|`);
client.logger.log(` |___/ `);
process.on(`uncaughtException`, (error) => {
if (!client) return;
client.logger.log(`uncaughtException\n` + error.message);
});
process.on(`unhandledRejection`, (listener) => {
if (!client) return;
client.logger.log(`unhandledRejection\n` + listener.message);
});
process.on(`rejectionHandled`, (listener) => {
if (!client) return;
client.logger.log(`rejectionHandled\n` + listener.message);
});
process.on(`warning`, (warning) => {
if (!client) return;
client.logger.log(`warning\n` + warning.message);
});

@ -1,6 +1,6 @@
{
"name": "instabot",
"version": "1.2.1",
"version": "1.2.6",
"description": "A fully working instagram bot using Insta.js by androz2091",
"main": "index.js",
"scripts": {

Loading…
Cancel
Save