flaggedapi

3.3.0 • Public • Published

FlaggedAPI


What is FlaggedAPI? 🤷‍♂️

FlaggedAPI is a All-In-One API to connect to most of my services :D
It is a small API right now & only has an cuss checker and a logging system.
but it will receive updates whenever I can get around to it 😃
All functions should have JSDoc! It's when you hover over a function in VSCode and it gives you information about it :D It includes a description, and code inside of it :D 100% Help in the function itself XD

Important Announcements!

Major version 3.0.0 completely changes how the code works and how it is written! You will have to update your code.

3.3.0 Update

consoleControl(); was rewritten and now returns data from the command files.


Don't forget that all the documentation is found when hovering the functions in VSCode!

Required and Recommended Settings

Here is what the requiring of the code looks like

//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();
No Notes Version
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();


ACL (Advanced Console Logging)

It makes the console more customizable

//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*
No Notes Version
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));


ACD (Advanced Console Debugging)

It makes it easier to send error or success messages to the console

//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!
No Notes Version
ACD("You are reading the README.md help file!", "success");


Console Control

Now you can control the console and add your own custom commands to it!

//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}}));
No Notes Version
const somepkg = require(`somepkg`);
let somestr = `This is an example`;
consoleControl(__dirname, (returnedData => {
    console.log(returnedData)
}), (() => { return { somesrt, somepkg}}));


Cuss Check ✅

This part of the code checks and sees if the inputted string match's one of the over 182+ cuss words!

//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)
})
No Notes Version
//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)
})


All Changelogs

1.0.0 -> 1.1.1 Changelog • Added "README.md".
• Removed "test.js".
• Added better error messages to all events.
• Moved all script files to "src".
1.1.1 -> 1.1.4 Changelog • Edited: README.md
1.1.4 -> 1.1.5 Changelog • Added a new error on all events that makes the options required
• Edited: README.md
1.1.5 -> 1.2.0 Changelog Oh goodness where do I begin...
• Redid how the cussing system checks the given string
• Added ACL & ACD
• Added LICENSE
• Edited exports.js
• Edited index.
• Changed API URLs
• A lot more that I don't remember (I'll be better with the changelogs XD)
• Edited: README.md
1.2.0 -> 1.2.1 Changelog • When you do not specify a type in ACD, it will choose Info as the default
• ACL.log() was redone and has better performance
• ACL.log() was given more options and better documentation
• ACL.log() now has an option to return the raw content
• FIXED THE STUPID ERROR IN README.md: In this readme, I had it as "const FlaggedAPI = require("./index");" not "const FlaggedAPI = require("flaggedapi");". Noobish move bro... I'm sorry!
• Fixed small but multiple coding discrepancies between the code itself and the documentation, making it more unified :D
• Fixed the documentation in ACD where the function was called "log()" when you needed to use "ACD()". Again, I'm sorry XD
• Edited: README.md *(Better grammar too)*
1.2.1 -> 1.2.2 Changelog • Edited: README.md
1.2.2 -> 1.2.3 Changelog A special thanks to Ping for his help with this update!

• Fixed the hex bug when using returnRaw
• Deleted exports.js
• Renamed index.js to exports.js
• Redid how the function are required
• Renamed ACDtoggle() to ACDToggle()
• Changed clear() to ACDClear() in the documentation
• Edited: README.md
• Removed Herobrine... Wait what???
1.2.3 -> 1.2.4 Changelog A special thanks again to Ping for his help with this update!

• Changed FlaggedAPI.cussCheck.request() from Callback to Promise!!
• Added request() to the Cuss Check documentation (It's not like this whole thing is to block cusswords, and I totally forgot to add the main function... Nah bro your trippin)
• Fixed FlaggedAPI.ACL.log() (Wasn't working due to string & eval errors?)
• Edited: README.md
1.2.4 -> 1.2.5 Changelog • Updated LICENSE
• Edited: README.md
1.2.5 -> 1.2.6 Changelog • Started Following the Semantic Versioning (To the best that I can)
• Updated LICENSE
• Updated package.json
• Updated the README.md documentation
• Edited: README.md
1.2.6 -> 1.2.7 Changelog • Updated package.json
• Edited: README.md
1.2.7 -> 1.2.8 Changelog • FlaggedAPI.ACL.colors() was renamed to FlaggedAPI.ACL.Colors()
• FlaggedAPI.ACL.log() was renamed to FlaggedAPI.ACL.Log()
• Fixed FlaggedAPI.ACL.Colors() ACD error
• Code Improvements
• Updated package.json
• Updated FlaggedAPI.ACL.Colors() Documentation
• Edited: README.md
1.2.8 -> 1.2.9 Changelog • Edited: README.md
1.2.9 -> 1.3.0 Changelog • Updated log()! (it now has a New Line indicator!)
• The space in front of the log() prefix was removed (IDK why I added that)
• Better Documentation (All the documentation was reviewed and updated!)
• Small code improvements (It doesn't change functionality, just how it's typed out lol)
• Updated src/ACL.js
• Updated src/cussCheck.js
• Updated package.json
• Edited: README.md (As always)
1.3.0 -> 1.3.1 Changelog • Fixed a bug where if you used log() with `returnRaw: ture` and `type: "error"` or `type: "warning"` it would say `(!) Info:` instead of `(!) Error:`
• Updated src/ACL.js
• Updated package.json
• Edited: README.md
1.3.1 -> 1.3.2 Changelog • Fixed a bug where if you used log() without any options it would throw an error
• Updated src/ACL.js
• Updated package.json
• Edited: README.md
1.3.2 -> 1.4.0 Changelog • Added the ability to remove all colors from console messages (Mainly for unsupported consoles)
• Added strip-ansi package
• Updated some more in-package documentation
• Updated src/ACL.js
• Updated package.json
• Edited: README.md
1.4.0 -> 2.0.0 Changelog • Added .gitignore
• Changed API links!
• Updated some more in-package documentation
• Updated src/cussCheck.js
• Updated LICENSE
• Updated package.json
• Edited: README.md
2.0.0 -> 3.0.0 Changelog • Edited .gitignore
• Added .npmignore
• Changed API links to github
• Revamped Documentation
• Revamped Code
• Changed how imports are done. No more flaggedapi.ACL.log, it is now just flaggedapi.log
• Updated src/cussCheck.js
• Removed flaggedapi.cussCheck.number
• Removed flaggedapi.cussCheck.request
• Added flaggedapi.check (same as flaggedapi.cussCheck.request)
• Added flaggedapi.chalk (So that you have access to the correct version)
• Updated src/ACL.js
• log(); now supports more than just strings
• Updated LICENSE
• Updated package.json
• Updated package-lock.json
• Removed "request" package
• Edited README.md
3.0.0 -> 3.0.1 Changelog • Updated src/cussCheck.js
• Changed API links from dev branch to main branch
• Updated src/ACL.js
• Fixed bug where in log() where if "returnRaw: true" and "type" was added it would return undefined. Now it will be a Promise when returnRaw is true
• Updated package.json
• Edited README.md
3.0.0 -> 3.1.0 Changelog • Added src/consoleControl.js
• consoleControl(); allows you input to the console and you can create commands for it
• Updated package.json
• Forgot to edit README.md
3.1.0 -> 3.2.0 Changelog • Updated src/consoleControl.js
• Full documentation for consoleControl();
• Better coding of consoleControl(); to make it look nicer and run better.
• Updated package.json
• Edited README.md
3.2.0 -> 3.2.1 Changelog • Updated package.json
• Added new key words
• Forgot to edit README.md
3.2.1 -> 3.2.2 Changelog • Updated package.json
• Edited README.md
3.2.2 -> 3.3.0 Changelog • Updated src/consoleControl.js
• Updated src/ACL.js
• Updated src/cussCheck.js
• Updated index.js
• Improved code formatting across all files
• Changed how consoleControl() works and how it is written.
• Updated package.json
• Edited README.md
• Fixed README formatting


Support 🔧

I will give support over in my Discord Server



While I tried to make this version the best that it could be, it still is in a young state and may not work right or it may not be explained the right way, I am sorry in advanced if it is confusing XD If at anytime you need help PLEASE message me on discord and I will be happy to help! :D

Package Sidebar

Install

npm i flaggedapi

Weekly Downloads

5

Version

3.3.0

License

FCL

Unpacked Size

51.1 kB

Total Files

7

Last publish

Collaborators

  • theflagen430297