Closed supercrafter100 closed 1 year ago
Though if we're strictly speaking, you technically don't even need a bot account if all you're doing is receiving and responding to interactions. Though the whole idea of this series is making a discord bot. So just ignore this comment 😅
@supercrafter100 I believe at some point in the series he will move on from slash commands and use the message intent, which will require a bot. But I agree that the Guild intent is unnecessary for the most part. (Although the video has been recorded, including the Guild intent, but it would be good to have the example correct.)
I have a rough version of the video edited, I'll take a look at what's in there. I can also add something on screen to clarify / correct or even record a short additional voiceover. I can share a clip / discuss in Discord.
I guess it depends on the existing explanation you did about intents. I'd say it's probably one of the most misunderstood concepts in the entire bot developing community. People either enable all intents or just none at all (and encounter issues because of it) because they don't have a clue what they actually do.
I believe at some point in the series he will move on from slash commands and use the message intent
I'm going to quickly quote this for some important context regarding that. The message intent became privileged meaning if the bot you're making is in more than 75 servers and needs to become verified, you require explicit permission to use this intent.
Discord really cares about the whole privacy deal now so if you want to become a verified bot that has this intent, you need to create a whole privacy policy, contacting method to get data removed, and they won't even give it unless you strictly require it etc. As a result of this whole thing I highly discourage using the message intent (thus listening for messages) unless you actually need it for your bot to function. Text based commands are very discouraged by discord and they won't grant you the intent if that's just the reason you want it.
(sorry, closed by accident!) For my class, I'm looking to demonstrate quirky, playful experiments with Discord bots. So listening to messages (and maybe chiming in or reacting to things) is something I am considering demonstrating, even if it's just for a non-verified bot for one server.
I'd love any suggestions for things I might show next! I'm thinking that maybe I would try to do a demo where you could play a short game (guess a number?) and begin that game with a slash command. What would be the best way to do this? Create a thread? Listen after the game as started for @
mentions of the bot? Use an embed and update it continuously?
Some things I am experimenting with maybe showing how to do next are in this branch if you are curious: https://github.com/Programming-from-A-to-Z/Discord-Bot-Examples/tree/more-demos
After looking at the more-demos
, I made a number guesser using slash commands (but it includes wierd js dynamics to communicate between different commands) (Code)
(This only works if a single game is being played at a time. This can be fixed by storing an array of game objects corresponding to each channel, in case used for a larger bot in multiple guilds)
You can always make little games as well using embeds / buttons / modals / select menus. There are plenty of input ways nowadays that don't require listening for messages. Additionally you could use the awaitMessageComponent or componentCollector methods to listen for them without requiring complicated additional event listeners and saving state.
Might I add to your randomwalk demo on that branch to defer the reply first. Image generating with canvas can be extremely slow so you cannot guarantee to reply within 2 seconds. Hence to defer it first so you don't get an unknown interaction error. In your current code it doesn't appear to be an issue yet but it's always better to include it.
I created a little rock paper scissors game using buttons (to showcase them) Gist can be found here
(gotta love that this issue just became a brainstorming thread)
That looks like a great stateless game example to show in the tutorial!
I'm just going to post this here because technically in the example bot the
Guilds
intent isn't even required. This intent just sends events related to guilds but the example code doesn't even require that at the moment. You can find a list of intents + the events they can receive on the official Discord Documentation that you can find here: https://discord.com/developers/docs/topics/gateway#gateway-intentsThough I currently assume the intent is there as an example that you should put them there.