create-reciple 7.0.0-dev.14 → 7.0.0-dev.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -0,0 +1,7 @@
1
+ # create-reciple
2
+
3
+ A tool to create starter project for Reciple
4
+
5
+ ```bash
6
+ npm create reciple@latest
7
+ ```
package/bin/create.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export declare function create(cwd: string, templateDir: string): Promise<void>;
2
2
  export declare function copyFile(from: string, to: string, rename?: (f: string) => string): void;
3
+ export declare function runScript(command: string, cwd: string, options?: string[]): Promise<unknown>;
package/bin/create.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { spawn } from 'child_process';
1
2
  import { copyFileSync, lstatSync, mkdirSync, readdirSync } from 'fs';
2
3
  import path from 'path';
3
4
  import { fileURLToPath } from 'url';
@@ -8,6 +9,8 @@ export async function create(cwd, templateDir) {
8
9
  mkdirSync(cwd, { recursive: true });
9
10
  copyFile(templateDir, cwd);
10
11
  copyFile(path.join(root, 'assets'), cwd, f => f.replace('dot.', '.'));
12
+ await runScript('npm', cwd, ['install']);
13
+ await runScript('npx', cwd, ['reciple', '-y']);
11
14
  }
12
15
  export function copyFile(from, to, rename) {
13
16
  const isDirectory = lstatSync(from).isDirectory();
@@ -21,4 +24,12 @@ export function copyFile(from, to, rename) {
21
24
  mkdirSync(path.dirname(to), { recursive: true });
22
25
  copyFileSync(from, to);
23
26
  }
27
+ export function runScript(command, cwd, options) {
28
+ const child = spawn(command, options ?? [], { cwd, env: { ...process.env, FORCE_COLOR: '1' }, stdio: ['inherit', 'inherit', 'inherit'] });
29
+ child.stdout?.pipe(process.stdout);
30
+ child.stderr?.pipe(process.stderr);
31
+ if (child.stdin)
32
+ process.stdin.pipe(child.stdin);
33
+ return new Promise((res) => child.on('close', () => res(void 0)));
34
+ }
24
35
  //# sourceMappingURL=create.js.map
package/bin/create.js.map CHANGED
@@ -1 +1 @@
1
- {"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AC,CAAC;IAEjD,OAAO,IAAI,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACtE,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-reciple",
3
3
  "license": "GPL-3.0",
4
- "version": "7.0.0-dev.14",
4
+ "version": "7.0.0-dev.16",
5
5
  "type": "module",
6
6
  "description": "Starter project for Reciple handler",
7
7
  "types": "./bin/bin.d.ts",
@@ -14,6 +14,7 @@
14
14
  "bin",
15
15
  "static",
16
16
  "templates.json",
17
+ "templates",
17
18
  "assets",
18
19
  "README.md"
19
20
  ],
@@ -24,5 +25,5 @@
24
25
  "devDependencies": {
25
26
  "@types/prompts": "^2.4.2"
26
27
  },
27
- "gitHead": "1a69b8835ced23a18de02b66d9186802af2dac96"
28
+ "gitHead": "10593e2904aeb455590d38505af6f9bc2b3c62b7"
28
29
  }
@@ -0,0 +1,40 @@
1
+ const { ContextMenuCommandBuilder, MessageCommandBuilder, SlashCommandBuilder } = require('reciple');
2
+ const { ApplicationCommandType } = require('discord.js');
3
+
4
+ /**
5
+ * @type {import('reciple').RecipleModuleScript}
6
+ */
7
+ module.exports = {
8
+ versions: ['^7'], // Module supports reciple client version 7
9
+ commands: [
10
+ // Right click a message to execute command
11
+ new ContextMenuCommandBuilder()
12
+ .setName(`Test Context Menu`)
13
+ .setType(ApplicationCommandType.Message)
14
+ .setExecute(async data => data.interaction.reply(`Hello!`)),
15
+
16
+ // Send !test to execute command
17
+ new MessageCommandBuilder()
18
+ .setName(`test`)
19
+ .setDescription(`Test message command`)
20
+ .setAliases(`t`)
21
+ .setExecute(async data => data.message.reply(`Test message command`)),
22
+
23
+ // Use /test to execute command
24
+ new SlashCommandBuilder()
25
+ .setName(`test`)
26
+ .setDescription(`Test slash command`)
27
+ .setExecute(async data => data.interaction.reply(`Test slash command`))
28
+ ],
29
+
30
+ // Module resolved logic here (Bot not logged in)
31
+ onStart(client) {
32
+ return true;
33
+ },
34
+
35
+ // Module loaded logic here (Bot logged in)
36
+ onLoad(client, module) {},
37
+
38
+ // Unload logic here
39
+ onUnload({ reason, client }) {}
40
+ };
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "reciple-app",
3
+ "private": true,
4
+ "scripts": {
5
+ "start": "npx reciple"
6
+ },
7
+ "dependencies": {
8
+ "discord.js": "^14",
9
+ "reciple": "^7.0.0-dev.14"
10
+ }
11
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "reciple-app",
3
+ "private": true,
4
+ "scripts": {
5
+ "build": "npx rimraf ./modules && npx tsc",
6
+ "start": "npx reciple"
7
+ },
8
+ "dependencies": {
9
+ "discord.js": "^14",
10
+ "reciple": "^7.0.0-dev.14"
11
+ },
12
+ "devDependencies": {
13
+ "typescript": "^4",
14
+ "rimraf": "^4"
15
+ }
16
+ }
@@ -0,0 +1,43 @@
1
+ import { ContextMenuCommandBuilder, MessageCommandBuilder, RecipleModuleScript, SlashCommandBuilder } from 'reciple';
2
+ import { ApplicationCommandType } from 'discord.js';
3
+
4
+ export default {
5
+ versions: ['^7'], // Module supports reciple client version 7
6
+ commands: [
7
+ // Right click a message to execute command
8
+ new ContextMenuCommandBuilder()
9
+ .setName(`Test Context Menu`)
10
+ .setType(ApplicationCommandType.Message)
11
+ .setExecute(async data => {
12
+ await data.interaction.reply(`Hello!`);
13
+ }),
14
+
15
+ // Send !test to execute command
16
+ new MessageCommandBuilder()
17
+ .setName(`test`)
18
+ .setDescription(`Test message command`)
19
+ .setAliases(`t`)
20
+ .setExecute(async data => {
21
+ await data.message.reply(`Test message command`);
22
+ }),
23
+
24
+ // Use /test to execute command
25
+ new SlashCommandBuilder()
26
+ .setName(`test`)
27
+ .setDescription(`Test slash command`)
28
+ .setExecute(async data => {
29
+ await data.interaction.reply(`Test slash command`);
30
+ })
31
+ ],
32
+
33
+ // Module resolved logic here (Bot not logged in)
34
+ onStart(client) {
35
+ return true;
36
+ },
37
+
38
+ // Module loaded logic here (Bot logged in)
39
+ onLoad(client, module_) {},
40
+
41
+ // Unload logic here
42
+ onUnload({ reason, client }) {}
43
+ } satisfies RecipleModuleScript;
@@ -0,0 +1,14 @@
1
+ {
2
+ "include": ["./src/**/*"],
3
+ "compilerOptions": {
4
+ "rootDir": "./src",
5
+ "outDir": "./modules",
6
+ "target": "ES2020",
7
+ "module": "Node16",
8
+ "moduleResolution": "node16",
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "sourceMap": true,
12
+ "strict": true
13
+ }
14
+ }