Menu

My World Bible

maycross3's blog

blog post

Discord Bot with Python - Academic 5 - customized instructions
Alrighty men welcome back to a different. discord educational and iin this one i'm. going to be showing you ways to put in writing. customized instructions. now by a command what i mean is in. discord what you can do is you could have. a special character. and there are a few default ones if you. use the ahead minimize you will discover the. discord builtin commands. now you can essentially on top of those. builtin discord instructions you may tremendously. a lot make your own customized discord bot to. hearken to customized commands. now some famous ones that folks use. are the exclamation mark and as an instance. you could have a command called. exclamation facts to expose facts approximately your. server or the bot itself. one more one which i am going to just show you genuine. rapid earlier than you get into it's on the. new boston discord server if you utilize the. greater than image and there are a.
Couple distinct commands that you'll. use but in any case it's our custom one. wherein you are able to do anything like repute. and this tnb bot is attached to the new. boston blockchain. so it can display a few information about. to illustrate your blockchain address uh. your balance. um a few other things as well yet anyways. what i am attempting to say is so as to. create custom commands all you do is you. opt for a different man or woman even if it can. be surely anything that you want and. thiis just signifies to your bot of whats up. this little bit of text goes to be a. command after which you may write your. custom command and your command can. basically do anything that you really want. so very well. sounds brilliant let's go forward and get. began. so unlike before every time we have been. working with the discord client what we. are going to be utilizing is a command.
object so that is from. discord.ext. we will import commands. and then we are able to name this object. whatever that we want but we can name. it bot and this is equal to. instructions. and. the class is called bot. and. first thing we have to do whenever. we initialize this object is we have to. pass in a command prefix now what this. is is the extraordinary image we're going to. use to denote a command now returned like i. reported this can be anything that you really want. lots of people use exclamation marks. greater than symptoms ahead is the only. that discord makes use of by way of default so in this. educational what we'll be utilizing is. the exclamation mark. so. we are going to be writing instructions like. exclamation facts or exclamation punch. you know we want to name it now. unlike earlier than at the tip of these where. you had purchaser.run.

It's virtually the same thing apart from. we will do bot.run and this. takes the token as well and ii actually. have a brand new token let me replica that and. paste that in. okay so this is the fundamental structure. now allow me cross forward and begin by writing. an easy command and then i will communicate. by means of precisely what it is doing. so. we can actually name these instructions. anything that we need. so i'm going to make a command called. information that's going to be called anytime. the user models in exclamation mark info. and iin order to do that you simply write. async def same as earlier than we're just. making a operate. after which the name of the function is. going to be the call of the command. so. we're going to simply be calling this facts. and we'll be passing in. anything called ctx. so first off allow me leave a remark. here.
to reveal a sample of how to invoke the. command and that is just by typing. exclamation details that's what's going to. set off this bit of code right here. yet another thing that i desire to

Go Back

Comment

Blog Search

Comments

There are currently no blog comments.