
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
discord-structures
Advanced tools
This npm module is here because i am tired of making them
how to use:
in your package.json run npm install
let { CommandStructure } = require('discord-structures')
class Ping extends CommandStructure {
constructor() {
super();
this.name = 'ping' // can be used in super as well
this.aliases = [' pong ']
}
async execute({ message }) or (message) {
return await message.channel.send('Pong!'); // Discord.js
return await message.channel.createMessage('Pong!'); // Eris
}
}
module.exports = Ping;
// or
module.exports = new Ping();
very simple to set up
all the structure has is a help command. more features will be coming soon
Doc:
Name | Type |
---|---|
message | Object |
client | Object |
lib | String |
prefix | String |
disableHelp | Boolean |
commands | Object |
example:
let { StructureClient } = require('discord-structures');
new StructureClient(message, client, 'eris', '!', false) // true is only if you want to disable the help command
The client is supposed to be like this
let { Client } = require('eris'); // you can also go with discord.js but the lib has to be djs
let { token } = require('./config.json');
let { StructureClient } = require('structures');
let client = new Client(token);
client.once('ready', () => {
console.log('Ready');
});
let command = require('./test');
client.commands = new Map();
client.commands.set(command.name, command)
client.on('messageCreate', async (message) => {
new StructureClient(message, client, 'eris', '!', false);
if (message.content === `!${command.name}` || message.content === `!${command.aliases}`) {
command.execute({ message });
}
})
client.connect();
The command object can also be:
if there is no json object, the help menu will show undefined
{
"name": ["your commands here"]
}
FAQs
the basic structures for any discord bot.
We found that discord-structures demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.