if(!message.member.permissions.has("MANAGE_MESSAGES")&&!message.member.permissions.has("MANAGE_GUILD")){returnmessage.reply("You must be a server moderator (manage messages or manage server permissions) to use this command.");}
if(!user){returnmessage.channel.send("Either you didn't mention a user, or I can't find that user!");}
if(user.id===client.user.id){returnmessage.reply("don't worry about clearing any warnings from me... you can't give me warnings in the first place");}
if(client.users.cache.get(user.id).bot){returnmessage.reply("it's not like a bot would have any warnings in the first place...");}
user=user?user:message.member;
letmh=awaitMod.findOne({gid:message.guild.id});
if(!mh||!Object.keys(mh.warnings).length){returnmessage.reply("There are no warnings available in this server.");}
if(!Object.keys(mh.warnings).includes(user.id)||!mh.warnings[user.id].length){returnmessage.reply(`${user.id===message.author.id?'You have':'That user has'} never been warned in this server.`);}
letmhcases=mh.cases;
letmoddedcases=[];
letcwc=0;varwc=0;
letwarning;for(warningofmh.warnings[user.id]){
if(mhcases[`${warning-1}`].status!=="Cleared"){
lettcase=mhcases[`${warning-1}`];
tcase.status="Cleared";
tcase.history.push(`${newDate().toISOString()} - ${message.author.username} - Cleared the warning.`);