manage slash commands and originals commands in the same time

Hello, i have multiple commands which works fine with normal ?command. I have now slash commands and my execute function nows only have an interaction Object and not a message, args, Discord, Client... what is the best way to combine these two ?
8 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Hugo4774
Hugo47742y ago
14.3.0
Squid
Squid2y ago
You could make one function per command that accepts either messages or interactions and use hundreds of instanceof checks to see if you're dealing with interactions or messages, or you could just pick one of the systems and keep your bot consistent
Hugo4774
Hugo47742y ago
It makes me rewrite some functions for two different case ?
Squid
Squid2y ago
I might have misunderstood the question Do you want to use both message and slash commands (not recommended), or just slash commands?
Hugo4774
Hugo47742y ago
both of them
Squid
Squid2y ago
OK, then either you need to have one function per command type, or you need just one function that checks the type of the parameters passed into it
Hugo4774
Hugo47742y ago
okay yes