.setDescription("Create a secret santa for all of your friends or for your server! Whether you celebrate the holidays or not, this can still be loads of fun!")
if(client.misc.activeDMs.has(message.author.id)){returnmessage.reply("I'm already asking you questions in DM for a separate command! Finish that command before using this one.");}
letmesg=awaitmessage.author.send("I'll be asking you a few questions here about how you want your Secret Santa to go! You can simply ignore the messages for a few minutes to cancel the process.").catch(()=>{message.reply("Please open your DMs so I can ask you some questions!");});
letconf=awaitask(mesg,"This secret santa will be tied to your account, and you will be considered the host. Is this okay?",60000,true);if(!conf){returnclearDM();}
if(['n','no'].includes(conf.trim().toLowerCase())){clearDM();returndmch.send("Oh, alrighty! Have the person who wants to be the host execute this same command.");}
if(!['yes','ye','y','sure'].includes(conf.trim().toLowerCase())){clearDM();returndmch.send("Please specify yes or no you weeb!");}
letstart=awaitask(mesg,"When will you begin the secret santa? (You'll start it manually, so don't worry about formatting.",60000,true);if(!start){returnclearDM();}
if(start.length>150){clearDM();returndmch.send("Heya there, just a few words, please! I don't wanna have to read out an essay about when it's starting to all the people that want to hear about your secret santa!");}
letend=awaitask(mesg,"When will you end the secret santa? (You'll also end it manually.)",60000,true);if(!end){returnclearDM();}
if(end.length>150){clearDM();returndmch.send("Heya there, just a few words, please! I don't wanna have to read out an essay about when it's ending to all the people that want to hear about your secret santa!");}
letspend=awaitask(mesg,"What is your maximum and minimum spending? This is useful so that everyone gets an equal gift or gifts. This will be shown to the people that buy their gifts.",360000,true);if(!spend){returnclearDM();}
if(spend.length>500){clearDM();returndmch.send("Mate, this is not a dissertation! Let's keep it under 500 characters, please!");}
letanon=awaitask(mesg,"Will you be keeping this secret santa totally anonymous, or will you let the gift recipients know who their gifters are when they are opened? Type \"yes\" if you will be keeping it anonymous, and \"no\" otherwise.",360000,true);if(!anon){returnclearDM();}
letinfo=awaitask(mesg,"What information would you like me to ask joining members to provide when they join your secret santa? (Whatever you type will be shown directly to them when.)",360000,true);if(!info){returnclearDM();}
if(info.length>750){clearDM();returndmch.send("Let's keep it under 750 characters, please.");}
letnotes=awaitask(mesg,"Are there any other notes you'd like to add? If not, just write N/A or something of that nature.",360000,true);if(!ask){returnclearDM();}
if(notes.length>500){clearDM();returndmch.send("Let's keep it under 500 characters, please.");}
letfconf=awaitask(mesg,"Would you like to continue and create the secret santa? By doing so, you agree that:\n-Natsuki and its developers are not responsible for anything financially-related to your secret santa\n-Anyone with your join code can join the secret santa\n-You are responsible for notifying your members of any changes or updates.\n-I am not responsible for any eggnog that may or may not be stolen from you by Wubzy. *for legal reasons this is a joke*\n\n-The answers you have submitted are what you want to use, as they cannot be changed.",120000,true);if(!fconf){returnclearDM();}
if(['n','no'].includes(conf.trim().toLowerCase())){clearDM();returndmch.send("Oh, yikes. Is it about the eggnog? Sorry about that hehe...");}
if(!['yes','ye','y','sure'].includes(conf.trim().toLowerCase())){clearDM();returndmch.send("Please specify yes or no you weeb!");}
letid;
while(true){
id=require('../util/makeid')(6);
lettest=awaitSS.findOne({ssid:id});
if(!test){break;}
}
lettss=newSS({
ssid:id,
owner:message.author.id,
start:start,
end:end,
anon:anon,
spend:spend,
info:info,
notes:notes,
members:[],
started:false
});
tss.save();
clearDM();
returndmch.send(newDiscord.MessageEmbed()
.setTitle("Secret Santa Created!")
.setDescription("Your Secret Santa has been completed! Have your members join by using `n?secretsanta join <ID>` where the ID is the ID displayed below. You can start your secret santa when you have at least 3 members with `n?secretsanta start <ID>`. If someone joins that you don't want in your secret santa, use `n?secretsanta kick <ID> <@member|userID>`. If you want to also participate, just join the same way as everyone else.")
if(client.misc.activeDMs.has(message.author.id)){returnmessage.reply("I'm already asking you questions in DM for a separate command! Finish that command before using this one.");}
letmesg=awaitmessage.author.send("I'll be asking you a few questions here about you and what you want! You can simply ignore the messages for a few minutes to cancel the process.").catch(()=>{message.reply("Please open your DMs so I can ask you some questions!");});
letdmch=mesg.channel;
leto=awaitclient.users.fetch(tss.owner);
awaitdmch.send(newDiscord.MessageEmbed()
.setTitle("This Secret Santa!")
.setDescription("This is the one you're trying to join!")
if(info.length>750){clearDM();returndmch.send("Let's keep that under 750 characters. No need to put your entire Christmas list on there :smirk:");}
letconf=awaitask(mesg,"Before we finish, do you agree to the following things:\n-I, Natsuki, and my developers, are not responsible for anything financially-related to your Secret Santa\n-You should contact the host if you have questions\n-These answers you gave are final and will be seen by the person who draws you.\n-You *need* to have your DMs open so that I can reach you when drawing time comes!",120000,true);
if(['n','no'].includes(conf.trim().toLowerCase())){clearDM();returndmch.send("Alrighty! I've discarded your responses :P");}
if(!['yes','ye','y','sure'].includes(conf.trim().toLowerCase())){clearDM();returndmch.send("Please specify yes or no you weeb!");}
awaitmem.send(`The secret santa has been started!\nYou've been assigned to **${assignment.name}**. They've written the following about what they want:\n\`${assignment.info}\`\n\nThe host has said this about when you should when you should have your gifts purchased and when you'll do gift exchange:\n\`${tss.end}\`\n\nThe following info is written on how much to spend on gifts: \n\`${tss.spend}\``)
.catch(async()=>{
lethost=awaitclient.users.fetch(tss.owner);
awaithost.send(`There was a problem sending ${mem.name} their info. Please tell that member that they have been assigned to \`${assignment.name}\` and that they want \`${assignment.info}\`.`);