Placeholder Image

字幕表 動画を再生する

  • what's going on?

  • Everybody And welcome to a discord pie tutorial, discord, pies used to make bots in discord.

  • So that's what we're gonna be working on and let's just go ahead and jump into it.

  • So first of all, as one does when they're trying to install things, they go to the documentation.

  • And lo and behold, this is not what you want.

  • So, uh, currently the discord pies kind of it's like almost into two main areas or two versions.

  • You know, it's kind of like the split with python.

  • You've got discord pie one point.

  • Oh, and you know and beyond.

  • And then you've got the 0.16 right now and you want At least I was after one point.

  • Oh, so I came here to the 1.0 docks, and it says, Hey, just installed this way.

  • Nope, That installs 0.16 So then I soon find myself on dish discord.

  • Ash rewrite from pi pi.

  • Great.

  • So I installed that, um but I hit some sort of weird air to there, and I couldn't quite figure it out.

  • So after some digging around there couldn't couldn't quite solve that problem.

  • So that I came to the discord Earth Scientists Court.

  • I came to the get hub and, um, I just cloned to get Hubbard, downloaded the zip and then installed it.

  • Okay, so that's what I'm just gonna recommend that you guys do.

  • So it's just this, uh, get hub.

  • Keep trying to call it discord.

  • I'll put a link in the description usually linked to the text based version of tutorial.

  • Either the text based version that's Arturo will be in there, which has all the links, or I'll put these links.

  • If I forget one of those two.

  • Just yell at me and I'll throw him in there otherwise yet?

  • So this is this the official discord pie, but under the rewrite tree.

  • So this is how you will get one point out.

  • So go ahead and cloner download.

  • Do a pip install dash Are the requirements, not text?

  • It's only two things.

  • It's a Iot.

  • Http and Web sockets.

  • I believe both of these will be install a ble via pip.

  • No problem on Lenox Windows, Mac, whatever.

  • If you have a problem with a Iot HDP on windows, don't forget unofficial windows by Neary's exists.

  • Um, and yet that should be everything.

  • Also note this is only apparently stable on 34 and 35 I've been using it on 36 No problem.

  • I will wager.

  • Or I guess I can't wager, but I can't remember if Webb sockets is like fixed on 3.7 yet, so that might cause trouble.

  • But feel free to try it on 37 if you want, I'm gonna be on 3.6 for now.

  • Eso once you have all that once you think you've got it like once you've installed the requirements, then it's just a python set up top I install.

  • Right?

  • So whenever you think you've done all those things, go ahead and run Python 36 do an import discord and then check the version discord dot version.

  • Make sure you're on the same version is me If you're not some of the things we're gonna be a little different if you're having any problems with the install you conjoined are discord.

  • Discord, not geese.

  • Last cent tax.

  • But yeah, should be pretty simple.

  • Just clone Pip installed.

  • Ashar, Promise a text by concept up I installed.

  • Done so once you have that now we're ready to start setting up the bought itself.

  • So the first thing that we need is to create an application because of bought needs an application.

  • Also, I'm kind of assuming you all have, like, a discord server that you want to use this in.

  • If you don't, you'll need to, like, make her own discord, server and stuff too.

  • So just make a discord account.

  • And then when you open up, you know, discord There should be like a little thing, huh?

  • I don't know if I could bring mine over or not.

  • Let's see such stream remote enabled.

  • So maybe it'll be safe anyway, Um, like, right here the little button.

  • Go ahead and click that you could make your own server.

  • So once you've done that, we're gonna head to the discord app dot com slash developer slash applications.

  • You probably won't have anything here.

  • I've got a couple already, but you'll click on creating application.

  • So we click on that.

  • We'll call this tutorial bought.

  • Ah, we don't need to know the client's secret, but we do want to know the client.

  • I d.

  • So go ahead and copy that.

  • Save that for a little later, and we'll hit save changes while I've got that copied.

  • I'm just gonna come over here, paste that in.

  • That's the I d pressure.

  • Right idea before I forget what that was.

  • Uh, then what we're gonna do is, uh, good about and we'll go add a bought.

  • Yes, do it awhile, but has appeared.

  • Okay, so now what we're gonna do is, uh, Tutorial bought is fine.

  • Uh, Then what we do need is the token.

  • So I'm gonna go ahead and click copy on the token, and I'm gonna come over here and I'm gonna paste it.

  • I don't plant.

  • I hope to remember toe delete this bought.

  • Ah, but anyways, please don't use the token if ever again.

  • Ah, public bought.

  • So whether or not everyone else can add the bought, that's fine.

  • We'll leave that and then coming on down here, all the permissions.

  • So, um, you know, depending on what you want your bought to be able to do, you might want to pick Thies.

  • This is not set in stone, though.

  • You can change it later.

  • So for now, mainly, I want to be able to definitely send messages, read messes, message history um I can't remember.

  • What manage message message is is I don't know if that's like the pot could delete messages.

  • Possibly that might be it.

  • Anyway, add reaction stuff like that, I don't know, but moat, mainly.

  • Right now, let's send messages and read message history.

  • The biggest one is read message message, history.

  • But if you wanna be able to interact with it, probably send messages whenever you know what that that'll give you a, um, permissions integer s so you can go ahead and copy that basically is gonna happen is gonna create a role specific to your bought.

  • So later you can go in and add or change permissions as you want, but I'm gonna go ahead and save that permissions thing to lips.

  • Okay?

  • So once we have that, it should be all saved tutorial.

  • But I think we're ready to go.

  • So the next thing we want to do is the following your l I'm just gonna copy it.

  • Come over here.

  • That was our permissions in This is the girl we're gonna use.

  • So this is just to authorize a specific client on your server and this would be the same thing.

  • Someone else might is if you wanted to see if they wanted to use your, uh, your body.

  • So first we have the permission integer so we just paste that in, and then the i d.

  • I'm gonna copy that, and then we paste that in right here, and now you're ready to invite the actual.

  • But now, where did I hear this?

  • Let me just pace that in real quick.

  • Okay?

  • Tutorial bought at the but your server tells you what the permissions will be.

  • Uh, looks good.

  • So let's go ahead.

  • Oh, wait.

  • We gotta pick a server.

  • Centex.

  • We'll do authorize.

  • I am not a robot.

  • Just trying to add one authorized.

  • Okay, so once we've got that authorized ready to actually write about.

  • So, um, I think I'm gonna close that, and we could just come right here.

  • I'm gonna leave this stuff up just in case I'm gonna need it in men in anyways, and let's actually start to write.

  • So, first of all, we're gonna import discord because we are making a discord.

  • But the next thing is client equals discord dot clients that just kind of initiates the client for us.

  • And then now It's kind of two main ways that you can use discord.

  • Pie one is with just straight object oriented programming.

  • You can kind of create your client object on do things there, or you can use rappers and functions and stuff.

  • And so I'm gonna use the wrappers.

  • So first of all, you could do at client dot event.

  • And basically, what this is is it's just ah, event deck curried or slash wrapper.

  • If, uh, if you don't know much about those, you can check out python programming dot net search for decorator.

  • You pull this over.

  • Whoops.

  • Maybe.

  • Yeah.

  • Uh, and you can go click on that Decorators python to Tora.

  • And you can learn a bunch about decorators if you wish.

  • So, uh, okay.

  • Lips.

  • Gosh.

  • Okay.

  • Got everything under control.

  • So that's gonna be our rapper here, so basically, it's anytime, you know, some some sort of event is about to occur.

  • What do we want to do?

  • So, first, we're going to a sink.

  • Define on.

  • Ready.

  • And this is basically just this'd just gonna be called one.

  • Yeah, one time when the bought is fully connected, basically to the actual server itself.

  • So we're gonna say here is just print will print in F string and we'll just say we have logged in as and then client dot User.

  • And that'll just output.

  • What?

  • You know who we've connected as so Then we could come down here and we can actually say client dot Run.

  • And then we want to run.

  • Based on this token, some copy this paste.

  • And we could just make sure everything's working up to this point.

  • So I'm just gonna run that real quick and see if it connects.

  • We've logged in as tutorial bought, and I think just for further testing, I'm gonna come down a testing stuff and, uh, edit that channel will go to permissions role tutorial lot.

  • So at him and then read messages, send messages.

  • And where's the message?

  • History.

  • This one always gets me, like, read messages.

  • And you really need to have read message history.

  • So whatever that's about.

  • Okay, So, uh, so there's tutorial, but they are actually already in here, so hopefully, um hopefully my other bought isn't going to get in the way.

  • Uh, anyway, um, so So the connection worked, were logged in.

  • Great.

  • So now what?

  • We want to do is maybe maybe actually, have handled for certain events that actually occur.

  • So we're going to say yet another at client dot event.

  • And this one will just say a sink, define on message, and then it gets past years, just any old message, and then we can print, and then this there's, like, all kind of stuff that come from the message.

  • You've got a message message dot channel.

  • You definitely want to know what's channel it was set in that way.

  • If you ever if you won't want to reply, you have to reply back to the you know, you're ideally you're gonna reply back to that same channel message channel.

  • Um And then then what I'm gonna do is just do this like channel.

  • Probably like these three things are four.

  • Rather, uh, then we'll do author.

  • And then there's, uh, author dot name.

  • So one of these will just be there like they're nicknamed the other one is the actual the actual real screen name with, like, the number on it and stuff and then message content for the actual message itself.

  • So that's just rerun that one more time, and then this one.

  • This should read from all channels, but just in case nobody says anything while it's running on.

  • Just say something in this chat.

  • So, for example, will do Hi there.

  • And so, as you can see in the testing stuff, channel Syntax number seven of says hi there, basically.

  • Okay, easy enough.

  • So now, um, not only can look at this point, we're just kind of reading things.

  • We're not actually doing anything.

  • So if you wanted, you could do stuff based on what people say.

  • So a lot of times people have, you know, certain commands.

  • So you might look for an exclamation mark and then some sort of command, like kick and then someone's user name, for example, or their nickname.

  • So you could do stuff like that.

  • Probably kick is not really useful, because you can do that already.

  • Pretty simply.

  • But anyways, just as an idea, um, you can you can use exclamation mark, but you could use anything you want.

  • But for example, one thing that we could do is something like this, like so he could say, Um, if, um if hi there in a message dot Content.

  • Um, I don't think I think we would actually be able to get away with this.

  • We'll test this real quick, but I can't remember if I have to convert that to a string or not.

  • I think it should be a string, but we'll see if Hi there in message dot content dot lower.

  • Let's just make sure handle both cases.

  • Um, what do we want to do?

  • Well, what we could say is we could have the body, like, reply back so we could await and then ah, message John Channel.

  • Don't send high like that.

  • Let's go ahead and run that again.

  • But fruit, Okay?

  • And then I could just say hi there again, and you can see here that the tutorial bought replied again.

  • But if I don't say hi there, and I just say, how's it going, tutorial, but doesn't say anything, right, Because we've got some really, really advanced logic there.

  • Okay, so, um, that's all for this tutorial.

  • Try to make that a short and quick as possible.

  • Uh, for me, I'm gonna have to remember to delete this token immediately.

  • Um, but that's really all I want to show here.

  • Like I said, there's so much here that you could do like you could do anything like the first bought I made.

  • I made it to change users nicknames like, So you can change people's like display name basically, and any time they try to change it back just immediately changed it back again.

  • So, um, I'm a really great discord host, by the way, during my discord, discord at Giza Centex.

  • Um, but there's just, like so much that you could have it automatically create emojis.

  • You could have it, you know, do reactions, stuff like that, play files you condone.

  • It can just do so much.

  • Um that even though I'm gonna create a bought with this, we're just gonna do so little What's available here?

  • I do Just wish their documentation like this is pretty full documentation in terms of what's available.

  • But their documentation for late getting started is like a painting them.

  • But to be honest with you, so anyways, uh, that's all for now.

  • Stay tuned for a more interesting, but I'd like to have the body search python programming dot net for, like, tutorial stuff like that among doing some other you know, typical tasks that I wind up doing a lot in discord, not pies.

  • So quick shoutout to my recent channel members got Max, Danish Kumar and Joe Fontana, Salvo, Martin Larson and Zechariah Vickers.

  • Thank you guys very much for your support.

  • I really enjoy my job and you guys make it possible.

  • So thanks again.

  • So, um, that's all for now.

  • Questions, comments, concerns.

  • Leave them below or join the discord and get your nick changed till next time.

what's going on?