posts: add update to discord post

Signed-off-by: Naman Sood <mail@nsood.in>
This commit is contained in:
Naman Sood 2022-06-28 00:44:29 -05:00
parent 9209ad5783
commit d75da82e75

View file

@ -4,6 +4,8 @@ summary: Secrets that the documentation won't tell you (not sure why though).
time: 1642314274
---
**UPDATE (June 28, 2022):** Most of this article is now outdated. The Discord.js API has been updated and these steps _do not work_ any more, and they have provided a much nicer API (and one that's actually documented!) since. I don't think I'll write another article about how to fix this, but [here](https://github.com/tendstofortytwo/counter-bot/commit/5d39629082d59297418b5be23df5b90b1db16bf0) is a diff of me going from the contnts of this article to doing things "the right way".
So I was recently making a very simple [Discord bot](https://github.com/namansood/counter-bot) as a joke. Since I like JavaScript, I found a JavaScript library to help me out with this, [discord.js](https://discord.js.org), and got started.
As part of this, the bot had a slash command that was supposed to be accessible only to people with a certain role in the server. Now I imagine this situation comes up often (eg. only allow moderators to ban pepole, etc), so I was surprised that the documentation on this was a bit lacking. The main website is basically a reference page, and there's a [guide website](https://discordjs.guide) linked in the header. Using the guide, I was able to create the command that I wanted, minus the role thing.