diff --git a/package.json b/package.json index 0661da0..4fcde20 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "prompts": "^2.4.2" }, "devDependencies": { - "prettier": "^3.1.0" + "prettier": "^3.1.0", + "typescript": "^5.3.3" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index db714e1..af97f26 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -25,6 +25,9 @@ devDependencies: prettier: specifier: ^3.1.0 version: 3.1.0 + typescript: + specifier: ^5.3.3 + version: 5.3.3 packages: @@ -159,6 +162,12 @@ packages: tinycolor2: 1.6.0 dev: false + /typescript@5.3.3: + resolution: {integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==} + engines: {node: '>=14.17'} + hasBin: true + dev: true + /universalify@2.0.1: resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} engines: {node: '>= 10.0.0'} diff --git a/src/templates/TypeScript/src/commands/General/ping.ts b/src/templates/TypeScript/src/commands/General/ping.ts new file mode 100644 index 0000000..d4ddbe6 --- /dev/null +++ b/src/templates/TypeScript/src/commands/General/ping.ts @@ -0,0 +1,17 @@ +import type { CommandData, SlashCommandProps, CommandOptions } from 'commandkit'; + +export const data: CommandData = { + name: 'ping', + description: 'Pong!', +} + +export function run({ interaction, client, handler }: SlashCommandProps) { + interaction.reply(`:ping_pong: Pong! ${client.ws.ping}ms`); +} + +export const options: CommandOptions = { + devOnly: true, + userPermissions: ['Administrator', 'AddReactions'], + botPermissions: ['Administrator', 'AddReactions'], + deleted: false, +} \ No newline at end of file diff --git a/src/templates/TypeScript/src/events/ready/consoleLog.ts b/src/templates/TypeScript/src/events/ready/consoleLog.ts new file mode 100644 index 0000000..025e8a4 --- /dev/null +++ b/src/templates/TypeScript/src/events/ready/consoleLog.ts @@ -0,0 +1,6 @@ +import { Client } from 'discord.js'; +import { CommandKit } from 'commandkit'; + +export default function (c: Client, client: Client, handler: CommandKit) { + console.log(`${c.user.username} is ready!`); +}; \ No newline at end of file diff --git a/src/templates/TypeScript/src/index.ts b/src/templates/TypeScript/src/index.ts new file mode 100644 index 0000000..1b96bd1 --- /dev/null +++ b/src/templates/TypeScript/src/index.ts @@ -0,0 +1,16 @@ +import { config } from 'dotenv'; +import { Client, IntentsBitField } from 'discord.js'; +import { CommandKit } from 'commandkit'; +import path from 'path' + +const client = new Client({ + intents: [ 'Guilds', 'GuildMessages', 'GuildMembers', 'MessageContent' ], +}); + +new CommandKit({ + client, + eventsPath: path.join(__dirname, 'events'), + commandsPath: path.join(__dirname, 'commands') +}); + +client.login(process.env.TOKEN); \ No newline at end of file diff --git a/src/templates/TypeScript/tsconfig.json b/src/templates/TypeScript/tsconfig.json new file mode 100644 index 0000000..55fbaa7 --- /dev/null +++ b/src/templates/TypeScript/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "CommonJS", + "rootDir": "./src", + "outDir": "./dist", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true + } +} \ No newline at end of file