choco-bot
Version:
Whatsapp-bot
20 lines (18 loc) • 520 B
JavaScript
async function archiveChat(msg, client) {
const chatId = msg.from;
const chat = await msg.getChat();
if (!chat.archived){
try {
chat.archive()
msg.reply('Chat archived successfully.');
} catch (error) {
console.error('Error archiving chat:', error);
msg.reply('Unable to archive the chat. Please try again later.');
}
}else{
msg.reply('Unable to archive the chat. Chat is already archived');
}
}
module.exports = {
archiveChat,
};