Socket
Book a DemoInstallSign in
Socket

@mrmythical/discord.js-helper

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mrmythical/discord.js-helper

A package to help with developing in discord.js

2.0.1
latest
npmnpm
Version published
Weekly downloads
19
171.43%
Maintainers
1
Weekly downloads
 
Created
Source

discord.js-helper

Easy developing in discord.js

Bugs

Please go to the issues page on github to submit a bug

Example:

const { Discord, Client, Command } = require("@mrmythical/discord.js-helper")
const { Intents } = Discord
const client = new Client({
    intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
    autoListen: true
})

client.prefix = '!'
const command = new Command(client, {
    name: "test",
    aliases: ["t"]
})
command.on("execute", ({ msg }) => {
  data.msg.reply("Success!")
})

client.on("ready", () => console.log("Ready"))

client.login(token)

Sending !test or !t should send back Success! with the bot!

You can contribute on the GitHub repository

Slash command support is here with v2!

const { Client, Discord, SlashCommand } = require(".");
const { Intents } = Discord;
const client = new Client({
    intents: [Intents.FLAGS.GUILDS],
    autoListen: true
});

const command = new SlashCommand(client, {
    name: "test",
    options: [{
        name: "test",
        description: "A test",
        type: "STRING"
    }],
    description: "test cmd"
})
client.on("ready", async () => {
  // ONLY RUN THIS ONCE WHEN YOU MODIFY COMMANDS OR YOU WILL LIKELY GET RATELIMITED
    await client.slashCommands.postAll(guildId) // guildId is not required, not passing guildId will make it post to global comands
    console.log("ready")
})

command.on("execute", async ({ interaction }) => {
    await interaction.reply(`This is a reply to the ${interaction.commandName} slash command!`)
})

client.login(token);

Docs?

There are no docs yet, but hopefully this helps:

Client

Regular discord.js with a few changes, including autoListen in ClientOptions and being able to set the prefix. There is also .commands which returns a CommandManager

Args

Args are like js maps, but are readonly. They are mapped by name and user input.

Command and CommandManager

Commands are easy to use and auto listen if set in client options. autoListen in the client options is true by default. CommandManagers help you with managing commands, like listing them, deleting them, etc.

SlashCommand and SlashCommandManager

SlashCommands are almost like Commands, but aren't as flexible as message commands and you can access them on Discord by typing /. SlashCommandManagers hold these commands. Please only run the methods responsibly. Only run them if needed, or you may get ratelimited

Keywords

discord

FAQs

Package last updated on 30 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.