2.0.6 • Published 2 years ago

djs-helper v2.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

djs-helper

djs-helper is a JavaScript library that helps you to develop your own Discord Bot, Still under development, more features will be added in the future

Installation

  • Download Node.js
  • Write in CMD / Terminal:
npm i djs-helper

Example Code:

const { Client, Intents, MessageEmbed } = require('discord.js');
const DjsH = require('djs-helper');
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });

client.on('ready', () => {
    console.log(`Logged in as ${client.user.tag}!`);
});

client.on('messageCreate', async (message) => {
    if (!message.guild) return;
    if (message.startsWith('!extract-emojis')) {
        let emojis = DjsH.matchEmojis(message.content, true);
        if (emojis.length === 0) {
            let embed = new MessageEmbed()
                .setTitle("Extract Emojis")
                .setDescription(":x: No emoji found!")
                .setColor(DjsH.Colors.HEX.Red)
            return message.reply({ embeds: [embed] });
        } else {
            let embed = new MessageEmbed()
                .setTitle("Extract Emojis")
                .setDescription(`Emojis found: \`${emojis.join(',')}\``)
                .setColor(DjsH.Colors.HEX.Aqua)
            message.reply({ embeds: [embed] });
        }
    }
});

client.login('token');

Documentation

Functions:

NameParamsTypeFunctionReturns
matchId()contentStringExtract All Discord IDs from contentArray
matchEmojis()content,unicodeString,BooleanExtract All Discord Emojis from content, If unicode is true it will return Unicode emojis tooArray
isInvite()contentStringChecks if content contains Discord InvitesBoolean
isURL()content,whitelistString,ArrayChecks if content contains URLsBoolean
splitMessage()content,maxString,NumberSplit string every max default: 2000 maxArray
await getMember()guild,userIDObject,StringGet member from guild using IDObject/null
await guildsCount()clientObject (Discord.Client())Get client guilds count (Supports Sharding)Number
await usersCount()clientObject (Discord.Client())Get client users count (Supports Sharding)Number
await channelsCount()clientObject (Discord.Client())Get client channels count (Supports Sharding)Number
await getUser()client,userIDObject (Discord.Client()),StringGet user using IDObject/nullObject/null
await Inviter()client,memberObject (Discord.Client()),Object (GuildMember)Get used inviteObject

Utils:

NameFunctionUsage
ColorsContains all colorsto Show all colors: console.log(Colors.HEX)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

2.0.6

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago