Coder Social home page Coder Social logo

omega-utils's Introduction

omega-utils

This is a private package made by and for OmegaOrSomething (Also the owner of this GitHub repository) to assist him in making his Discord Bot(s).

Free to use?

This package, although made exclusively for Omega is absolutely free to use.

Installation

The package can be installed like any other package using

npm install omega-utils

Features

formatString()

The formatString() function formats the string in a way that the first character is in uppercase while the rest of the string is in lowercase.

formatString("fOo bAr") -> "Foo bar"

formatTime()

The formatTime() function takes in a the time in seconds and returns the time in Hours, Minutes and Seconds.

formatTime(3661) -> 1:1:1

errorize()

The errorize function takes in 3 arguments. A <Discord.Message>, <Discord.MessageEmbed>, <Discord.MessageEmbed#Description>. The Message is required to set the author tag and iconULR to the embed. The Description is the description which will be set. The description should be the error and what should be done to fix the error

errorize(message, embed, "An error occured!\nPlease contact Omega#6666 to fix the error") ->

image

arrayRandomize()

The arrayRandomize function takes in an array as an argument and returns a random element from the array.

let arr = ["foo", "bar", "discord", "javascript"];
arrayRandomize(arr);

discord

multiQueryStartsWith()

The multiQueryStartsWith function takes in 3 arguments, namely <Discord.Message>, QueryType, Query. The Message is required to fetch the guild. The QueryType can be either of "members" or "roles" and the Query is the what the function finds. It searches through the guild's cache to find any results that starts with the Query and returns all the filtered results in an array

const results = multiQueryStartsWith(message, "members", `Om`);
results.forEach((res) => {
  console.log(`${res.user.tag} | `);
});

Omega#6666 | OmegaIsCool#1952

multiQueryIncludes()

Does the same as multiQueryStartsWith() function but instead of filtering by startsWith(), it filters using includes().

const results = multiQueryIncludes(message, "members", `Om`);
results.forEach((res) => {
  console.log(`${res.user.tag} | `);
});

Omega#6666 | OmegaIsCool#1952 | EcoMoney#4781

____

omega-utils's People

Contributors

omegaorsomething avatar

Stargazers

Sandy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.