Package Exports
- gcommands
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gcommands) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
G Commands
Instalaltion
npm install gcommandsHow use?
index.js
const { GCommands } = require("gcommands");
const Discord = require("discord.js");
const client = new Discord.Client();
client.on("ready", () => {
new GCommands(client, {
cmdDir: "commands",
ignoreBots: true,
errorMessage: "Error :(",
slash: {
slash: 'both', //true = slash only, false = only normal, both = slash and normal
prefix: '.'
}
})
})
client.login("token")Example Commands (put to cmdDir)
ping.js
module.exports = {
name: "ping",
description: "Check bot ping",
run: async(client, slash, message) => {
if(message) {
return message.channel.send("My ping is `" + Math.round(client.ws.ping) + "ms`")
}
client.api.interactions(slash.id, slash.token).callback.post({
data: {
type: 4,
data: {
content: "My ping is " + Math.round(client.ws.ping) + "ms"
}
}
})
}
};test.js
module.exports = {
name: "test",
description: "Test",
expectedArgs: "<name>",
minArgs: 1,
run: async(client, slash, message, args) => {
if(message) {
if(args[0]) {
return message.channel.send("My ping is `" + Math.round(client.ws.ping) + "ms`")
} else {
return message.channel.send("Need args")
}
}
client.api.interactions(slash.id, slash.token).callback.post({
data: {
type: 4,
data: {
content: "My ping is `" + Math.round(client.ws.ping) + "ms`"
}
}
})
}
};