Java Discord API(JDA) ep. 10 - EventWaiter

preview_player
Показать описание
Since we made the user info command last episode, I'll show you how to use a very important feature of the jda-utilities api, which is the EventWaiter object. This allows you to wait for an event to happen for a certain amount of time, along with other cool features that a normal event wouldn't allow.The code from this episode is below. #JavaDiscordBot #JDA

Stay Updated!! 👁
More Videos coming soon.
Leave a comment for any future video suggestions.
Рекомендации по теме
Комментарии
Автор

Thanks for the tutorial man! Made it hella easier for me to use an eventwaiter.

The only problem, as far as I can see, is that it doesn't wait for two Events.

So, for example, if you use $userinfo and provide a reaction for the user to cancel the command, the waiter has to wait for two different events: MessageReceived and ReactionAdded.

ReactionAdded cancels it, MessageReceived continues it.

xwarockx
Автор

First I'd like to say, thank you for these tutorials. Made rewriting my bot a lot easier. I'm having an issue with the EventWaiter however. 7:56 is the point where e wont give the getAuthor() method. For some odd reason it doesnt set it as a GuildMessageReceivedEvent type. The command is just a simple Clear command that waits for confirmation before clearning.

EclipseKnight
Автор

Maybe you could do a XP system next? Loving this series btw, you make the process very simple and easy to understand!

chayselofgren
Автор

Really loving this series!It will be awesome to create music part of the bot.When would you do another one?

flexime
Автор

problems with regards to EventWaiter, when I reach up to the lambda argument part, it says language level not supported, but when I change the language level to level 8, which supports lambda expressions, i can't do e -> there's an error.

aahanimation
Автор

While rewatching this video. I notice in your main class that you have set the bots online state, and the game its playing. But if you look at it, it never actually changes. Just something to look into "fixing"

chayselofgren
Автор

Thanks so much for this! JDA documentation had me at a loss. Quick question: How would you handle commands that require multiple responses while error checking? So far the most elegant way I can think of is to record which state of the command the user is in (database record with guild_id, user_id, current_state, responses), create a loop that listens until the final state is achieved or command is canceled, and then have private a method that handle responses based on what the current state is and records new response for next command to refer to if needed). This allows for looping back when bad input is given and obviously would make code logic far easier to read, but still is fairly complex overall. Anything I'm forgetting that would make my life a lot easier before implementing all of this?

scottcmiller
Автор

Thanks for the tutorial man. I'm just throwing this out there because I'm kinda obsessed with cyber security, it's not really a good idea to show the token in videos and leave it the same. It seems like you did for at least eight of the videos. I think the norm is to have it where the token is a string that's just read from a file. It keeps people from using your bot for whatever they want and it tracing back to you.

missingname
Автор

ummmm the discord invite link is invalid

jihosung
Автор

hey, how do I get my bot to send a message on a channel when it for example startup?

ozzeusz
Автор

hey, do you know of any other apis that i can use with maven for my bot?

fakeanimegirl
Автор

The Bot is online as long as the program is running. I want my Bot to be online forever. How do I do that?

CybercoderNaj
Автор

could you make a tutorial on how to set up a way to edit commands in discord similar to how it is with night bot? example !editcom !hello hello fellow earthlings

degoldenllama