discord.js-table-cmd v1.0.4
Discord.JS-Table-CMD
So, what is Discord.JS-Table-CMD's (D.JS-T-C) purpose?
D.JS-T-C's purpose it to allow you to create commands in Discord.JS in seconds!
So, how exactly do you install it?
npm i discord.js-table-cmd
Just like any other package!
HHere is a simple example for creating your own table and commands!
const Discord = require('discord.js');
const table = require('discord.js-table-cmd');
const bot = new Discord.Client()
let prefix='!';
bot.on('ready',()=>{
console.log(`Hi, ${bot.user.username} is now online!`)
})
bot.on('message',message=>{
if(!message.author.bot) return;
if(!message.content.startsWith(prefix)) return;
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const commands = {
//Everything except the command name defining is case sensitive, so for example inside the message command if I did: type: that would not work.
message: { //You have to make your command lowercase or it will not work. When you open a new table command inside the commands table, it won't work.
Type: 'Message', //Not case sensitive, two types, Message and Embed, Required
Content: 'Hello!\n{user} is in the guild {guild}' //The content of the message. Required
//Currently, there are 2 RegExp's which are for {user} which is the author's username and {guild} which is the guild name,
},
embed: {
//Note, the name does not matter as long as it is not a duplicate command name
Type: 'Embed', //Creating an embed, note that in the speech marks for Type that is not case sensitive, so I could do emBeD
Title: 'Hello {user}!', //The title of the embed, required
Color: 'RANDOM', //This will give the embed it's color, required
Description: 'You are in the guild {guild}' //The description of your embed.
}
}
table.Frame.commands(commands,args,message)
})
bot.login('your-super-secret-token')
Prefix: '!',
Token: config.token,
Events: {
ready: {
log: 'Hi! My bot is now online!'
},
message: {
Commands: {
Table: commands
}
},
guildCreate: {
Send: {
Type: 'Embed',
Title: 'Joined a guild!',
Color: 'RANDOM',
Description: 'I joined the guild {Guild}\nI am now in {guilds} guilds!',
SpecificChannel: "651133461813264414"
}
},
guildDelete: {
Send: {
Type: 'Message',
Content: 'I left the guild {Guild}\nI am now in {guilds} guilds!',
SpecificChannel: "651133461813264414"
}
}
}
}
table.Frame.client(settings)