Doc
SIASapphire - Imagine a framework
•Created by Doc on 3/17/2024 in #sapphire-support
Issue with path aliases not working when using imports (TypeScript)
Not sure what exactly is going on, normally I'm only using TS paths like
"@lib/*": ["src/lib/*"]
but I wanted to start implementing something similar in my bot to make it so I don't have a bunch of ../../../
and whatnot when I'm having to import certain types/classes/etc..
Never had any issues with this while using NextJS, but I assume this has to be an issue with my tsconfig/package.json files. This is the error I'm getting at the moment:
Currently this is my tsconfig.json:
If needed I can share my package.json as well. Just not sure what I'm what I'm doing wrong here... This is a real pain because I just started using eslint more to improve my code and so I'm doing a lot of refactoring and.. yeah. Considering my codebase it's a bit overwhelming. I'd like to figure out how to get these ts paths working though if possible.13 replies
SIASapphire - Imagine a framework
•Created by Doc on 12/29/2023 in #sapphire-support
Best way to use Preconditions to determine which commands show up in a /help command?
I'm looking to make a dynamic help command that'll show a user all commands available to them, but I'm really not sure how to go about checking to make sure a command is able to be run by the user before adding it to the embed. Currently the core logic for the command looks like so:
I'm familiar with preconditions a bit, but unsure of how sapphire's framework actually does the checking behind the scenes to see if a user passes precondition checks, I was thinking maybe that could be a way I could test each command to see if the author of the message/user of the interaction (for chatInputRun) is able to run the command.
I'm also aware I'll probably have to do some further filtering rather than just getting all the commands from the stores (since I believe there will be duplicate entries for commands that have messageRun/chatInputRun/contextMenuRun methods) but right now I'm focused on just figuring out a good way of figuring out whether or not to include a command based on the user using the help command first. Any ideas?
5 replies
SIASapphire - Imagine a framework
•Created by Doc on 11/28/2023 in #sapphire-support
Is there a way to use Sapphire to reset previously registered slash commands?
So, I've got a bot I'm working on that uses Sapphire and recently, just as an example, I generated a unban.ts slash command while I had npm run:watch running (so it registered the command with the bot). I then moved the unban.ts file to the Moderation folder I created for commands like this one, and now I need the previous unban command to become unregistered. Is there any way I could have Sapphire automatically unregister slash commands created like this one upon finding that the files for the commands no longer exist? Or am I gonna have to do it the old fashioned way using discord.js?
23 replies