npm.io
3.1.2 • Published 4 years ago

kifo

Licence
ISC
Version
3.1.2
Deps
4
Size
105 kB
Vulns
0
Weekly
0

kifo

NPM package to make the Kifo Clanker cleaner and easier to manage.

Installation

  1. npm install kifo in your terminal
  2. const kifo = require("kifo"); in your code

... and that's it!

make sure you have npm installed.

Features

Main usage of this package is to help develop Kifo Clanker. However, there are some actually useful features that other bot developers could use (like RegExs).

embed(body, title = "Info:", perpetrator = null, client = null)

converts string (body) with optional title to embed message.

  • perpetrator - Discord.User that used the command (visible in footer)
  • client - Discord.Client that instantiated this (visible in title)
mentionTrim(mention)

Trims mentions to Ids. For instance, "<@KifoPL>" returns "KifoPL", "<@&123123123>" returns "123123123", "42069" returns "42069".

  • mention - string to trim.
emojiTrim(emojiIdentifier)

Returns Id of emoji, really handy for handling reactions, etc.

  • emojiIdentifier - The <a:name:id>, <:name:id>, a:name:id or name:id emoji identifier string of an emoji
place(number)

returns number with place abbreviation: for 1 returns 1st, 2 - 2nd, etc...

number - the place

whatAmIFunc(message, whatisthis, allowWords, callback)

Determines, what the mention or Id is.

  • message - The message sent
  • whatisthis - The argument in question (either mention or Id)
  • allowWords - True if "me" results in member and "here" in channel (case in-sensitive), false otherwise.
  • callback -
{
	entity: Discord.GuildMember || Discord.GuildChannel || Discord.GuildRole || Discord.Message || undefined,
	whatAmI: "member" || "channel" || "role" || "message" || "not found" //(that's because if the function breaks, it will return `undefined`, + it's easier to do if statements)
}
emojiRegex

Returns RegEx fitting all Unicode Emojis.

urlRegex

Returns RegEx fitting all URLs starting with http:// or https://

channelPerms

Returns array with Id, name, type, aliases of channel perms.

example:
	[
		(VIEW_CHANNEL = {
		Id: 1,
		name: "VIEW_CHANNEL",
		type: "text",
		aliases: ["view", "vch"],
	}),
	...
	]