Skip to content

Commit

Permalink
2.0.1
Browse files Browse the repository at this point in the history
inlineReply fix,
 ephemeral for slash
 discord.js v13
 structures fix
 aliases for normal cmds
 embed fix
 ownEvents
 moreEvents
 allowedMentions for slash return
 new expectedArgs, subCommand option for commands
 choices for args (slash)
 new docs (only for classes, etc)
 guildMemberAcceptRules
 userOnly array

and more!
  • Loading branch information
xhyrom authored May 12, 2021
2 parents 8749893 + 8381685 commit e5fe016
Show file tree
Hide file tree
Showing 19 changed files with 1,082 additions and 425 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ client.on("ready", () => {
cmdDir: "commands",
eventDir: "events", //when you want event handler
errorMessage: "Error :(",
ownEvents: false,
slash: {
slash: 'both', //true = slash only, false = only normal, both = slash and normal
prefix: '.'
Expand Down
70 changes: 57 additions & 13 deletions commands/test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,57 @@
const { MessageEmbed } = require("discord.js");
const { SlashCommand } = require("gcommands")

module.exports = {
name: "test",
aliases: ["ccc"],
description: "Test",
expectedArgs: '<enable:6:description> <test>',
//expectedArgs: '<enable:6:description> <test>',
/*expectedArgs: [
{
name: "list",
type: SlashCommand.STRING,
description: "helllo",
required: true,
choices: [
{
name: "Hyro Dog",
value: "dogik"
},
{
name: "Pancucha",
value: "pancier"
}
]
},
{
name: "user",
type: SlashCommand.USER,
description: "select user",
required: false
}
],*/

subCommandGroup: "group",
subCommand: ["button;<enable:6:imgood> <test>","pog;<disable> <button>"],
subCommand: [
{
name: "button",
description: "button idk",
options: [
{
name: "enable",
type: SlashCommand.USER,
description: "enable",
required: true
}
]
}
],
//subCommand: ["button;<enable:6:imgood> <test>","pog;<disable> <button>"],

minArgs: 1,
cooldown: 3,
guildOnly: "id",
ownerOnly: "id",
guildOnly: "id", //["id","id2"]
userOnly: "id",
requiredPermission: "ADMINISTRATOR",
requiredPermissionMessage: "You need have ADMINISTRATOR perms.",
requiredRole: "ROLE ID",
Expand All @@ -23,16 +67,16 @@ module.exports = {
return;
}

console.log(slash.data.resolved.users)
return {
content: "My ping is `" + Math.round(client.ws.ping) + "ms`",
ephemeral: true,
allowedMentions: { parse: [], repliedUser: true }
}

/*
CAN USE
return "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`"
}
}
})*/
*/
}
};

5 changes: 5 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
git add .
git commit -m "Removed API.md, changed version to 2.0.1-BETA"
git push

#documentation build src/** -f html --github -o docs
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gcommands",
"version": "1.0.51",
"description": "Open-source slah/normal command handler",
"version": "2.0.1",
"description": "Open-source slash/normal command handler",
"main": "src/index.js",
"dependencies": {
"axios": "^0.21.1",
Expand Down
28 changes: 28 additions & 0 deletions src/color/Color.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
/**
* The Color class
* @class Color
*/
module.exports = class Color {

/**
* Creates new Color instance
* @param {string} text
* @param {ColorOptions} options
*/
constructor(text = "", options = {}) {

/**
* Color options
* @param {string} text
* @param {ColorOptions} json
* @type {ColorOptions}
*/
this.text = text;

this.json = options.json;
Expand Down Expand Up @@ -31,13 +48,24 @@ module.exports = class Color {
.replace(/&p/g, "\x1b[7m")
}


/**
* Internal method to getText
* @returns {json}
* @returns {string}
*/
getText() {
if(this.json) {
return {text:this.text + "\x1b[0m"}
}
return this.text + "\x1b[0m";
}

/**
* Internal method to getRGB
* @returns {json}
* @returns {string}
*/
getRGB() {
var get = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(this.text);

Expand Down
11 changes: 10 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,14 @@ module.exports = {
GCommands: require("./main/GCommands.js"),
GEvents: require("./main/GEvents"),
Color: require("./color/Color"),
Buttons: require("./main/Buttons")
Buttons: require("./main/Buttons"),
SlashCommand: {
STRING: 3,
INTEGER: 4,
BOOLEAN: 5,
USER: 6,
CHANNEL: 7,
ROLE: 8,
MENTIONABLE: 9
}
}
9 changes: 9 additions & 0 deletions src/main/Buttons.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
const Color = require("../color/Color");

/**
* The Buttons class
* @class Buttons
*/
module.exports = class Buttons {

/**
* Creates new Buttons instance
* @param {ButtonsOptions} options
*/
constructor(options = {}) {
if (!options.buttons) {
options.buttons = [];
Expand Down
Loading

0 comments on commit e5fe016

Please sign in to comment.