create-commandkit 1.1.4-dev.20250215123740 → 1.1.4-dev.20250330121535
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/dist/index.js +2 -2
- package/package.json +1 -1
- package/templates/JavaScript/{app/cjs/README.md → README.md} +6 -0
- package/templates/JavaScript/commandkit-env.d.ts +1 -0
- package/templates/JavaScript/commandkit.config.mjs +3 -0
- package/templates/{TypeScript/app/cjs/tsconfig.json → JavaScript/jsconfig.json} +6 -3
- package/templates/JavaScript/{app/esm/src/app/commands/ping/command.js → src/app/commands/ping.js} +7 -4
- package/templates/{TypeScript/app/cjs/src/index.ts → JavaScript/src/app.js} +1 -8
- package/templates/{JavaScript/legacy/cjs → TypeScript}/README.md +6 -0
- package/templates/TypeScript/commandkit-env.d.ts +1 -0
- package/templates/TypeScript/commandkit.config.ts +3 -0
- package/templates/{JavaScript/app/cjs/src/app/commands/ping/command.js → TypeScript/src/app/commands/ping.ts} +5 -4
- package/templates/TypeScript/{app/esm/src/index.ts → src/app.ts} +1 -8
- package/templates/{JavaScript/app/cjs → TypeScript}/tsconfig.json +6 -3
- package/templates/JavaScript/app/cjs/commandkit.mjs +0 -6
- package/templates/JavaScript/app/cjs/src/app/events/ready/log.js +0 -6
- package/templates/JavaScript/app/cjs/src/index.js +0 -19
- package/templates/JavaScript/app/esm/README.md +0 -10
- package/templates/JavaScript/app/esm/commandkit.mjs +0 -6
- package/templates/JavaScript/app/esm/src/index.js +0 -19
- package/templates/JavaScript/app/esm/tsconfig.json +0 -23
- package/templates/JavaScript/legacy/cjs/commandkit.cjs +0 -6
- package/templates/JavaScript/legacy/cjs/src/commands/General/ping.js +0 -19
- package/templates/JavaScript/legacy/cjs/src/events/ready/ready.js +0 -4
- package/templates/JavaScript/legacy/cjs/src/index.js +0 -22
- package/templates/JavaScript/legacy/esm/README.md +0 -10
- package/templates/JavaScript/legacy/esm/commandkit.mjs +0 -6
- package/templates/JavaScript/legacy/esm/src/commands/General/ping.js +0 -17
- package/templates/JavaScript/legacy/esm/src/events/ready/ready.js +0 -4
- package/templates/JavaScript/legacy/esm/src/index.js +0 -23
- package/templates/TypeScript/app/cjs/README.md +0 -10
- package/templates/TypeScript/app/cjs/commandkit.mjs +0 -6
- package/templates/TypeScript/app/cjs/src/app/commands/ping/command.ts +0 -24
- package/templates/TypeScript/app/cjs/src/app/locales/en-US/ping.json +0 -9
- package/templates/TypeScript/app/esm/README.md +0 -10
- package/templates/TypeScript/app/esm/commandkit.mjs +0 -6
- package/templates/TypeScript/app/esm/src/app/commands/ping/command.ts +0 -24
- package/templates/TypeScript/app/esm/src/app/events/ready/log.ts +0 -5
- package/templates/TypeScript/app/esm/src/app/locales/en-US/ping.json +0 -9
- package/templates/TypeScript/app/esm/tsconfig.json +0 -23
- package/templates/TypeScript/legacy/cjs/README.md +0 -10
- package/templates/TypeScript/legacy/cjs/commandkit.cjs +0 -6
- package/templates/TypeScript/legacy/cjs/src/commands/General/ping.ts +0 -18
- package/templates/TypeScript/legacy/cjs/src/events/ready/ready.ts +0 -5
- package/templates/TypeScript/legacy/cjs/src/index.ts +0 -22
- package/templates/TypeScript/legacy/cjs/tsconfig.json +0 -23
- package/templates/TypeScript/legacy/esm/README.md +0 -10
- package/templates/TypeScript/legacy/esm/commandkit.mjs +0 -6
- package/templates/TypeScript/legacy/esm/src/commands/General/ping.ts +0 -18
- package/templates/TypeScript/legacy/esm/src/events/ready/ready.ts +0 -5
- package/templates/TypeScript/legacy/esm/src/index.ts +0 -23
- package/templates/TypeScript/legacy/esm/tsconfig.json +0 -23
- /package/templates/JavaScript/{app/esm/src → src}/app/events/ready/log.js +0 -0
- /package/templates/JavaScript/{app/cjs/src → src}/app/locales/en-US/ping.json +0 -0
- /package/templates/TypeScript/{app/cjs/src → src}/app/events/ready/log.ts +0 -0
- /package/templates/{JavaScript/app/esm → TypeScript}/src/app/locales/en-US/ping.json +0 -0
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:true});import{intro,text,select,password,confirm,outro}from"@clack/prompts";import colors from"picocolors";import gradient from"gradient-string";import path from"node:path";import url from"node:url";var __dirname=path.dirname(url.fileURLToPath(import.meta.url));var templates={js:
|
|
2
|
+
var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:true});import{intro,text,select,password,confirm,outro}from"@clack/prompts";import colors from"picocolors";import gradient from"gradient-string";import path from"node:path";import url from"node:url";var __dirname=path.dirname(url.fileURLToPath(import.meta.url));var templates={js:path.join(__dirname,"..","templates","JavaScript"),ts:path.join(__dirname,"..","templates","TypeScript")};var textColors={commandkit:["#fdba74","#e4a5a2","#c288de","#b27bf9"],js:["#f7e01c","#f7e01c"],ts:["#2480c5","#2480c5"]};var baseDependencies=["commandkit@dev","discord.js"];var dependencies={js:{dependencies:baseDependencies},ts:{dependencies:baseDependencies,devDependencies:["@types/node","typescript"]}};var commands={init:{npm:"npm init -y",yarn:"yarn init -y; yarn config set nodeLinker node-modules; yarn set version stable",pnpm:"pnpm init",bun:"bun init -y"}};var hints={javascript:gradient(textColors.js)("JavaScript"),typescript:gradient(textColors.ts)("TypeScript")};var commandkit=gradient(textColors.commandkit)("CommandKit");var outroMsg=__name(({manager:manager2})=>`
|
|
3
3
|
${gradient(textColors.commandkit)("Thank you for choosing CommandKit!")}
|
|
4
4
|
|
|
5
5
|
To start your bot, use the following commands:
|
|
@@ -13,4 +13,4 @@ To start your bot, use the following commands:
|
|
|
13
13
|
\u2022 Join us on Discord: ${colors.blue("https://ctrl.lol/discord")}
|
|
14
14
|
|
|
15
15
|
Happy coding! \u{1F680}
|
|
16
|
-
`,"outroMsg");import{execSync}from"child_process";import fs from"fs-extra";import path2 from"node:path";async function setup({manager:manager2,
|
|
16
|
+
`,"outroMsg");import{execSync}from"child_process";import fs from"fs-extra";import path2 from"node:path";async function setup({manager:manager2,token:token2,dir:dir2,stdio="pipe"}){await fs.emptyDir(dir2);execSync(commands.init[manager2],{cwd:dir2,stdio});const packageJsonPath=path2.join(dir2,"package.json");const packageJson=await fs.readJSON(packageJsonPath);delete packageJson.main;packageJson.name=packageJson.name.toLowerCase();packageJson.type="module";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`,`DISCORD_TOKEN="${token2}"`)}__name(setup,"setup");import{execSync as execSync2}from"node:child_process";function installDeps({manager:manager2,dir:dir2,lang:lang2,stdio="pipe"}){const depsCommand=`${manager2} add ${dependencies[lang2].dependencies.join(" ")}`;const devDepsCommand=`${manager2} add ${dependencies.ts.devDependencies.join(" ")}`;execSync2(depsCommand,{cwd:dir2,stdio});if(lang2=="ts"){execSync2(devDepsCommand,{cwd:dir2,stdio})}}__name(installDeps,"installDeps");import fs2 from"fs-extra";async function copyTemplates({dir:dir2,lang:lang2}){await fs2.copy(templates[lang2],dir2)}__name(copyTemplates,"copyTemplates");import path3 from"node:path";import colors2 from"picocolors";import fs3 from"fs-extra";import{execSync as execSync3}from"node:child_process";async function initializeGit(dir2){try{execSync3("git init",{cwd:dir2,stdio:"pipe"})}catch{}}__name(initializeGit,"initializeGit");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:__name(value=>{value=path3.resolve(process.cwd(),value);let isEmpty;try{const contents=fs3.readdirSync(value);isEmpty=contents.length===0}catch{isEmpty=true}return isEmpty?void 0:"Directory is not empty!"},"validate")}));var manager=await select({message:"Select a package manager:",initialValue:"npm",options:[{label:"npm",value:"npm"},{label:"pnpm",value:"pnpm"},{label:"yarn",value:"yarn"},{label:"bun",value:"bun"}]});var lang=await select({message:"Select the language to use:",initialValue:"ts",options:[{label:"JavaScript",value:"js"},{label:"TypeScript",value:"ts"}]});var token=await password({message:"Enter your bot token (stored in .env):",mask:colors2.gray("*")});var installNow=await confirm({message:"Install dependencies now?",initialValue:true});var gitInit=await confirm({message:"Initialize a git repository?",initialValue:true});outro(colors2.cyan("Setup complete."));await setup({manager,dir,token});await copyTemplates({dir,lang});if(gitInit){await initializeGit(dir)}if(installNow){await installDeps({manager,dir,lang:"js",stdio:"inherit"})}console.log(outroMsg({manager}));
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference path="node_modules/commandkit-types/index.d.ts" />
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"lib": ["
|
|
5
|
-
"target": "
|
|
4
|
+
"lib": ["ESNext", "DOM"],
|
|
5
|
+
"target": "ESNext",
|
|
6
6
|
"moduleResolution": "Bundler",
|
|
7
7
|
"module": "Preserve",
|
|
8
|
+
"allowImportingTsExtensions": true,
|
|
8
9
|
"esModuleInterop": true,
|
|
9
10
|
"resolveJsonModule": true,
|
|
10
11
|
"skipLibCheck": true,
|
|
12
|
+
"skipDefaultLibCheck": true,
|
|
11
13
|
"noUncheckedIndexedAccess": true,
|
|
12
14
|
"removeComments": true,
|
|
13
15
|
"allowJs": true,
|
|
14
16
|
"strict": true,
|
|
17
|
+
"alwaysStrict": true,
|
|
15
18
|
"noEmit": true,
|
|
16
19
|
"declaration": false,
|
|
17
20
|
"jsx": "react",
|
|
18
21
|
"jsxFactory": "CommandKit.createElement",
|
|
19
22
|
"jsxFragmentFactory": "CommandKit.Fragment"
|
|
20
23
|
},
|
|
21
|
-
"include": ["src"],
|
|
24
|
+
"include": ["src", "commandkit.config.mjs", "commandkit-env.d.ts"],
|
|
22
25
|
"exclude": ["dist", "node_modules", ".commandkit"]
|
|
23
26
|
}
|
package/templates/JavaScript/{app/esm/src/app/commands/ping/command.js → src/app/commands/ping.js}
RENAMED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @type {import('commandkit').CommandData}
|
|
3
|
+
*/
|
|
1
4
|
export const command = {
|
|
2
5
|
name: 'ping',
|
|
3
6
|
description: "Ping the bot to check if it's online.",
|
|
@@ -6,23 +9,23 @@ export const command = {
|
|
|
6
9
|
/**
|
|
7
10
|
* @param {import('commandkit').SlashCommandContext} ctx
|
|
8
11
|
*/
|
|
9
|
-
export async
|
|
12
|
+
export const chatInput = async (ctx) => {
|
|
10
13
|
const { t } = ctx.locale();
|
|
11
14
|
|
|
12
15
|
const latency = ctx.client.ws.ping ?? -1;
|
|
13
16
|
const response = await t('ping_response', { latency });
|
|
14
17
|
|
|
15
18
|
await ctx.interaction.reply(response);
|
|
16
|
-
}
|
|
19
|
+
};
|
|
17
20
|
|
|
18
21
|
/**
|
|
19
22
|
* @param {import('commandkit').MessageCommandContext} ctx
|
|
20
23
|
*/
|
|
21
|
-
export async
|
|
24
|
+
export const message = async (ctx) => {
|
|
22
25
|
const { t } = ctx.locale();
|
|
23
26
|
|
|
24
27
|
const latency = ctx.client.ws.ping ?? -1;
|
|
25
28
|
const response = await t('ping_response', { latency });
|
|
26
29
|
|
|
27
30
|
await ctx.message.reply(response);
|
|
28
|
-
}
|
|
31
|
+
};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
process.loadEnvFile();
|
|
2
|
-
|
|
3
1
|
import { Client, IntentsBitField } from 'discord.js';
|
|
4
|
-
import { CommandKit } from 'commandkit';
|
|
5
2
|
|
|
6
3
|
const client = new Client({
|
|
7
4
|
intents: [
|
|
@@ -12,8 +9,4 @@ const client = new Client({
|
|
|
12
9
|
],
|
|
13
10
|
});
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
client,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
commandkit.start(process.env.DISCORD_TOKEN);
|
|
12
|
+
export default client;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference path="node_modules/commandkit-types/index.d.ts" />
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { SlashCommand, MessageCommand, CommandData } from 'commandkit';
|
|
2
|
+
|
|
3
|
+
export const command: CommandData = {
|
|
3
4
|
name: 'ping',
|
|
4
5
|
description: "Ping the bot to check if it's online.",
|
|
5
6
|
};
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
export const chatInput: SlashCommand = async (ctx) => {
|
|
8
9
|
const { t } = ctx.locale();
|
|
9
10
|
|
|
10
11
|
const latency = ctx.client.ws.ping ?? -1;
|
|
@@ -13,7 +14,7 @@ module.exports.chatInput = async (ctx) => {
|
|
|
13
14
|
await ctx.interaction.reply(response);
|
|
14
15
|
};
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
export const message: MessageCommand = async (ctx) => {
|
|
17
18
|
const { t } = ctx.locale();
|
|
18
19
|
|
|
19
20
|
const latency = ctx.client.ws.ping ?? -1;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
process.loadEnvFile();
|
|
2
|
-
|
|
3
1
|
import { Client, IntentsBitField } from 'discord.js';
|
|
4
|
-
import { CommandKit } from 'commandkit';
|
|
5
2
|
|
|
6
3
|
const client = new Client({
|
|
7
4
|
intents: [
|
|
@@ -12,8 +9,4 @@ const client = new Client({
|
|
|
12
9
|
],
|
|
13
10
|
});
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
client,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
await commandkit.start(process.env.DISCORD_TOKEN);
|
|
12
|
+
export default client;
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"lib": ["
|
|
5
|
-
"target": "
|
|
4
|
+
"lib": ["ESNext", "DOM"],
|
|
5
|
+
"target": "ESNext",
|
|
6
6
|
"moduleResolution": "Bundler",
|
|
7
7
|
"module": "Preserve",
|
|
8
|
+
"allowImportingTsExtensions": true,
|
|
8
9
|
"esModuleInterop": true,
|
|
9
10
|
"resolveJsonModule": true,
|
|
10
11
|
"skipLibCheck": true,
|
|
12
|
+
"skipDefaultLibCheck": true,
|
|
11
13
|
"noUncheckedIndexedAccess": true,
|
|
12
14
|
"removeComments": true,
|
|
13
15
|
"allowJs": true,
|
|
14
16
|
"strict": true,
|
|
17
|
+
"alwaysStrict": true,
|
|
15
18
|
"noEmit": true,
|
|
16
19
|
"declaration": false,
|
|
17
20
|
"jsx": "react",
|
|
18
21
|
"jsxFactory": "CommandKit.createElement",
|
|
19
22
|
"jsxFragmentFactory": "CommandKit.Fragment"
|
|
20
23
|
},
|
|
21
|
-
"include": ["src"],
|
|
24
|
+
"include": ["src", "commandkit.config.ts", "commandkit-env.d.ts"],
|
|
22
25
|
"exclude": ["dist", "node_modules", ".commandkit"]
|
|
23
26
|
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
process.loadEnvFile();
|
|
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
|
-
const commandkit = new CommandKit({
|
|
16
|
-
client,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
commandkit.start(process.env.DISCORD_TOKEN);
|
|
@@ -1,10 +0,0 @@
|
|
|
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.dev)
|
|
10
|
-
- [Discord](https://ctrl.lol/discord)
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
process.loadEnvFile();
|
|
2
|
-
|
|
3
|
-
import { Client, IntentsBitField } from 'discord.js';
|
|
4
|
-
import { CommandKit } from '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
|
-
const commandkit = new CommandKit({
|
|
16
|
-
client,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
await commandkit.start(process.env.DISCORD_TOKEN);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"lib": ["ES2022"],
|
|
5
|
-
"target": "ES2022",
|
|
6
|
-
"moduleResolution": "Bundler",
|
|
7
|
-
"module": "Preserve",
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"resolveJsonModule": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"noUncheckedIndexedAccess": true,
|
|
12
|
-
"removeComments": true,
|
|
13
|
-
"allowJs": true,
|
|
14
|
-
"strict": true,
|
|
15
|
-
"noEmit": true,
|
|
16
|
-
"declaration": false,
|
|
17
|
-
"jsx": "react",
|
|
18
|
-
"jsxFactory": "CommandKit.createElement",
|
|
19
|
-
"jsxFragmentFactory": "CommandKit.Fragment"
|
|
20
|
-
},
|
|
21
|
-
"include": ["src"],
|
|
22
|
-
"exclude": ["dist", "node_modules", ".commandkit"]
|
|
23
|
-
}
|
|
@@ -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/docs/api-reference/types/CommandOptions
|
|
18
|
-
},
|
|
19
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
process.loadEnvFile();
|
|
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
|
-
const commandkit = new CommandKit({
|
|
17
|
-
client,
|
|
18
|
-
eventsPath: join(__dirname, 'events'),
|
|
19
|
-
commandsPath: join(__dirname, 'commands'),
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
commandkit.start(process.env.DISCORD_TOKEN);
|
|
@@ -1,10 +0,0 @@
|
|
|
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.dev)
|
|
10
|
-
- [Discord](https://ctrl.lol/discord)
|
|
@@ -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/docs/api-reference/types/CommandOptions
|
|
17
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
process.loadEnvFile();
|
|
2
|
-
|
|
3
|
-
import { Client, IntentsBitField } from 'discord.js';
|
|
4
|
-
import { CommandKit } from 'commandkit';
|
|
5
|
-
|
|
6
|
-
import { join } from 'node:path';
|
|
7
|
-
|
|
8
|
-
const client = new Client({
|
|
9
|
-
intents: [
|
|
10
|
-
IntentsBitField.Flags.Guilds,
|
|
11
|
-
IntentsBitField.Flags.GuildMembers,
|
|
12
|
-
IntentsBitField.Flags.GuildMessages,
|
|
13
|
-
IntentsBitField.Flags.MessageContent,
|
|
14
|
-
],
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const commandkit = new CommandKit({
|
|
18
|
-
client,
|
|
19
|
-
eventsPath: join(import.meta.dirname, 'events'),
|
|
20
|
-
commandsPath: join(import.meta.dirname, 'commands'),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
await commandkit.start(process.env.DISCORD_TOKEN);
|
|
@@ -1,10 +0,0 @@
|
|
|
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.dev)
|
|
10
|
-
- [Discord](https://ctrl.lol/discord)
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { SlashCommandContext, MessageCommandContext } from 'commandkit';
|
|
2
|
-
|
|
3
|
-
export const command = {
|
|
4
|
-
name: 'ping',
|
|
5
|
-
description: "Ping the bot to check if it's online.",
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export async function chatInput(ctx: SlashCommandContext) {
|
|
9
|
-
const { t } = ctx.locale();
|
|
10
|
-
|
|
11
|
-
const latency = ctx.client.ws.ping ?? -1;
|
|
12
|
-
const response = await t('ping_response', { latency });
|
|
13
|
-
|
|
14
|
-
await ctx.interaction.reply(response);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export async function message(ctx: MessageCommandContext) {
|
|
18
|
-
const { t } = ctx.locale();
|
|
19
|
-
|
|
20
|
-
const latency = ctx.client.ws.ping ?? -1;
|
|
21
|
-
const response = await t('ping_response', { latency });
|
|
22
|
-
|
|
23
|
-
await ctx.message.reply(response);
|
|
24
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
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.dev)
|
|
10
|
-
- [Discord](https://ctrl.lol/discord)
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { SlashCommandContext, MessageCommandContext } from 'commandkit';
|
|
2
|
-
|
|
3
|
-
export const command = {
|
|
4
|
-
name: 'ping',
|
|
5
|
-
description: "Ping the bot to check if it's online.",
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export async function chatInput(ctx: SlashCommandContext) {
|
|
9
|
-
const { t } = ctx.locale();
|
|
10
|
-
|
|
11
|
-
const latency = ctx.client.ws.ping ?? -1;
|
|
12
|
-
const response = await t('ping_response', { latency });
|
|
13
|
-
|
|
14
|
-
await ctx.interaction.reply(response);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export async function message(ctx: MessageCommandContext) {
|
|
18
|
-
const { t } = ctx.locale();
|
|
19
|
-
|
|
20
|
-
const latency = ctx.client.ws.ping ?? -1;
|
|
21
|
-
const response = await t('ping_response', { latency });
|
|
22
|
-
|
|
23
|
-
await ctx.message.reply(response);
|
|
24
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"lib": ["ES2022"],
|
|
5
|
-
"target": "ES2022",
|
|
6
|
-
"moduleResolution": "Bundler",
|
|
7
|
-
"module": "Preserve",
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"resolveJsonModule": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"noUncheckedIndexedAccess": true,
|
|
12
|
-
"removeComments": true,
|
|
13
|
-
"allowJs": true,
|
|
14
|
-
"strict": true,
|
|
15
|
-
"noEmit": true,
|
|
16
|
-
"declaration": false,
|
|
17
|
-
"jsx": "react",
|
|
18
|
-
"jsxFactory": "CommandKit.createElement",
|
|
19
|
-
"jsxFragmentFactory": "CommandKit.Fragment"
|
|
20
|
-
},
|
|
21
|
-
"include": ["src"],
|
|
22
|
-
"exclude": ["dist", "node_modules", ".commandkit"]
|
|
23
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
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.dev)
|
|
10
|
-
- [Discord](https://ctrl.lol/discord)
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
CommandData,
|
|
3
|
-
SlashCommandProps,
|
|
4
|
-
CommandOptions,
|
|
5
|
-
} from 'commandkit';
|
|
6
|
-
|
|
7
|
-
export const data: CommandData = {
|
|
8
|
-
name: 'ping',
|
|
9
|
-
description: 'Replies with Pong',
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const run = ({ interaction }: SlashCommandProps) => {
|
|
13
|
-
interaction.reply('Pong!');
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const options: CommandOptions = {
|
|
17
|
-
// https://commandkit.js.org/docs/api-reference/types/CommandOptions
|
|
18
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
process.loadEnvFile();
|
|
2
|
-
|
|
3
|
-
import { Client, IntentsBitField } from 'discord.js';
|
|
4
|
-
import { CommandKit } from 'commandkit';
|
|
5
|
-
import { join } from 'node: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
|
-
const commandkit = new CommandKit({
|
|
17
|
-
client,
|
|
18
|
-
eventsPath: join(__dirname, 'events'),
|
|
19
|
-
commandsPath: join(__dirname, 'commands'),
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
commandkit.start(process.env.DISCORD_TOKEN);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"lib": ["ES2022"],
|
|
5
|
-
"target": "ES2022",
|
|
6
|
-
"moduleResolution": "Bundler",
|
|
7
|
-
"module": "Preserve",
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"resolveJsonModule": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"noUncheckedIndexedAccess": true,
|
|
12
|
-
"removeComments": true,
|
|
13
|
-
"allowJs": true,
|
|
14
|
-
"strict": true,
|
|
15
|
-
"noEmit": true,
|
|
16
|
-
"declaration": false,
|
|
17
|
-
"jsx": "react",
|
|
18
|
-
"jsxFactory": "CommandKit.createElement",
|
|
19
|
-
"jsxFragmentFactory": "CommandKit.Fragment"
|
|
20
|
-
},
|
|
21
|
-
"include": ["src"],
|
|
22
|
-
"exclude": ["dist", "node_modules", ".commandkit"]
|
|
23
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
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.dev)
|
|
10
|
-
- [Discord](https://ctrl.lol/discord)
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
CommandData,
|
|
3
|
-
SlashCommandProps,
|
|
4
|
-
CommandOptions,
|
|
5
|
-
} from 'commandkit';
|
|
6
|
-
|
|
7
|
-
export const data: CommandData = {
|
|
8
|
-
name: 'ping',
|
|
9
|
-
description: 'Replies with Pong',
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const run = ({ interaction }: SlashCommandProps) => {
|
|
13
|
-
interaction.reply('Pong!');
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const options: CommandOptions = {
|
|
17
|
-
// https://commandkit.js.org/docs/api-reference/types/CommandOptions
|
|
18
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
process.loadEnvFile();
|
|
2
|
-
|
|
3
|
-
import { Client, IntentsBitField } from 'discord.js';
|
|
4
|
-
import { CommandKit } from 'commandkit';
|
|
5
|
-
|
|
6
|
-
import { join } from 'node:path';
|
|
7
|
-
|
|
8
|
-
const client = new Client({
|
|
9
|
-
intents: [
|
|
10
|
-
IntentsBitField.Flags.Guilds,
|
|
11
|
-
IntentsBitField.Flags.GuildMembers,
|
|
12
|
-
IntentsBitField.Flags.GuildMessages,
|
|
13
|
-
IntentsBitField.Flags.MessageContent,
|
|
14
|
-
],
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const commandkit = new CommandKit({
|
|
18
|
-
client,
|
|
19
|
-
eventsPath: join(import.meta.dirname, 'events'),
|
|
20
|
-
commandsPath: join(import.meta.dirname, 'commands'),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
await commandkit.start(process.env.DISCORD_TOKEN);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"lib": ["ES2022"],
|
|
5
|
-
"target": "ES2022",
|
|
6
|
-
"moduleResolution": "Bundler",
|
|
7
|
-
"module": "Preserve",
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"resolveJsonModule": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"noUncheckedIndexedAccess": true,
|
|
12
|
-
"removeComments": true,
|
|
13
|
-
"allowJs": true,
|
|
14
|
-
"strict": true,
|
|
15
|
-
"noEmit": true,
|
|
16
|
-
"declaration": false,
|
|
17
|
-
"jsx": "react",
|
|
18
|
-
"jsxFactory": "CommandKit.createElement",
|
|
19
|
-
"jsxFragmentFactory": "CommandKit.Fragment"
|
|
20
|
-
},
|
|
21
|
-
"include": ["src"],
|
|
22
|
-
"exclude": ["dist", "node_modules", ".commandkit"]
|
|
23
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|