flaggedapi
v3.3.0
Published
This is an Anti-cusser, a cool logging system and an all around API for all things TheFlagen430297
Downloads
23
Maintainers
Readme
//This is the demo code, it has a lot of possibilities. 🤣
//Most, if not all functions/values have the JSDoc in VSCode. To see it do this:
//• Call the API: const FlaggedAPI = require("flaggedapi");
//• Use the logger (Or any function really): FlaggedAPI.log()
//• Hover over the .log() part!
//It should display detailed help 😁 If however it does not display correctly or you still need help, go to https://discord.gg/b9ax4KJ and join the Discord server!
//Normal Operations:
//These are used to call and create the shortcut calls of the API.
//Calling the API.
const { ACD, ACDClear, ACDToggle, chalk, check, clear, colors, list, log, supported, consoleControl } = require("flaggedapi");
//Now all you have to use is:
//• ACD();
//• log();
//• ACDClear();
//Always need set:
//Allows you to toggle ACD (Advanced Console Debugging).
//If toggled True: You will see ACD messages and ACDClear() will not run
//REMEMBER THAT ACDToggle(true) MUST BE SET TO TRUE TO SEE THE MESSAGES!
//as of 1.3.0 you no longer need to set a boolean in the function, it will toggle it's state.
ACDToggle(/*Default is: false*/); //This will set it to True because it was False, if ran again, it will set it to False.
//Allows you to toggle Supported Console.
//If toggled True: You will see all log messages in color!
//If toggled False: No coloring will be used!
//MOST CONSOLES PROPERLY SUPPORT COLORS! Only use this option if you need too :)
supported(/*Default is: true*/); //This will set it to False because it was True, if ran again, it will set it to True.
//Allows you to set the colors for all of the ACL & ACD logging.
//It must be hard-coded and ran every time at startup.
//However it can also be ran at any point in time to change the color.
//It must follow this example: ([`Color_ID`, `Hex Value`], [`Main_Color`, `#FF0000`]).
colors([`Text_Color_Debug`, `#F0e0a0`], [`Main_Color`, `#FF0000`], [`Text_Color_Main`, `#F0e0a0`]);
//Lists the current color settings.
colors();
const { ACD, ACDClear, ACDToggle, chalk, check, clear, colors, list, log, supported } = require("flaggedapi");
ACDToggle();
supported();
colors([`Text_Color_Debug`, `#F0e0a0`], [`Main_Color`, `#FF0000`], [`Text_Color_Main`, `#F0e0a0`]);
colors();
//Normal functions:
//Clears the console if ACDToggle() is False.
ACDClear();
//Logs strings to the console!
//Now supports Integers, Booleans, Objects, Arrays or anything else!
//Use the log()
log(); //=>*Nothing*
log(``); //=>*Nothing*
log(` `); //=> (!)
log(`Test`); //=> (!) Test
log({ Some: `Object`}); //=> (!) { Some: `Object`}
log(`Logging with\nmore then\n\none line!`); //=>
//(!) Logging with
// ╠═ more then
// ║
// ╚═ one line!
log(`Test`, { color: "#FF0000", type: "info" }); //=> (!) Info: Test
//*The text will be Red, and it will append "Info:"*
//The Info color will be what you have set it in colors()
log(`Test`, { returnRaw: true, bold: true, italic: true, underline: true, color: "#FF0000" }); //=> chalk.hex(#424742).bold(` (`) + chalk.hex(#047ffa).bold(`!`) + chalk.hex(#424742).bold(`) `) + chalk.hex(`#FF0000`).bold.italic.underline("Test")
//*It will return the raw chalk format for processing*
//This is a string value that you will need to have processed, it will not log.
log(`Test`, { returnRaw: false, bold: true, italic: true, underline: true, color: "#FF0000" }); //=> (!) Test
//*It will be Bold, Italic, Underlined, and the text will be Red*
//It will log to the console.
//In this case, all of these options are optional.
log(`Test`, { returnRaw: true, color: "#FF0000", type: "info" }).then(data => console.log(data)); //=> chalk.hex(#424742).bold.italic(` (`) + chalk.hex(#e3ca1c).bold.italic(`!`) + chalk.hex(#424742).bold.italic(`) `) + chalk.hex(#e3ca1c).italic.bold(`Info: `) + chalk.hex(#FF0000).italic(This is a test!)
//*It will return the raw chalk format for processing*
ACDClear();
log();
log(``);
log(` `);
log(`Test`);
log({ Some: `Object`});
log(`Logging with\nmore then\n\none line!`);
log(`Test`, { color: "#FF0000", type: "info" });
log(`Test`, { returnRaw: true, bold: true, italic: true, underline: true, color: "#FF0000" });
log(`Test`, { returnRaw: false, bold: true, italic: true, underline: true, color: "#FF0000" });
log(`Test`, { returnRaw: true, color: "#FF0000", type: "info" }).then(data => console.log(data));
//Normal functions:
//Logs to the console!
//The "success" part can be one of four values: "success", "info", "warning", "error"
ACD("You are reading the README.md help file!", "success");//=> (!) Success: You are reading the README.md help file!
ACD("You are reading the README.md help file!", "success");
//Any packages or variables that you have in your code
const somepkg = require(`somepkg`);
let somestr = `This is an example`;
//Calling the function will make FlaggedAPI take over the console.
//IMPORTANT! You MUST pass the root dir path into the function, if you call the function from another file, you must pass the root dir.
consoleControl(__dirname, (returnedData => {
console.log(returnedData) //=> { command: 'test', state: 'success', data: `The data that was returned from the command file` }
}), (() => { return { somesrt, somepkg}}));
const somepkg = require(`somepkg`);
let somestr = `This is an example`;
consoleControl(__dirname, (returnedData => {
console.log(returnedData)
}), (() => { return { somesrt, somepkg}}));
//Cuss Checking
//Use check()
check(`Doesn't matter, frick you nerd, you piece of crap`, { custom_words: [`nerd`], ignored_words: [`Words`, `You`, `Don't`, `Want`, `Checked`, `Crap`], level: 4 }).then(data => {
console.log(data); //=>
//{
// number_of_words: 2,
// words: [
// {
// cussword: 'frick',
// language: 'english',
// level: 4,
// reference: 'https://www.urbandictionary.com/define.php?term=Frick',
// origin: 'api'
// },
// { cussword: 'nerd', level: 1, origin: 'custom' }
// ]
//}
});
//Gives you the array of cuss words
list().then(data => {
console.log(data)
})
//Use check()
check(`Doesn't matter, frick you nerd, you piece of crap`, { custom_words: [`nerd`], ignored_words: [`Words`, `You`, `Don't`, `Want`, `Checked`, `Crap`], level: 4 }).then(data => {
console.log(data);
});
list().then(data => {
console.log(data)
})