Please sign in to access this page

Discord Slash Commands

Discord Slash Commands

16 devlogs
48h 53m
Created by Kapios

TLDR: Create and handle slash commands in discord.js more easily!
(boomer take) Making commands for Discord bots used to be simple. You scan the content of messages for your commands and then you reply. Granted, this wasn't exactly efficient, but now you have to do a whole thing with registering commands (and you don't even get a GUI for it!), and then handling each one.
I don't want to do that and chances are that neither do you. This tool will give you the option to write fewer lines of code when writing slash commands and a simple Terminal command to register them.

Timeline

Ship 1

Kapios

about 1 month ago

Kapios Covers 16 devlogs and 48h 53m

Had a bit of trouble with the NPM registry (and leaked my bot's token by accident, thankfully discord resets it), but it's published!

Update attachment

Migrator works!

Update attachment

NEW SYNTAX ALERT (and I hope it works!)

Update attachment

So this is how the handler will look. The code is basically copied from discordjs.guide. The app ID and token are in the ctor cause i'm too lazy/have no time/am not smart enough to use a config file even though i planned to.

Update attachment
Kapios Kapios about 1 month ago
Actually this isn’t that good. Will probably change but after shipping.

Started making a config file setup using lilconfig. I don't know if this works but it's something!

Update attachment

Still doesn't look like much has changed, but I've moved the required elements from the builder pattern to the class constructor/function call (see: command name, option name)

Update attachment

Started making the SlashCommandBuilder! There's stuff still missing like localizations, but I think I'm about halfway done with the builder!

Update attachment

All of the individual option types have been implemented! As a bonus, I also learned the basics of semantic commit names and github projects! I'm gonna move on now to making the main command builder or tests idk yet!

Update attachment

I know on the outside it doesn't look like much has changed, but building options for commands is pretty much ready; I just need to implement each option type given by Discord. Then I can move to creating the actual command builder.

Update attachment

Managed to add a choices builder that's used for string, integer and number command options, so that the choices are the only available options as said in the Discord documentation

Update attachment

Progress! (i don't know what i'm doing)

Update attachment

Made a builder class for options, but so far the type inference doesn't really work. I might need to rethink this again.

Update attachment

I redid this another way where the type that converts Discord types into TS types (UsableOptionsType) doesn't take in an array of objects but rather a Record<string, DeliverableOptionData>, because TS couldn't infer types the previous way. But it works!

Update attachment

Type inference from an array works! The DeliverableOptionData interface isn't final of course as Discord also requires stuff like the description of an option, but I'm happy that I got this working!

Update attachment

I'm figuring out TS conditional types and it's very exciting and very confusing at the same time! (mostly confusing)

Update attachment

Set up the repository with 2 packages - the CLI and the Builder. Created the Builder class with a basic function for setting and validating the name of the command.

Update attachment