if(!args.length){returnmessage.channel.send(`List syntax: \`${prefix}todo list <create|delete|list|listName>\`. Use your list's name and then \`<add|list|delete|edit|view|complete|uncomplete>\` to manage the list's items.`);}
if(args[0].toLowerCase()==='quick'){returnmessage.channel.send(`To manage your personal quick list, please use the list syntax without \`list quick\` added. (Use \`${prefix}help todo\` for help.)`);}
if(td&&Object.keys(td.lists).length===10){returnmessage.channel.send("Sorry, but you've reached the maximum list count of 10. Delete some lists you've completed... or get off your bum and maybe start checking off some items? :eyes:");}
letln;
if(!args[1]){
ln=awaitask(message,"What would you like your list's name to be? This question will time out in 30s",60000);
if(!ln){returnmessage.channel.send("This question has timed out.");}
}else{ln=args[1].trim().toLowerCase();}
if(ln.length>15){returnmessage.channel.send("List names must be 15 characters or less.");}
if(!ln.match(/^[a-z-]+$/gm)){returnmessage.channel.send("List names must contain only letters and hyphens.");}
if(['create','c','n','new','a','add','d','delete','r','remove','l','list','e','edit','v','view','comp','complete','uc','uncomp','uncomplete'].includes(ln)){returnmessage.channel.send("That list name is invalid as it is used for the functionality of this command.");}
if(ln==='quick'){returnmessage.channel.send("You cannot use that name as it is used for your personal list.");}
if(td&&td.lists[ln]){returnmessage.channel.send("You already have a list with that name.");}
.setDescription(`You now have **${Object.keys(td.lists).length}** lists (including your personal list) with a total of **${totalItems} items**.`)
.addField("Managing",`-To add to your new list, use \`${prefix}todo list ${ln} add\`.\n-To view its items, use \`${prefix}todo list ${ln} view\`.\n-To delete this list, use \`${prefix}todo list delete ${ln}\`.`)
catch{returnmessage.channel.send("This question has timed out. Please try again!");}
ln=collected.first().content.trim();
}else{ln=args[1].trim().toLowerCase();}
if(!td.lists[ln]){returnmessage.channel.send("You don't have a list that matches that name!");}
deletetd.lists[ln];
td.markModified(`lists.${ln}`);
awaittd.save();
letnum=Math.ceil(Math.random()*10);
returnmessage.channel.send(num===5
?"I've successfully yeeted that list off the face of the planet for you!"
:["Good riddance! I've removed that list for you.","Spring cleanup! That list is gone.","That's a whole chunk of stuff you don't gotta worry about anymore. I've made sure of that.","Fear not, I've made sure that list won't bug you anymore."][Math.floor(Math.random()*4)]
}else{returnmessage.channel.send("Valid `list` args: `<create|delete|list|listName>`. If you tried to specify a list name, it may not exist or you don't have any lists.");}
}
if(['add','a'].includes(args[0].toLowerCase())){
letlist='quick';
lettd=awaitTD.findOne({uid:message.author.id});
if(td&&td.lists.quick.length>20){returnmessage.channel.send("Sorry, but your list can only have 20 items or less.");}
if(td&&td.lists[list].length===25){returnmessage.channel.send("Sorry, but your list can only have 25 items or less.");}
letitem;
if(!args[1]){item=awaitask(message,"What would you like to add to your quick list?",90000);if(!item){return;}}
else{args.shift();item=args.join(" ");}
if(item.length>100){returnmessage.channel.send("ToDo items can only be less than 100 characters.");}
client.users.fetch(client.developers[0]).then(wubzy=>wubzy.send("Hey stupid, someone got the todo length bug. Fix it."));
returnmessage.channel.send("There was an error displaying your list. It might have too many characters. This bug has been reported to the developers and will be fixed soon! Join the support server for updates.");});
}else{
if(isNaN(Number(args[1]))&&!['last','l'].includes(args[1].toLowerCase().trim())){returnmessage.channel.send("You didn't give me a number!");}