choco-bot
Version:
Whatsapp-bot
31 lines (23 loc) • 733 B
JavaScript
const fs = require('fs');
const allowedUserId = '2349068528956@c.us'; // Replace with the actual user ID who has permission
function isUserAllowed(userId) {
return userId === allowedUserId;
}
function deleteList(listName, msg) {
const lists = require('../lists.json');
if (!lists[listName]) {
msg.reply(`List "${listName}" does not exist.`);
return;
}
const userId = msg.from;
if (isUserAllowed(userId)) {
delete lists[listName];
fs.writeFileSync('lists.json', JSON.stringify(lists, null, 2));
msg.reply(`List "${listName}" deleted successfully.`);
} else {
msg.reply('You do not have permission to delete lists.');
}
}
module.exports = {
deleteList,
};