UNPKG

avamaxboobs

Version:

A package for randomly selecting images of various people's boobs. Intended to be used for discord bot commands.

22 lines (17 loc) 807 B
const fs = require('fs') const path = require('path') /** * Create a custom list * @param {string} name the name of the custom list * @example CreateCustomList('boobs') //creates a custom list named 'boobs' */ async function CreateCustomList(name){ if(typeof name!='string') throw new Error('Name must be a string'); if(name.length<1) throw new Error('Name must be at least 1 character') const lists = fs.readdirSync(path.join(__dirname.slice(0,__dirname.length-15),'lists')); if(lists.includes(`${name}.json`)) throw new Error(`You already have a list with the name ${name}! To add to it, use the addToList() function`) fs.writeFileSync(path.join(__dirname.slice(0,__dirname.length-15),'lists',`${name}.json`),`{\n"${name}":[]\n}`) } module.exports={ CreateCustomList }