This commit is contained in:
atorop
2024-11-02 10:44:44 +03:00
parent 2d82b6ce4b
commit dc63404ab5
3 changed files with 17 additions and 17 deletions

View File

@@ -45,7 +45,7 @@ exports.parseTickets = async (bot, messageData) => {
await sleep(1000);
}
}catch(e){
fs.appendFileSync(dir + "/../logs/logs.txt", e.stack);
fs.appendFileSync(dir + "/../logs/logs.txt", e.stack + "\n\n");
}
messageData.ticket = ticketId;
fs.writeFileSync(dir + "/../data/messageData.json", JSON.stringify(messageData, null, 3));
@@ -82,7 +82,7 @@ exports.parseComments = async (bot, messageData) => {
await bot.telegram.sendMessage(conf.supportChatId, messageText, {parse_mode: "HTML", message_thread_id: messageData.data[ticketId].threadId});
}
}catch(e){
fs.appendFileSync(dir + "/../logs/logs.txt", e.stack);
fs.appendFileSync(dir + "/../logs/logs.txt", e.stack + "\n\n");
}
messageData.comment = commentId;
fs.writeFileSync(dir + "/../data/messageData.json", JSON.stringify(messageData, null, 3));
@@ -96,7 +96,7 @@ exports.refreshStatus = async (bot, messageData) => {
if(!listTickets[i] || !messageData.data.hasOwnProperty(listTickets[i].id)) continue;
await this.editTicketStatus(bot, messageData, listTickets[i].id, true);
}catch(e){
fs.appendFileSync(dir + "/../logs/logs.txt", e.stack);
fs.appendFileSync(dir + "/../logs/logs.txt", e.stack + "\n\n");
}
}
fs.writeFileSync(dir + "/../data/messageData.json", JSON.stringify(messageData, null, 3));
@@ -139,6 +139,6 @@ exports.editTicketStatus = async (bot, messageData, ticketId, fastRequests) => {
}
}
}catch(e){
fs.appendFileSync(dir + "/../logs/logs.txt", e.stack);
fs.appendFileSync(dir + "/../logs/logs.txt", e.stack + "\n\n");
}
}

View File

@@ -26,7 +26,7 @@ exports.createTicket = async (title, description) => {
});
return response.data.id;
}catch(e){
fs.appendFileSync(__dirname + "/../logs/logs.txt", e.stack);
fs.appendFileSync(__dirname + "/../logs/logs.txt", e.stack + "\n\n");
}
}
@@ -51,7 +51,7 @@ exports.changeStatusTicket = async (ticketId, statusId) => {
});
return response;
}catch(e){
fs.appendFileSync(__dirname + "/../logs/logs.txt", e.stack);
fs.appendFileSync(__dirname + "/../logs/logs.txt", e.stack + "\n\n");
}
}
@@ -77,7 +77,7 @@ exports.assignTicket = async (ticketId, userId) => {
});
return response.data;
}catch(e){
fs.appendFileSync(__dirname + "/../logs/logs.txt", e.stack);
fs.appendFileSync(__dirname + "/../logs/logs.txt", e.stack + "\n\n");
}
}
@@ -96,7 +96,7 @@ exports.getItem = async(item, id) => { // ITILFollowup = комментари
});
return response.data;
}catch(e){
fs.appendFileSync(__dirname + "/../logs/logs.txt", e.stack);
fs.appendFileSync(__dirname + "/../logs/logs.txt", e.stack + "\n\n");
}
}
@@ -115,7 +115,7 @@ exports.getAllItems = async(item, cnt) => {
});
return response.data;
}catch(e){
fs.appendFileSync(__dirname + "/../logs/logs.txt", e.stack);
fs.appendFileSync(__dirname + "/../logs/logs.txt", e.stack + "\n\n");
}
}
@@ -141,7 +141,7 @@ exports.addComment = async(ticketId, comment) => {
});
return response.data;
}catch(e){
fs.appendFileSync(__dirname + "/../logs/logs.txt", e.stack);
fs.appendFileSync(__dirname + "/../logs/logs.txt", e.stack + "\n\n");
}
}
@@ -166,7 +166,7 @@ exports.removeComment = async(ticketId, commentId) => {
});
return response.data;
}catch(e){
fs.appendFileSync(__dirname + "/../logs/logs.txt", e.stack);
fs.appendFileSync(__dirname + "/../logs/logs.txt", e.stack + "\n\n");
}
}
@@ -185,6 +185,6 @@ exports.getUsers = async(ticketId) => {
});
return response.data;
}catch(e){
fs.appendFileSync(__dirname + "/../logs/logs.txt", e.stack);
fs.appendFileSync(__dirname + "/../logs/logs.txt", e.stack + "\n\n");
}
}

View File

@@ -26,7 +26,7 @@ exports.htmlToText = async (text) => {
}
return messageText.replace(/\[.*?\]/g, '');
}catch(e){
fs.appendFileSync(dir + "/../logs/logs.txt", e.stack);
fs.appendFileSync(dir + "/../logs/logs.txt", e.stack + "\n\n");
}
}
@@ -52,7 +52,7 @@ exports.parseMessageText = async (ticket, ticketAuthor, color) => {
}
return messageText;
}catch(e){
fs.appendFileSync(dir + "/../logs/logs.txt", e.stack);
fs.appendFileSync(dir + "/../logs/logs.txt", e.stack + "\n\n");
}
}
@@ -76,7 +76,7 @@ exports.createThread = async (bot, messageData, ticketId, title) => {
messageData.data[ticketId].pinMessageId = msg.message_id;
fs.writeFileSync(dir + "/../data/messageData.json", JSON.stringify(messageData, null, 3));
}catch(e){
fs.appendFileSync(dir + "/../logs/logs.txt", e.stack);
fs.appendFileSync(dir + "/../logs/logs.txt", e.stack + "\n\n");
}
}
@@ -115,7 +115,7 @@ exports.editMessageText = async (bot, messageId, messageText, keyboard) => {
reply_markup: {inline_keyboard: keyboard}
});
}catch(e){
//fs.appendFileSync(dir + "/../logs/logs.txt", e.stack);
//fs.appendFileSync(dir + "/../logs/logs.txt", e.stack + "\n\n");
}
}
@@ -123,7 +123,7 @@ exports.editMessageMarkup = async (bot, messageId, keyboard) => {
try{
await bot.telegram.editMessageReplyMarkup(conf.supportChatId, messageId, undefined, {inline_keyboard: keyboard});
}catch(e){
//fs.appendFileSync(dir + "/../logs/logs.txt", e.stack);
//fs.appendFileSync(dir + "/../logs/logs.txt", e.stack + "\n\n");
}
}