discord.js icon indicating copy to clipboard operation
discord.js copied to clipboard

feat(create-discord-bot): Add prompts, command handler and deployment script

Open suneettipirneni opened this issue 1 year ago • 4 comments

Please describe the changes this PR makes and why it should be merged:

In addition to the titular changes, this uses top level await in the script where applicable.

  • Closes GDE-82
  • Closes GDE-83
  • Closes GDE-85
  • Closes GDE-86

🤖 Generated by Copilot at 18c3c4c

  • Simplify the package structure and remove the need for TypeScript compilation by replacing the create-discord-bot.ts file with the create-discord-bot.js file (link)
  • Export a function to create a discord bot based on the user's input from the index.ts file, which uses the commander and prompts packages to parse the command-line arguments and ask for the user's preferences (link)
  • Change the bin field in the package.json file to point to the index.mjs file instead of the create-discord-bot.mjs file, which was removed (link)
  • Add the prompts and @types/prompts dependencies to the package.json file to interact with the user and provide TypeScript type definitions (link, link)
  • A .env file to store the application ID of the discord bot, which is needed to register the commands (link, link)
  • A deploy script and a @discordjs/core dependency in the package.json file to register the commands to the discord API and provide HTTP methods and types (link, link)
  • A commands directory with an index.js or index.ts file to define the type and predicate for the commands, and a ping.js or ping.ts file to define and export a simple ping command (link, link, link, link)
  • An events directory with an index.js or index.ts file to define the type and predicate for the events, and a ready.js file to define and export a simple ready event (link, link, link)
  • A util directory with a deploy.js file to load the commands and register them to the discord API, a loaders.js or loaders.ts file to load and validate the commands and events, and a registerEvents.js or registerEvents.ts file to register the event handlers for the commands and events to the client (link, link, link)
  • A src/index.js or src/index.ts file to use the loaders.js or loaders.ts and registerEvents.js or registerEvents.ts files to load and register the commands and events (link, link)
  • Disable the jsdoc linting for the commands and events in the .eslintrc.json file in the JavaScript template, as it was causing some errors and warnings for the types and tags used (link)

suneettipirneni avatar May 14 '23 20:05 suneettipirneni

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
discord-js ⬜️ Ignored (Inspect) Jul 16, 2023 4:57pm
discord-js-guide ⬜️ Ignored (Inspect) Jul 16, 2023 4:57pm

vercel[bot] avatar May 14 '23 20:05 vercel[bot]

why is there javascript variable we are checking only typescript so some conversion should be done

jaw0r3k avatar May 14 '23 20:05 jaw0r3k

I'm getting some errors picked up by ESLint in the template directory, but the lint script does not check that. Should that be tweaked?

Jiralite avatar May 15 '23 19:05 Jiralite

Codecov Report

Merging #9570 (38165fb) into main (20268ac) will increase coverage by 0.10%. The diff coverage is n/a.

:exclamation: Current head 38165fb differs from pull request most recent head 7fa1865. Consider uploading reports for the commit 7fa1865 to get more accurate results

@@            Coverage Diff             @@
##             main    #9570      +/-   ##
==========================================
+ Coverage   58.06%   58.17%   +0.10%     
==========================================
  Files         227      227              
  Lines       14948    14891      -57     
  Branches     1131     1130       -1     
==========================================
- Hits         8680     8663      -17     
+ Misses       6228     6188      -40     
  Partials       40       40              
Flag Coverage Δ
brokers 63.16% <ø> (ø)
builders 98.69% <ø> (ø)
collection 99.87% <ø> (ø)
guide 0.00% <ø> (ø)
proxy 76.31% <ø> (ø)
rest 93.18% <ø> (+0.25%) :arrow_up:
util 98.49% <ø> (ø)
utilities 100.00% <ø> (ø)
voice 63.47% <ø> (ø)
website 0.00% <ø> (ø)
ws 53.88% <ø> (+0.94%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

see 8 files with indirect coverage changes

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Jun 12 '23 18:06 codecov[bot]