Java Discord Bot Academic | Spring | Javacord | #1 Setup and Commands<br/>hey and welcome to this java discord. bot tutorial sequence utilizing spring. in this series we will be dealing with. the stairs required to create a discord. bot. using spring and the java chord. framework first things first you'll want. to download the java eleven jdk. i'll be using amazon carreta all hyperlinks. will be in the description under. go to aws eleven kareto download and discover. your platform. i'll be utilizing windows 10 and the x64. structure. subsequent we'll need an ide to do our coding. in for my part i exploit intellij yet you could. use eclipse or any other identification. of your selection we'll also want to. download maven which is a strong. task leadership. device which can handle building our. project and all the dependencies that we. will require. visit maven download and uncover the binary. equivalent to your platform. finally and this is an optional step but.<br/>in my opinion very required. will be to create a new git repository. to use as edition handle and a backup. in order that we don't lose. all of our labor you can use github. or bitbucket or the other git compatible. repositories. i will be using github and all code. written will be accessible on my github. as a public repository. and down in the description we'll visit. github. sign up click the plus button in the end. correct. create a brand new repository. we will deliver our repository a name discord. bot. we will visit public you can choose. personal repository if you do not need. other folks to have access on your code. click on create we will now clone this. repository in a native workspace. replica path we will go to our machine. and git clone and handle v to enter. now that we're in general hooked up let's open. intellij. and create a new task to put our.<br/>Discord bot in we will be using. spring unfortunately the neighborhood. version of intellij doesn't aid. spring natively. to be able to use a thirdparty plugin. known as spring assistant. why will we use spring spring is a. strong framework that reduces plenty of. the boilerplate code and decreases. software progress time and lets us. get caught in quicker. spring enables very loosely coupled. programming utilizing dependency injection. and this allows us to switch out extraordinary. modules according to our desire. it additionally manages the lifestyles cycle of. program gadgets for us which means we. needn't worry approximately that so much. in short it facilitates us to rise up and. walking faster. once it truly is downloaded we are able to create a. new project. visit task create new task select. spring assistant. hit next deliver our project a reputation. accordingly discord bot a quick.<br/><a href=""></a> for discord. let's select the spring equipment dev equipment. and configuration as our developer equipment. update the task call if you cloned. your project from github we will also. want to update a assignment course right here to. that of the cloned. folder and at last click finish. now that we have got our spring task set. up we need to ensure that we will use the. java wire api. within our software so let's upload this. as a dependency into our pom.xml. and permit maven to manage and import. this. we at the moment are able to start coding. it's our discord program that. will run on startup. so let's enforce the production of the. discord api in right here in order that plenty on. startup. we will annotate this with at bean this. lets spring know that it will deal with and. instantiate this item. we also will annotate with at. configuration residences to let spring.<br/>know to apply those particular houses. when it configures a beam of this. discord api. we will create a method public discord api. now let's build our api object java wire . has a method for creating a. discord api builder which we will use. right here. first we should want to set our token that. would be used with this bot. the token is effectively the bot's. password and so we will want to keep. this data. secure as this is crucial data we. do not need to hard code this. so we are able to retrieve this from the. environmental variables i will show you. how to save lots of the environmental variables. later. yet for now we are able to imagine that this has. already been stored. subsequent we'll want to ensure that the bot. is logged into and joined into the. server. the next move is to retrieve the token. from the environment. and as such we will want to retrieve the.<br/><iframe src="" width="560" height="315" frameborder="0" allowfullscreen></iframe><br/>Carrier that handles surroundings. interactions. as we are utilizing spring we do not need to. manually create and configure this. as it is already configured for us when. we do at. car wired. now we can use this environment provider. to retrieve a estate of kind string. that we are going to later call token. let's now build the application and the. api. and start it but before we run this. application. we want to mounted a server for our. discord bot to run on. and to provide a user for this bot so. let's move directly to discord to create one now. now we will prefer to go online to discord. click on the plus button at the left hand. facet. and click on create server we may give our. server our call. customize it notwithstanding we want for now we. won't trouble with this. and now the server's created we want to. add a bot to this. so let's go to developers.<br/>functions as always all links will be. in the description. we will click create new program in. the top right nook. supply it a name awesome discord bot. we now desire to tell our program that. this is a bot so we are going to go to bot. click supply life to bot also in the. good right nook and now our bot is. effectively created. take into consideration this web page as this comprises. the token that we are going to later want to use. for our bot to start it. for now notwithstanding we just need to supply our. bot a few authorization. and to give it access to our server. we will desire to present it the scope. bot and duplicate the url generated. down lower than paste this into the web. browser. and now add it to the server of your. choosing as you can now see. the bot has been further to our server. unluckily it isn't presently active. to unravel this we are going to want to return to.<br/>The bot web page in which we noticed our token. click on to disclose the token reproduction it. and now we'll desire to reserve it as an. environmental variable to run. with our application we are going to desire to move. back to intellij. upload configuration click on the plus button. in the top left corner and click. new program we'll want to use the. main class that we're currently using. for our leading application. this one is com.instance.discord. application. and now set our surroundings variable. token equals. and copy your token right here. we are going to want to click follow and ok we're. now able to run our bot. the green triangle to run our. application wait some seconds. and when it's up we must always be able to. see that our bot is now. stay and on-line in our discord server. regrettably arbonne is not doing. much at this moment. so let's give it a command that it can.<br/>take heed to and go back something. firstly we want to make our discord. bot listen to a message so let's upload a. message create. listener to our discord api. while the spot gets an event and if. the message. content is the same as dot ping. then we are going to want to get the same channel. as the event that became received. and reply with a message pong. now let's rerun our software and spot. what occurs now. now that our bot is listening to dot. ping. it may respond with pong. now let's have a look at if it listens to the other. instructions it shouldn't. now that we've got a operating discord bot. that aactively listens to a given message. and actively responds to it. exquisite job in the next part of the. academic sequence i will move over growing. listeners and dealing with activities as. well as some other exciting stuff that we will. do with this bot. in case you enjoyed the video please depart a.<br/>

This user hasn't created any releases yet. Find more releases from other users: