Git Product home page Git Product logo

djs-helper's Introduction

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

npm version npm downloads
  • 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:

Name Params Type Function Returns
matchId() content string Extract All Discord IDs from content Array
matchEmojis() content unicode string Boolean
isInvite() content string Checks if content contains Discord Invites Boolean
isURL() content whitelist[string] String Array
splitMessage() content number String Number
getMember() guild string Object GuildMember
guildsCount() client Discord.Client Get client guilds count (Supports Sharding) number
usersCount() client Discord.Client Get client users count (Supports Sharding) number
channelsCount() client Discord.Client Get client channels count (Supports Sharding) number

Utils:

Name Function Usage
Colors Contains all colors to 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.

djs-helper's People

Contributors

amir-78 avatar fnrdev avatar

Stargazers

 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.