create-commandkit 1.1.3 → 1.1.4-dev.20240202000000
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 +16 -17
- package/dist/index.js +7 -0
- package/package.json +48 -18
- package/templates/JavaScript/cjs/README.md +10 -0
- package/templates/JavaScript/cjs/commandkit.cjs +6 -0
- package/templates/JavaScript/cjs/src/commands/General/ping.js +19 -0
- package/{src/templates → templates}/JavaScript/cjs/src/events/ready/ready.js +2 -2
- package/templates/JavaScript/cjs/src/index.js +22 -0
- package/templates/JavaScript/esm/README.md +10 -0
- package/templates/JavaScript/esm/commandkit.mjs +6 -0
- package/templates/JavaScript/esm/src/commands/General/ping.js +17 -0
- package/{src/templates → templates}/JavaScript/esm/src/events/ready/ready.js +2 -2
- package/templates/JavaScript/esm/src/index.js +26 -0
- package/src/constants.js +0 -46
- package/src/functions/copyTemplates.js +0 -6
- package/src/functions/installDeps.js +0 -6
- package/src/functions/setup.js +0 -33
- package/src/index.js +0 -61
- package/src/static/outroMessage.txt +0 -5
- package/src/templates/JavaScript/cjs/src/commands/General/ping.js +0 -19
- package/src/templates/JavaScript/cjs/src/index.js +0 -21
- package/src/templates/JavaScript/cjs/welcome.md +0 -8
- package/src/templates/JavaScript/esm/src/commands/General/ping.js +0 -17
- package/src/templates/JavaScript/esm/src/index.js +0 -26
- package/src/templates/JavaScript/esm/welcome.md +0 -8
package/README.md
CHANGED
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<img src="https://raw.githubusercontent.com/underctrl-io/commandkit/master/apps/docs/public/ckit_logo.
|
|
2
|
+
<img src="https://raw.githubusercontent.com/underctrl-io/commandkit/master/apps/docs/public/ckit_logo.svg" width="60%" />
|
|
3
3
|
<br />
|
|
4
4
|
<a href="https://ctrl.lol/discord"><img src="https://img.shields.io/discord/1055188344188973066?color=5865F2&logo=discord&logoColor=white" alt="support server" /></a>
|
|
5
|
-
<a href="https://www.npmjs.com/package/commandkit"><img src="https://img.shields.io/npm/v/commandkit?maxAge=3600
|
|
6
|
-
<a href="https://www.npmjs.com/package/create-commandkit"><img src="https://img.shields.io/npm/
|
|
7
|
-
<a href="https://www.npmjs.com/package/commandkit"><img src="https://img.shields.io/npm/dt/commandkit?maxAge=3600" alt="npm downloads" /></a>
|
|
5
|
+
<a href="https://www.npmjs.com/package/create-commandkit"><img src="https://img.shields.io/npm/v/create-commandkit?maxAge=3600" alt="npm version" /></a>
|
|
6
|
+
<a href="https://www.npmjs.com/package/create-commandkit"><img src="https://img.shields.io/npm/dt/create-commandkit?maxAge=3600" alt="npm downloads" /></a>
|
|
8
7
|
</div>
|
|
9
8
|
|
|
10
9
|
# create-commandkit
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
create-commandkit is a CLI utility to quickly instantiate a Discord bot with CommandKit.
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- Interactive, beautiful command-line interface 🖥️
|
|
16
|
+
- Supports CommonJS and ES Modules 📦
|
|
17
|
+
|
|
18
|
+
## Documentation
|
|
19
|
+
|
|
20
|
+
You can find the full documentation [here](https://commandkit.js.org).
|
|
13
21
|
|
|
14
22
|
## Usage
|
|
15
23
|
|
|
16
24
|
Run the following command in your terminal:
|
|
17
25
|
|
|
18
26
|
```sh
|
|
19
|
-
|
|
27
|
+
npx create-commandkit@latest
|
|
20
28
|
```
|
|
21
29
|
|
|
22
|
-
##
|
|
23
|
-
|
|
24
|
-
- Project directory
|
|
25
|
-
- Package manager (npm/pnpm/yarn)
|
|
26
|
-
- Module type (ESM/CommonJS)
|
|
27
|
-
- Bot token (written to .env)
|
|
28
|
-
|
|
29
|
-
## Links
|
|
30
|
+
## Support and Suggestions
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
- [Discord](https://ctrl.lol/discord)
|
|
33
|
-
- [npm](https://npmjs.com/package/create-commandkit)
|
|
32
|
+
Submit any queries or suggestions in our [Discord community](https://ctrl.lol/discord).
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});import{intro,text,select,password,confirm,outro}from"@clack/prompts";import colors from"colors";import gradient from"gradient-string";import path from"node:path";import url from"node:url";var __dirname=path.dirname(url.fileURLToPath(import.meta.url)),templates={js:{esm:`${__dirname}/../templates/JavaScript/esm`,cjs:`${__dirname}/../templates/JavaScript/cjs`}},textColors={commandkit:["#fdba74","#e4a5a2","#c288de","#b27bf9"],import:["#c586c0","#c586c0"],export:["#569cd6","#569cd6"],require:["#dcdcaa","#dcdcaa"],module:["#4ec9b0","#4ec9b0"],js:["#f7e01c","#f7e01c"],ts:["#2480c5","#2480c5"]},dependencies={js:["commandkit","discord.js","dotenv"]},commands={init:{npm:"npm init -y",yarn:"yarn init -y; yarn config set nodeLinker node-modules",pnpm:"pnpm init"}},hints={import:gradient(textColors.import)("import"),export:gradient(textColors.export)("export"),require:gradient(textColors.require)("require"),module:gradient(textColors.module)("exports"),javascript:gradient(textColors.js)("JavaScript"),typescript:gradient(textColors.ts)("TypeScript")},commandkit=gradient(textColors.commandkit)("CommandKit"),outroMsg=`
|
|
3
|
+
${gradient(textColors.commandkit)("Thank you for choosing CommandKit!")}
|
|
4
|
+
|
|
5
|
+
\u2022 Documentation: ${colors.blue("https://commandkit.js.org")}
|
|
6
|
+
\u2022 Join us on Discord: ${colors.blue("https://ctrl.lol/discord")}
|
|
7
|
+
`;import{execSync}from"child_process";import fs from"fs-extra";import path2 from"node:path";async function setup({manager:manager2,type:type2,token:token2,dir:dir2,stdio="pipe"}){await fs.emptyDir(dir2),execSync(commands.init[manager2],{cwd:dir2,stdio});let packageJsonPath=path2.join(dir2,"package.json"),packageJson=await fs.readJSON(packageJsonPath);delete packageJson.main,packageJson.name=packageJson.name.toLowerCase(),packageJson.type=type2=="esm"?"module":"commonjs",packageJson.version="0.0.0",packageJson.scripts={dev:"commandkit dev",build:"commandkit build",start:"commandkit start"},await fs.writeJSON(packageJsonPath,packageJson,{spaces:2}),await fs.writeFile(`${dir2}/.env`,`TOKEN="${token2}"`)}__name(setup,"setup");import{execSync as execSync2}from"node:child_process";function installDeps({manager:manager2,dir:dir2,lang,stdio="pipe"}){execSync2(`${manager2} add ${dependencies[lang].join(" ")}`,{cwd:dir2,stdio})}__name(installDeps,"installDeps");import fs2 from"fs-extra";async function copyTemplates({type:type2,dir:dir2,lang}){await fs2.copy(templates[lang][type2],dir2)}__name(copyTemplates,"copyTemplates");import path3 from"node:path";import colors2 from"colors";import fs3 from"fs-extra";console.clear();await intro(`Welcome to ${commandkit}!`);var dir=path3.resolve(process.cwd(),await text({message:"Enter a project directory:",placeholder:"Leave blank for current directory",defaultValue:".",validate:value=>{value=path3.resolve(process.cwd(),value);let isEmpty;try{isEmpty=fs3.readdirSync(value).length===0}catch{isEmpty=!0}return isEmpty?void 0:"Directory is not empty!"}})),manager=await select({message:"Select a package manager:",options:[{label:"npm",value:"npm"},{label:"pnpm",value:"pnpm"},{label:"yarn",value:"yarn"}]}),type=await select({message:"Select a module type:",options:[{label:"CommonJS",value:"cjs",hint:`${hints.require} & ${hints.module}`},{label:"ES Modules",value:"esm",hint:`${hints.import} & ${hints.export}`}]}),token=await password({message:"Enter your bot token:",mask:colors2.gray("*")}),installNow=await confirm({message:"Install dependencies now?",initialValue:!0});outro(colors2.cyan("Setup complete."));await setup({manager,dir,token,type});await copyTemplates({type,dir,lang:"js"});installNow&&await installDeps({manager,dir,lang:"js",stdio:"inherit"});console.log(outroMsg);
|
package/package.json
CHANGED
|
@@ -1,20 +1,50 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
"name": "create-commandkit",
|
|
3
|
+
"description": "Effortlessly create a CommandKit project",
|
|
4
|
+
"version": "1.1.4-dev.20240202000000",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"bin": "./dist/index.js",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"keywords": [
|
|
11
|
+
"commandkit",
|
|
12
|
+
"create-commandkit",
|
|
13
|
+
"discord.js",
|
|
14
|
+
"discord",
|
|
15
|
+
"node",
|
|
16
|
+
"client",
|
|
17
|
+
"cli",
|
|
18
|
+
"commands"
|
|
19
|
+
],
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"templates"
|
|
23
|
+
],
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/underctrl-io/commandkit",
|
|
27
|
+
"directory": "packages/create-commandkit"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://commandkit.js.org",
|
|
30
|
+
"scripts": {
|
|
31
|
+
"lint": "tsc --noEmit",
|
|
32
|
+
"dev": "tsup --watch",
|
|
33
|
+
"build": "tsup",
|
|
34
|
+
"deploy": "npm publish"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@clack/prompts": "^0.7.0",
|
|
38
|
+
"colors": "^1.4.0",
|
|
39
|
+
"fs-extra": "^11.1.1",
|
|
40
|
+
"gradient-string": "^2.0.2"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^20.11.6",
|
|
44
|
+
"@types/gradient-string": "^1.1.5",
|
|
45
|
+
"@types/fs-extra": "^11.0.4",
|
|
46
|
+
"typescript": "^5.3.3",
|
|
47
|
+
"tsconfig": "workspace:*",
|
|
48
|
+
"tsup": "^8.0.1"
|
|
49
|
+
}
|
|
20
50
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Welcome to CommandKit
|
|
2
|
+
|
|
3
|
+
> This project was generated by [create-commandkit](https://npmjs.com/package/create-commandkit).
|
|
4
|
+
|
|
5
|
+
Thanks for choosing CommandKit to build your Discord bot!
|
|
6
|
+
|
|
7
|
+
## Useful links
|
|
8
|
+
|
|
9
|
+
- [Documentation](https://commandkit.js.org)
|
|
10
|
+
- [Discord](https://ctrl.lol/discord)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
/** @type {import('commandkit').CommandData} */
|
|
3
|
+
data: {
|
|
4
|
+
name: 'ping',
|
|
5
|
+
description: 'Replies with Pong',
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {import('commandkit').SlashCommandProps} param0
|
|
10
|
+
*/
|
|
11
|
+
run: ({ interaction }) => {
|
|
12
|
+
interaction.reply('Pong!');
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
/** @type {import('commandkit').CommandOptions} */
|
|
16
|
+
options: {
|
|
17
|
+
// https://commandkit.js.org/typedef/CommandOptions
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require('dotenv/config');
|
|
2
|
+
|
|
3
|
+
const { Client, IntentsBitField } = require('discord.js');
|
|
4
|
+
const { CommandKit } = require('commandkit');
|
|
5
|
+
const { join } = require('path');
|
|
6
|
+
|
|
7
|
+
const client = new Client({
|
|
8
|
+
intents: [
|
|
9
|
+
IntentsBitField.Flags.Guilds,
|
|
10
|
+
IntentsBitField.Flags.GuildMembers,
|
|
11
|
+
IntentsBitField.Flags.GuildMessages,
|
|
12
|
+
IntentsBitField.Flags.MessageContent,
|
|
13
|
+
],
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
new CommandKit({
|
|
17
|
+
client,
|
|
18
|
+
eventsPath: join(__dirname, 'events'),
|
|
19
|
+
commandsPath: join(__dirname, 'commands'),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
client.login(process.env.TOKEN);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Welcome to CommandKit
|
|
2
|
+
|
|
3
|
+
> This project was generated by [create-commandkit](https://npmjs.com/package/create-commandkit).
|
|
4
|
+
|
|
5
|
+
Thanks for choosing CommandKit to build your Discord bot!
|
|
6
|
+
|
|
7
|
+
## Useful links
|
|
8
|
+
|
|
9
|
+
- [Documentation](https://commandkit.js.org)
|
|
10
|
+
- [Discord](https://ctrl.lol/discord)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @type {import('commandkit').CommandData} */
|
|
2
|
+
export const data = {
|
|
3
|
+
name: 'ping',
|
|
4
|
+
description: 'Replies with Pong',
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @param {import('commandkit').SlashCommandProps} param0
|
|
9
|
+
*/
|
|
10
|
+
export const run = ({ interaction }) => {
|
|
11
|
+
interaction.reply('Pong!');
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** @type {import('commandkit').CommandOptions} */
|
|
15
|
+
export const options = {
|
|
16
|
+
// https://commandkit.js.org/typedef/CommandOptions
|
|
17
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
|
|
3
|
+
import { Client, IntentsBitField } from 'discord.js';
|
|
4
|
+
import { CommandKit } from 'commandkit';
|
|
5
|
+
|
|
6
|
+
import { join, dirname } from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
|
|
9
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
|
|
11
|
+
const client = new Client({
|
|
12
|
+
intents: [
|
|
13
|
+
IntentsBitField.Flags.Guilds,
|
|
14
|
+
IntentsBitField.Flags.GuildMembers,
|
|
15
|
+
IntentsBitField.Flags.GuildMessages,
|
|
16
|
+
IntentsBitField.Flags.MessageContent,
|
|
17
|
+
],
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
new CommandKit({
|
|
21
|
+
client,
|
|
22
|
+
eventsPath: join(__dirname, 'events'),
|
|
23
|
+
commandsPath: join(__dirname, 'commands'),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
client.login(process.env.TOKEN);
|
package/src/constants.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
const gradient = require('gradient-string');
|
|
2
|
-
const colors = require('colors');
|
|
3
|
-
const fs = require('fs-extra');
|
|
4
|
-
|
|
5
|
-
exports.templates = {
|
|
6
|
-
js: {
|
|
7
|
-
esm: `${__dirname}/templates/JavaScript/esm`,
|
|
8
|
-
cjs: `${__dirname}/templates/JavaScript/cjs`,
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
exports.colors = {
|
|
13
|
-
commandkit: ['#fdba74', '#e4a5a2', '#c288de', '#b27bf9'],
|
|
14
|
-
import: ['#c586c0', '#c586c0'],
|
|
15
|
-
export: ['#569cd6', '#569cd6'],
|
|
16
|
-
require: ['#dcdcaa', '#dcdcaa'],
|
|
17
|
-
module: ['#4ec9b0', '#4ec9b0'],
|
|
18
|
-
js: ['#f7e01c', '#f7e01c'],
|
|
19
|
-
ts: ['#2480c5', '#2480c5']
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
exports.commands = {
|
|
23
|
-
init: { npm: 'npm init -y', yarn: 'yarn init -y', pnpm: 'pnpm init' },
|
|
24
|
-
install: {
|
|
25
|
-
npm: 'npm install commandkit discord.js dotenv nodemon',
|
|
26
|
-
yarn: 'yarn add commandkit discord.js dotenv nodemon',
|
|
27
|
-
pnpm: 'pnpm add commandkit discord.js dotenv nodemon',
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
exports.hints = {
|
|
32
|
-
import: gradient(exports.colors.import)('import'),
|
|
33
|
-
export: gradient(exports.colors.export)('export'),
|
|
34
|
-
require: gradient(exports.colors.require)('require'),
|
|
35
|
-
module: gradient(exports.colors.module)('exports'),
|
|
36
|
-
javascript: gradient(exports.colors.js)('JavaScript'),
|
|
37
|
-
typescript: gradient(exports.colors.ts)('TypeScript')
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
exports.commandkit = gradient(exports.colors.commandkit)('CommandKit');
|
|
41
|
-
exports.outroMsg = `
|
|
42
|
-
${gradient(exports.colors.commandkit)('Thank you for choosing CommandKit!')}
|
|
43
|
-
|
|
44
|
-
• Documentation: ${colors.blue('https://commandkit.js.org')}
|
|
45
|
-
• Join us on Discord: ${colors.blue('https://ctrl.lol/discord')}
|
|
46
|
-
`;
|
package/src/functions/setup.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const { execSync: ex } = require('child_process');
|
|
2
|
-
const { commands } = require('../constants');
|
|
3
|
-
|
|
4
|
-
const fs = require('fs-extra');
|
|
5
|
-
const path = require('path');
|
|
6
|
-
|
|
7
|
-
module.exports = async ({ manager, dir, token, type, stdio = 'pipe' }) => {
|
|
8
|
-
await fs.emptyDir(dir);
|
|
9
|
-
ex(commands.init[manager], { cwd: dir, stdio });
|
|
10
|
-
|
|
11
|
-
const packageJsonPath = path.join(dir, 'package.json');
|
|
12
|
-
const packageJson = await fs.readJSON(packageJsonPath);
|
|
13
|
-
|
|
14
|
-
const nameCleansed = packageJson.name.replace(
|
|
15
|
-
/^(?:(?:@(?:[a-z0-9-*~][a-z0-9-*._~]*)?\/[a-z0-9-._~])|[a-z0-9-~])[a-z0-9-._~]*$/, ''
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
packageJson.name = nameCleansed.length > 0 ? nameCleansed.replace(' ', '') : 'commandkit-app';
|
|
19
|
-
|
|
20
|
-
packageJson.name = packageJson.name.toLowerCase();
|
|
21
|
-
packageJson.type = type == 'esm' ? 'module' : 'commonjs';
|
|
22
|
-
|
|
23
|
-
packageJson.main = './src/index.js';
|
|
24
|
-
packageJson.version = '0.0.0';
|
|
25
|
-
|
|
26
|
-
packageJson.scripts = {
|
|
27
|
-
start: 'node ./src/index.js',
|
|
28
|
-
dev: 'nodemon --ext js,json,ts ./src/index.js'
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
await fs.writeJSON(packageJsonPath, packageJson, { spaces: 4 });
|
|
32
|
-
await fs.writeFile(`${dir}/.env`, `TOKEN = ${token}`);
|
|
33
|
-
}
|
package/src/index.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
console.clear();
|
|
3
|
-
|
|
4
|
-
const prompts = require('@clack/prompts');
|
|
5
|
-
|
|
6
|
-
const { gray, cyan } = require('colors');
|
|
7
|
-
const { commandkit, hints, outroMsg } = require('./constants');
|
|
8
|
-
|
|
9
|
-
const setup = require('./functions/setup');
|
|
10
|
-
const installDeps = require('./functions/installDeps');
|
|
11
|
-
const copyTemplates = require('./functions/copyTemplates');
|
|
12
|
-
|
|
13
|
-
const path = require('path');
|
|
14
|
-
const fs = require('fs-extra');
|
|
15
|
-
|
|
16
|
-
(async () => {
|
|
17
|
-
prompts.intro(`Welcome to ${commandkit}!`);
|
|
18
|
-
|
|
19
|
-
const dir = path.resolve(process.cwd(), await prompts.text({
|
|
20
|
-
message: 'Enter a project directory:',
|
|
21
|
-
placeholder: 'Leave blank for current directory',
|
|
22
|
-
defaultValue: '.',
|
|
23
|
-
validate: (value) => {
|
|
24
|
-
value = path.resolve(process.cwd(), value);
|
|
25
|
-
let isEmpty;
|
|
26
|
-
|
|
27
|
-
try {
|
|
28
|
-
const contents = fs.readdirSync(value);
|
|
29
|
-
isEmpty = contents.length === 0;
|
|
30
|
-
} catch { isEmpty = true }
|
|
31
|
-
|
|
32
|
-
return isEmpty ? undefined : 'Directory is not empty!';
|
|
33
|
-
}
|
|
34
|
-
}));
|
|
35
|
-
|
|
36
|
-
const manager = await prompts.select({
|
|
37
|
-
message: 'Select a package manager:',
|
|
38
|
-
options: [{ value: 'npm' }, { value: 'pnpm' }, { value: 'yarn' }],
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const type = await prompts.select({
|
|
42
|
-
message: 'Select a module type:',
|
|
43
|
-
options: [
|
|
44
|
-
{ label: 'CommonJS', value: 'cjs', hint: `${hints.require} & ${hints.module}` },
|
|
45
|
-
{ label: 'ES Modules', value: 'esm', hint: `${hints.import} & ${hints.export}` },
|
|
46
|
-
]
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
const token = await prompts.password({
|
|
50
|
-
message: 'Enter your bot token:',
|
|
51
|
-
mask: gray('*')
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
prompts.outro(cyan('Setup complete.'));
|
|
55
|
-
|
|
56
|
-
await setup({ manager, dir, token, type });
|
|
57
|
-
await copyTemplates({ type, dir, lang: 'js' });
|
|
58
|
-
await installDeps({ manager, dir, stdio: 'inherit' });
|
|
59
|
-
|
|
60
|
-
console.log(outroMsg);
|
|
61
|
-
})();
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
/** @type {import('commandkit').CommandData} */
|
|
3
|
-
data: {
|
|
4
|
-
name: 'ping',
|
|
5
|
-
description: 'Replies with Pong'
|
|
6
|
-
},
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @param {import('commandkit').SlashCommandProps} param0
|
|
10
|
-
*/
|
|
11
|
-
run: ({ interaction }) => {
|
|
12
|
-
interaction.reply('Pong!');
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
/** @type {import('commandkit').CommandOptions} */
|
|
16
|
-
options: {
|
|
17
|
-
// https://commandkit.js.org/typedef/CommandOptions
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
require('dotenv/config');
|
|
2
|
-
|
|
3
|
-
const { Client, IntentsBitField } = require('discord.js');
|
|
4
|
-
const { CommandKit } = require('commandkit');
|
|
5
|
-
|
|
6
|
-
const client = new Client({
|
|
7
|
-
intents: [
|
|
8
|
-
IntentsBitField.Flags.Guilds,
|
|
9
|
-
IntentsBitField.Flags.GuildMembers,
|
|
10
|
-
IntentsBitField.Flags.GuildMessages,
|
|
11
|
-
IntentsBitField.Flags.MessageContent
|
|
12
|
-
]
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
new CommandKit({
|
|
16
|
-
client,
|
|
17
|
-
eventsPath: `${__dirname}/events`,
|
|
18
|
-
commandsPath: `${__dirname}/commands`
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
client.login(process.env.TOKEN);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/** @type {import('commandkit').CommandData} */
|
|
2
|
-
export const data = {
|
|
3
|
-
name: 'ping',
|
|
4
|
-
description: 'Replies with Pong'
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @param {import('commandkit').SlashCommandProps} param0
|
|
9
|
-
*/
|
|
10
|
-
export const run = ({ interaction }) => {
|
|
11
|
-
interaction.reply('Pong!');
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/** @type {import('commandkit').CommandOptions} */
|
|
15
|
-
export const options = {
|
|
16
|
-
// https://commandkit.js.org/typedef/CommandOptions
|
|
17
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import 'dotenv/config';
|
|
2
|
-
|
|
3
|
-
import { Client, IntentsBitField } from 'discord.js';
|
|
4
|
-
import { CommandKit } from 'commandkit';
|
|
5
|
-
|
|
6
|
-
import { dirname as dn } from 'node:path';
|
|
7
|
-
import { fileURLToPath } from 'node:url';
|
|
8
|
-
|
|
9
|
-
const dirname = dn(fileURLToPath(import.meta.url));
|
|
10
|
-
|
|
11
|
-
const client = new Client({
|
|
12
|
-
intents: [
|
|
13
|
-
IntentsBitField.Flags.Guilds,
|
|
14
|
-
IntentsBitField.Flags.GuildMembers,
|
|
15
|
-
IntentsBitField.Flags.GuildMessages,
|
|
16
|
-
IntentsBitField.Flags.MessageContent
|
|
17
|
-
]
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
new CommandKit({
|
|
21
|
-
client,
|
|
22
|
-
eventsPath: `${dirname}/events`,
|
|
23
|
-
commandsPath: `${dirname}/commands`
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
client.login(process.env.TOKEN);
|