From a8655b0eca0c74d87683749e84419a363e73d53d Mon Sep 17 00:00:00 2001 From: Veauville Raphael Date: Sun, 21 Nov 2021 14:23:23 +0100 Subject: [PATCH] Version 2.0.0 --- README.md | 6 ++++-- package.json | 2 +- src/templates/V2/add/command.ts | 8 +++----- src/templates/V3/add/command.ts | 12 +++++------- src/templates/V3/add/event.ts | 2 +- src/templates/V3/add/inhibitor.ts | 4 ++-- .../V3/create/javascript/src/events/ready.ts | 2 +- .../V3/create/typescript/src/events/ready.ts | 2 +- .../V3/create/typescript/src/inhibitors/inhibitor.ts | 2 +- 9 files changed, 19 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 0b995ad..6c54cf8 100644 --- a/README.md +++ b/README.md @@ -3,18 +3,20 @@ ![sheweny](https://cdn.discordapp.com/attachments/881988260925153322/882027519753224244/sheweny_baniere.png) [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/Sheweny/cli) -[![made-with-Markdown](https://img.shields.io/badge/Made%20with-Markdown-1f425f.svg)](http://commonmark.org) +[![made-with-Markdown](https://img.shields.io/badge/Made%20with-Typescript-1f425f.svg)](http://commonmark.org) [![GitHub license](https://img.shields.io/github/license/Naereen/StrapDown.js.svg)](https://github.com/Sheweny/master/LICENSE) [![GitHub tag](https://img.shields.io/github/tag/Sheweny/cli.svg)](https://github.com/Sheweny/cli/tags/) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) This module is a CLI (Command Line Interface) for create discord bots with Sheweny framework. +[GUIDE](https://sheweny.js.org/guide/cli/Usage.html) + ## Getting started Prerequisites -Node.js 14.0.0 or newer is required. +Node.js 16.6.0 or newer is required. ### Instalation diff --git a/package.json b/package.json index cdcbc1c..2fa1ed0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@sheweny/cli", "description": "Cli for sheweny framework", - "version": "1.1.4", + "version": "2.0.0", "main": "lib/cli.js", "bin": { "sheweny": "bin/sheweny", diff --git a/src/templates/V2/add/command.ts b/src/templates/V2/add/command.ts index c6f1285..8acc97e 100644 --- a/src/templates/V2/add/command.ts +++ b/src/templates/V2/add/command.ts @@ -14,14 +14,12 @@ import type { ${importDjs} } from "discord.js";` ${options.config!.template === "javascript" ? "module.exports =" : "export"} class ${options.addName}Command extends Command { constructor(client${options.config!.template === "typescript" ? ": ShewenyClient" : ""}) { - super( - client, - { - name: ${options.addName.toLowerCase()}, + super(client, { + name: "${options.addName.toLowerCase()}", description: "${options.commandOptions.description}", type: "${options.commandOptions.type}", ${options.commandOptions.category ? `category: "${options.commandOptions.category}",` : ""} - ${options.commandOptions.cooldown ? `cooldown: "${options.commandOptions.cooldown}",` : ""} + ${options.commandOptions.cooldown ? `cooldown: ${options.commandOptions.cooldown},` : ""} ${options.commandOptions.only ? `channel: "${options.commandOptions.only}",` : ""} } ); diff --git a/src/templates/V3/add/command.ts b/src/templates/V3/add/command.ts index bd76dcc..8acc97e 100644 --- a/src/templates/V3/add/command.ts +++ b/src/templates/V3/add/command.ts @@ -14,14 +14,12 @@ import type { ${importDjs} } from "discord.js";` ${options.config!.template === "javascript" ? "module.exports =" : "export"} class ${options.addName}Command extends Command { constructor(client${options.config!.template === "typescript" ? ": ShewenyClient" : ""}) { - super( - client, - { - name: ${options.addName.toLowerCase()}, - description: ${options.commandOptions.description}, - type: ${options.commandOptions.type}, + super(client, { + name: "${options.addName.toLowerCase()}", + description: "${options.commandOptions.description}", + type: "${options.commandOptions.type}", ${options.commandOptions.category ? `category: "${options.commandOptions.category}",` : ""} - ${options.commandOptions.cooldown ? `cooldown: "${options.commandOptions.cooldown}",` : ""} + ${options.commandOptions.cooldown ? `cooldown: ${options.commandOptions.cooldown},` : ""} ${options.commandOptions.only ? `channel: "${options.commandOptions.only}",` : ""} } ); diff --git a/src/templates/V3/add/event.ts b/src/templates/V3/add/event.ts index 13c18c6..1a405c3 100644 --- a/src/templates/V3/add/event.ts +++ b/src/templates/V3/add/event.ts @@ -11,7 +11,7 @@ import type { ShewenyClient } from "sheweny";` ${options.config!.template === "javascript" ? "module.exports =" : "export"} class ${options.addName}Event extends Event { constructor(client${options.config!.template === "typescript" ? ": ShewenyClient" : ""}) { super(client, "${options.addName}", { - description: ${options.eventOptions.description}, + description: "${options.eventOptions.description}", once: ${options.eventOptions.once}, }); } diff --git a/src/templates/V3/add/inhibitor.ts b/src/templates/V3/add/inhibitor.ts index ff3c95c..81d2c01 100644 --- a/src/templates/V3/add/inhibitor.ts +++ b/src/templates/V3/add/inhibitor.ts @@ -15,11 +15,11 @@ ${options.config!.template === "javascript" ? "module.exports =" : "export"} cla }); } - execute(interaction${options.config!.template === "typescript" ? `: CommandInteraction` : ""}) { + execute(client: ShewenyClient, interaction${options.config!.template === "typescript" ? `: CommandInteraction` : ""}) { return !["877090306103840778"].includes(interaction.guildId!); } - async onFailure(interaction${options.config!.template === "typescript" ? `: CommandInteraction` : ""}) { + async onFailure(client: ShewenyClient, interaction${options.config!.template === "typescript" ? `: CommandInteraction` : ""}) { await interaction.reply("Your guild is blacklisted."); } }; diff --git a/src/templates/V3/create/javascript/src/events/ready.ts b/src/templates/V3/create/javascript/src/events/ready.ts index 63f12f2..4d7520a 100644 --- a/src/templates/V3/create/javascript/src/events/ready.ts +++ b/src/templates/V3/create/javascript/src/events/ready.ts @@ -7,7 +7,7 @@ module.exports = class ReadyEvent extends Event { super(client, "ready", { description: "Client is logged in", once: true, - emitter: this.client, + emitter: client, }); } diff --git a/src/templates/V3/create/typescript/src/events/ready.ts b/src/templates/V3/create/typescript/src/events/ready.ts index f066035..882b6ee 100644 --- a/src/templates/V3/create/typescript/src/events/ready.ts +++ b/src/templates/V3/create/typescript/src/events/ready.ts @@ -8,7 +8,7 @@ export class ReadyEvent extends Event { super(client, "ready", { description: "Client is logged in", once: true, - emitter: this.client, + emitter: client, }); } diff --git a/src/templates/V3/create/typescript/src/inhibitors/inhibitor.ts b/src/templates/V3/create/typescript/src/inhibitors/inhibitor.ts index ed12c5a..820b990 100644 --- a/src/templates/V3/create/typescript/src/inhibitors/inhibitor.ts +++ b/src/templates/V3/create/typescript/src/inhibitors/inhibitor.ts @@ -11,7 +11,7 @@ export class BlackListInhibitor extends Inhibitor { }); } - execute(interaction: CommandInteraction) { + execute(client: ShewenyClient, interaction: CommandInteraction) { // Put a guild id return ![""].includes(interaction.guildId!); }