2
0
mirror of https://github.com/thedevs-network/the-guard-bot synced 2025-10-13 14:15:51 +00:00

added try...catch on some async/awaits

This commit is contained in:
Pouria Ezzati
2017-09-23 21:49:23 +03:30
parent 34f34420bf
commit d525b4a37b
8 changed files with 61 additions and 11 deletions

View File

@@ -3,6 +3,7 @@
// Utils
const { loadJSON } = require('../../utils/json');
const { link } = require('../../utils/tg');
const { logError } = require('../../utils/log');
// Config
const { masterID } = loadJSON('config.json');
@@ -25,7 +26,11 @@ const adminHandler = async ({ message, reply }) => {
return reply('Already admin');
}
await admin(userToAdmin);
try {
await admin(userToAdmin);
} catch (err) {
logError(process.env.DEBUG)(err);
}
return reply(`${link(userToAdmin)} is now <b>admin</b>.`, replyOptions);
};