Skip to content
This repository was archived by the owner on Jan 8, 2022. It is now read-only.

feat(SlashCommands): add slash command builders#3

Merged
iCrawl merged 8 commits intomainfrom
feat/slash-commands
Jul 16, 2021
Merged

feat(SlashCommands): add slash command builders#3
iCrawl merged 8 commits intomainfrom
feat/slash-commands

Conversation

@vladfrangu
Copy link
Member

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

Building your slash commands is now easier than ever! For those that dislike the nested arrays, this might tickle your fancy!

image
image
image
image

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
  • This PR changes the library's interface (methods or parameters added)

Copy link
Member

@kyranet kyranet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many classes and many fields need to be documented, and I'm not a fan of having many classes in the same file.

* Returns the final data that should be sent to Discord. You won't need this unless you're manually
* creating slash commands via this builder.
*
* **Note:** Calling this getter will validate required properties based on their conditions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's @note too, although we can use <warn></warn> in this organization.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't rely too much on docs comments too much yet honestly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's @note too, although we can use <warn></warn> in this organization.

warn tags don't render in any IDE that I know off either. I believe it's fine as is

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@note doesnt render either?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They sort of do, but I still wouldn't use them. Whats wrong with the current approach?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing, just asking.

@vladfrangu vladfrangu force-pushed the feat/slash-commands branch from 2faf7c0 to 6c0aca4 Compare June 30, 2021 19:47
@codecov-commenter
Copy link

codecov-commenter commented Jun 30, 2021

Codecov Report

Merging #3 (4348275) into main (879c235) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              main        #3    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files            1        15    +14     
  Lines           34       137   +103     
  Branches         6        20    +14     
==========================================
+ Hits            34       137   +103     
Impacted Files Coverage Δ
src/interactions/slashCommands/Assertions.ts 100.00% <100.00%> (ø)
.../interactions/slashCommands/SlashCommandBuilder.ts 100.00% <100.00%> (ø)
...eractions/slashCommands/SlashCommandSubCommands.ts 100.00% <100.00%> (ø)
...ractions/slashCommands/mixins/CommandOptionBase.ts 100.00% <100.00%> (ø)
...s/slashCommands/mixins/CommandOptionWithChoices.ts 100.00% <100.00%> (ø)
...nteractions/slashCommands/mixins/CommandOptions.ts 100.00% <100.00%> (ø)
...actions/slashCommands/mixins/NameAndDescription.ts 100.00% <100.00%> (ø)
src/interactions/slashCommands/options/boolean.ts 100.00% <100.00%> (ø)
src/interactions/slashCommands/options/channel.ts 100.00% <100.00%> (ø)
src/interactions/slashCommands/options/integer.ts 100.00% <100.00%> (ø)
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 879c235...4348275. Read the comment docs.

@vladfrangu vladfrangu requested a review from kyranet June 30, 2021 20:49
@vladfrangu vladfrangu requested review from SpaceEEC, iCrawl and kyranet July 6, 2021 16:51
@iCrawl
Copy link
Member

iCrawl commented Jul 13, 2021

This needs a rebase now.

@vladfrangu vladfrangu force-pushed the feat/slash-commands branch 2 times, most recently from fa24516 to 3417f12 Compare July 13, 2021 08:20
chore: code reviews v1

Co-authored-by: Antonio Román <kyradiscord@gmail.com>

chore: update tsconfig per requests

chore: requested changes v2

chore: split files up

fix: correct regexp for slash command name

chore: add documentation to all properties

fix: @SpaceEEC's issues related to more helpful messages

fix: make null/undefined message clearer

chore: coverages

chore: create validation predicates once

chore: cleanup `any` casts in Assertions

fix: no more `as any` casts! \o/

fix: mark name and description as readonly
These are mostly to prevent TS users from accidentally setting the values
without using the set* methods (which handle validation)

chore: update core files

chore: fix rebase
@vladfrangu vladfrangu force-pushed the feat/slash-commands branch from 3417f12 to 7ea8a19 Compare July 13, 2021 08:22
For safety reasons in the event I need to rebase AGAIN, I can just drop this and recreate
Copy link
Member

@iCrawl iCrawl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, we should have some markdown docs/examples on some basic/advanced usage and we need to make sure to update all of this once /v9 of dapi-types lands 👍

Co-authored-by: SpaceEEC <SpaceEEC@users.noreply.github.com>
@vladfrangu vladfrangu requested a review from SpaceEEC July 16, 2021 13:02
@iCrawl iCrawl self-requested a review July 16, 2021 17:45
@iCrawl iCrawl merged commit 6aa3af0 into main Jul 16, 2021
@iCrawl iCrawl deleted the feat/slash-commands branch July 16, 2021 17:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants