Skip to content

Commit

Permalink
Create owner-listmute.js
Browse files Browse the repository at this point in the history
  • Loading branch information
BOTCAHX authored Dec 17, 2024
1 parent 917c971 commit 093dae9
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions plugins/owner-listmute.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
let handler = async (m, { conn, args }) => {
let chats = global.db.data.chats;

let mutedChats = Object.entries(chats).filter(([_, chat]) => chat.isBanned);
if (args[0]) {
let index = parseInt(args[0]) - 1;
if (isNaN(index) || index < 0 || index >= mutedChats.length) {
return m.reply('Nomor yang kamu masukkan tidak valid.');
}

let [chatId] = mutedChats[index];
chats[chatId].isBanned = false;
m.reply(`Berhasil meng-unmute grup dengan ID: ${chatId}`);
} else {
if (mutedChats.length === 0) {
m.reply('Tidak ada grup yang sedang di-mute.');
} else {
let list = mutedChats.map(([id], i) => `${i + 1}. ${id}`).join('\n');
m.reply(`Daftar grup yang di-mute:\n\n${list}\n\nKetik *listmute [nomor]* untuk meng-unmute.`);
}
}
};

handler.help = ['listmute'];
handler.tags = ['owner'];
handler.command = ['listmute'];
handler.owner = true;

module.exports = handler;

0 comments on commit 093dae9

Please sign in to comment.