Closed ghost closed 3 years ago
Hey there!
An improved message handler has been somewhere on the to-do list, and adding a Command class and/or MessageHandler class is as well. The main reason that it is how it is right now is just because I was considerably worse at programming bots when I made it 2+ years ago. I ripped the code from my original bot Clutchbot (I won't link the source code because it's probably a mess, but it's on my Github somewhere). I'd rather not add the additional overhead that comes with Commando, considering the rest of the bot has already been built outside of that framework. However, adding a ratelimiter is a great idea for certain commands, and reducing the mess that is the bot.js
file has been a priority. In general, improving the file structure has been a goal over time. On branch v3 there's an events folder that imports client 'message' events, and some refactoring in general. That's still WIP, though.
Current Priorities when it comes to improving commands
Guild-configurable prefix management. There is a configurable prefix at the moment, but it's bot-wide. Having commands be configurable at a guild level is a planned feature.
Edit: Also, Gamebot hopefully will never have 80-100 commands. If it does, my Github has been hacked.
The commit https://github.com/zeroclutch/gamebot/commit/1584710d8671793e1dddc703a392950df23c2a7f resolves this issue. Since branch v3 is still in development, I'll leave the issue open until it's moved to master.
Sup man! It's me Jason from SCU , COEN major '24. Glad to talk to u on discord ! On the topic of your bot, I'm beyond shocked at the amount of your hard work and dedication!!!! 15K GUILDS!!!!!!!!!!!! my god.......... i'm hardly in 30 guilds myself.
I see that this bot is using a pretty basic command handler in discord.js. Discord.js supports more multifunctional command handlers. The one this bot is using is also shown at discordjs.guide. This bot is pretty cool in terms of being a recreational fun bot but the tiny problem is when you integrate such a command handler, it's a bit clunky and a couple of commands might stop working.
This is normally discouraged as the more advanced command handler you have the easier code becomes for you. If this is actually a bot which is going to become a bot with 80-100 commands you would need a better command handler. Thus, this will eliminate the need for the fs handlers and the long code for getting commands in your
bot.js
file ++ your current code for prefixes/messages in the message.js event.Currently your making an object which is getting exported. Now what if you had an object which was an instance of a class.
Here's how the
bot.js
file would look like for your case:Here's how your
ping.js
command for instance would look like , but Discord.js commando has premade ping, prefix, and help commands so it takes care of that :)Let me know your thoughts and I'll be down to make any further suggestions! Best on everything with midterms!