sectom
v1.0.3
Published
Sectom is a useful npm package that has multiple easy to use functions.
Downloads
6
Maintainers
Readme
┃Getting Started
You need to install Node.js V12 or Later
You might need to install Discord.js
Quickstart
After you have downloaded node js or/and discord js you can start by entering this command in the terminal:
$ npm install sectom
ℹ┃Information
functions:
propercase()
- Functions that makes the start of each word in a string a capital letter.capitalize()
- Function that makes the start of a string a capital letter.switch()
(quick DB) - Functions that switches the value of two keys around for quick.DB.switch()
(quickmongo) - Functions that switches the value of two keys around for quickmongo.DateDiffer()
- Function that tells you the difference between two dates.stringToBoolean()
- Functions that converts a string to a boolean.ordinal_suffix()
- Function that returns a string with the correct suffix endingrandomNumber()
- Function that generates a random number between two numbers of your choiceonlyNumericalString()
- Function that returns a string only including numerical values.onlyAlphabeticalString()
- Function that returns a string only including alphabetical values.removeEmojis()
- Function that removes any emojis from a string.isBST()
- Function that returns a boolean value stating if it is currently British Summer Timeyomomma()
- Function that generates a string with a "yomamma" jokeurban()
- Function to generate an embed describing a word from the urban APIgenerateDiscordMemeEmbed()
- Function that generates an embed with a meme.isEmptyObject()
- Function that returns a boolean value stating if an object is empty or not.
Classes:
DB
- A class with helpful function for both Quick.DB and Quick Mongo
┃Functions:
propercase
propercase is a quick and easy to use function that converts a string into a propercase form
Example:
// Requiring Sectom
const sectom = require("sectom");
// Object destructuring
const { modules } = sectom;
const { propercase } = modules;
console.log(propercase("the quick brown fox")); // The Quick Brown Fox
capitalize
capitalize is a quick and easy to use function that converts the first character of a string into a capitalize form
Example:
// Requiring Sectom
const sectom = require("sectom");
// Object destructuring
const { modules } = sectom;
const { capitalize } = modules;
console.log(capitalize("the quick brown fox")); // The quick brown fox
switchQuickDB
switch is a useful function for quick mongo users and quick db users, it switches the value of two different keys around with one another
Example:
// Requiring Sectom
const sectom = require("sectom");
const db = require("quick.db");
// Object destructuring
const { modules } = sectom;
const { quickDB } = modules.DB;
const keyOne = "myServers";
const keyTwo = "myUsers";
quickDB.switch(db, keyOne, keyTwo); // returns true if there was a success
switchQuickMongo
switch is a useful function for quick mongo users and quick db users, it switches the value of two different keys around with one another
Example:
// Requiring Sectom
const sectom = require("sectom");
const { Database } = require("quickmongo");
const db = new Database("url");
// Object destructuring
const { modules } = sectom;
const { quickMongo } = modules.DB;
const keyOne = "myServers";
const keyTwo = "myUsers";
quickMongo.switch(db, keyOne, keyTwo); // returns true if there was a success
DateDiffer
DateDiffer is a very helpful function which gives you a string showing the differences between two dates
Example:
// Requiring Sectom
const sectom = require("sectom");
// Object destructuring
const { modules } = sectom;
const { DateDiffer } = modules;
console.log(DateDiffer("2011-10-05T14:48:00.000Z")); // "9 years 9 months 8 days 2 hours and 56 minutes ago"
console.log(DateDiffer("2011-10-05T14:48:00.000Z", false)); // "9 years 9 months 8 days and 2 hours ago"
console.log(DateDiffer("2011-10-05T14:48:00.000Z"), true, true); // "**9** years **9** months **8** days **2** hours and **56** minutes ago"
console.log(DateDiffer("2011-10-05T14:48:00.000Z", false, true)); // "**9** years **9** months **8** days and **2** hours ago"
formatter
formatter is a massive module for discord message markdowns and formats and allows you to quickly bold, italic, underline, use codeblocks, and more!
Example:
// Requiring Sectom
const sectom = require("sectom");
// Object destructuring
const { modules } = sectom;
const { formatter } = sectom;
console.log(formatter.defaults.bold(""));
stringToBoolean
stringToBoolean is a helpful function that converts a string into a boolean value
Example:
// Requiring Sectom
const sectom = require("sectom");
// Object destructuring
const { modules } = sectom;
const { stringToBoolean } = modules;
stringToBoolean("true"); // returns true
stringToBoolean("yes"); // returns true
console.log(stringToBoolean("no")); // false
ordinal_suffix
ordinal_suffix is a function that returns a string with the ordinal suffix
Example:
// Requiring Sectom
const sectom = require("sectom");
// Object destructuring
const { modules } = sectom;
const { ordinal_suffix } = modules;
console.log(ordinal_suffix("1")); // 1st
console.log(ordinal_suffix(2)); // 2nd
console.log(ordinal_suffix("3")); // 3rd
console.log(ordinal_suffix(4)); // 4th
randomNumber
randomNumber is a helpful function that generates a random number between your choices
Example:
// Requiring Sectom
const sectom = require("sectom");
// Object destructuring
const { modules } = sectom;
const { randomNumber } = modules;
console.log(randomNumber(1, 10)); // any number between 1-10m, 1 being included and 10 not being included
onlyNumericalString
onlyNumericalString is a regex function that removes anything in a string that is not numerical
Example:
// Requiring Sectom
const sectom = require("sectom");
// Object destructuring
const { modules } = sectom;
const { onlyNumericalString } = modules;
console.log(onlyNumericalString("123abc")); // 123
onlyAlphabeticalString
onlyAlphabeticalString is a regex function that removes anything in a string that is not alphabetical
Example:
// Requiring Sectom
const sectom = require("sectom");
// Object destructuring
const { modules } = sectom;
const { onlyAlphabeticalString } = modules;
console.log(onlyAlphabeticalString("123abc")); // abc
removeEmojis
removeEmojis is a regex function that removes anything in a string that is an emoji
Example:
// Requiring Sectom
const sectom = require("sectom");
// Object destructuring
const { modules } = sectom;
const { removeEmojis } = modules;
console.log(removeEmojis("🧡🧡💔Hello")); // Hello
isBST
isBST is a helpful function that checks if it is currently British Summer Time
Example:
// Requiring Sectom
const sectom = require("sectom");
// Object destructuring
const { modules } = sectom;
const { isBST } = modules;
console.log(isBST()); // true if it is and false if it is not BST
getLondonTime
getLondonTime is a helpful function that checks the current time or a given time in London
Example:
// Requiring Sectom
const sectom = require("sectom");
// Object destructuring
const { modules } = sectom;
const { getLondonTime } = modules;
console.log(getLondonTime()); // returns the current date in London
console.log(getLondonTime(/**a passed in date */)); // returns the current date in London
yomomma
yomomma is a funny function that returns a "yomomma" joke
Example:
// Requiring Sectom
const sectom = require("sectom");
// Object destructuring
const { modules } = sectom;
const { yomomma } = modules;
console.log(yomomma());
// a possible outcome is:
// "Yo mama is so fat that Weight Watchers said I give up"
urban
urban is a funny function that makes a discord embed for a word in the urban API
Example:
// Requiring Sectom
const sectom = require("sectom");
// Object destructuring
const { modules } = sectom;
const { urban } = modules;
console.log(urban("wagwan"));
// this will return an embed or a embed JSON (if the second paramater is set to false)
// a possible outcome of a word is:
// "[Wagwan] is a greeting that only [roadmen] of [lvl] 10 can use this greeting is an abbreviation of \"Whats going on?\""
generateDiscordMemeEmbed
generateDiscordMemeEmbed is a funny function that makes a discord embed for generated meme
Example:
// Requiring Sectom
const sectom = require("sectom");
// Object destructuring
const { modules } = sectom;
const { generateDiscordMemeEmbed } = modules;
const discord = require("discord.js");
const client = new discord.Client();
// Discord JS v13
client.on("messageCreate", async (message) => {
if (message.content == "!meme")
message.channel.send(generateDiscordMemeEmbed());
});
// Discord JS v12
client.on("message", async (message) => {
if (message.content == "!meme")
message.channel.send(generateDiscordMemeEmbed());
});
client.login("token");
// this will send an embed or a embed JSON (if the second paramater is set to false)
isEmptyObject
isEmptyObject is a useful function that returns a boolean stating if an object is empty or not
Example:
// Requiring Sectom
const sectom = require("sectom");
// Object destructuring
const { modules } = sectom;
const { isEmptyObject } = modules;
const obj = {};
console.log(isEmptyObject(obj)); // true
const obj2 = {
a: 2,
};
console.log(isEmptyObject(obj2)); // false