Host a Python Discord Bot on AWS Lambda (Free and Easy)

  Рет қаралды 15,626

pixegami

pixegami

Күн бұрын

Пікірлер: 41
@HashtagTiluda
@HashtagTiluda Жыл бұрын
All the videos you publish are real gems. Not sure if you take requests but can you create a video on a full stack app creating with FastAPI/Supabase backend and NextJS frontend which would cover authentication, stripe billing, etc.
@pixegami
@pixegami Жыл бұрын
Thank you! I'll add it to my list of ideas which I use as a starting point for videos. Bigger projects usually take a lot longer so I don't know how quickly I will get around to it. Thanks for the suggestion!
@HashtagTiluda
@HashtagTiluda Жыл бұрын
@@pixegami It's best you do a modular playlist. That way, if let's say someone is not using Supabase, they can still watch the other videos on the playlist.
@codingwithpar
@codingwithpar 11 ай бұрын
@@pixegami i need your help what did you pick for the setup
@codingwithpar
@codingwithpar 11 ай бұрын
@@pixegami and what are the commands you use for the AWS lambda
@ProGamingRV
@ProGamingRV Ай бұрын
But this wouldn't work for events that expect a response, right? like modifying a message in a pool. Because it doesn't maintain the connection. And how do you keep bot from falling when the lamba goes cold?
@THEREAL8030
@THEREAL8030 Ай бұрын
hi there i am facing this error : C:\Users\Lenovo\Downloads\discord-bot-lambda-main> REGISTER REGISTER_COMMANDS.PY 'REGISTER' is not recognized as an internal or external command, operable program or batch file. please try help
@volodymyrtruba7016
@volodymyrtruba7016 6 ай бұрын
Fantastic video! However, how do we handle logic that takes more than 3 seconds to execute, considering Discord messages have a 3-second limit?
@SiebeTolsma-wy1pd
@SiebeTolsma-wy1pd 6 ай бұрын
Second this! Running into this issue as well :)
@SiebeTolsma-wy1pd
@SiebeTolsma-wy1pd 5 ай бұрын
Did you figure it out already?
@volodymyrtruba7016
@volodymyrtruba7016 5 ай бұрын
Hi , I’ve reworked the bot, and deployed it on ec2, I am using discord.pu library, and t2.micro instance( which is free-tier eligible).
@pixegami
@pixegami 5 ай бұрын
Hmm, what do you mean the messages have a 3-second time-out? Do you mean Lambda's default time-out? If so, that can be adjusted up to 15 minutes I believe.
@menisadi
@menisadi 8 ай бұрын
Please please make a video about making of a Telegram bot! I know that there are guides out there but your videos are just so clear that I think they add value even on topics which where already covered by others
@pixegami
@pixegami 7 ай бұрын
That's a great idea :) Thanks for the suggestion.
@innerpeacetheskullcollector
@innerpeacetheskullcollector Ай бұрын
can i host javascript v14 bot with this?
@Pie_Master.
@Pie_Master. 7 ай бұрын
I love how much easier it is to understand how to do all of this, thank you!
@pixegami
@pixegami 7 ай бұрын
Glad to hear it. Thanks!
@bigbadbroadcast
@bigbadbroadcast 8 ай бұрын
So I got all the way to the end, with deployment being successful and I got the link. However, when I check to see, my bot its still offline and also there is no function in aws. Does deploying create a function automatically? Follow up question, when you created your bot it was listed as online, while when I made mine it is automatically offline. What did you do here to get it online? EDIT alright I followed the steps again and got it working, but I still don't see the lambda function in AWS, and I don't know how to debug any other way. EDIT AGAIN Found it in AWS, I was looking at the wrong region, still can't find a console to do debugging, was wondering exactly how I would test this locally
@pixegami
@pixegami 7 ай бұрын
Awesome! Glad you answered some of your own questions. In Lambda, you can see the logs in the "Monitoring Tab". It should have a link to the logs for Lambda invocations in the last X (I think 3?) hours. Read more here: docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs.html I haven't looked too deeply into how to test this locally. I guess I'd want unit tests to actually just test the function logic itself, and maybe I'd develop a script to upload it quickly to a copy (e.g. BETA) of the function for integration testing. A lot of it will depend on what hooks/endpoint options Discord offers you to test the integrations as well.
@4cat.1dog
@4cat.1dog Жыл бұрын
Thank you for the good video. If I want to use the selenium library, how can I add a layer?
@pixegami
@pixegami Жыл бұрын
You should be able to pip install selenium into the Docker build container too by putting it into the requirements txt. Or if you just wanna just run the whole thing in a Docker, then check out this video: kzbin.info/www/bejne/rZPWk4ucoNtnbaM
@Sn4red
@Sn4red 6 ай бұрын
Great video! Regarding performance, e.g a decent amount of users using a lot of commands simultaneously, does AWS Lambda take care of that?
@pixegami
@pixegami 6 ай бұрын
Yup! That's actually one of the big selling points of Lambda (and serverless). If a new request comes in, but your all Lambda instances are busy, Lambda will start a new instance. You can configure the "max" number of concurrent instances as well (I think by default it is 10).
@BrunoAtLoka
@BrunoAtLoka 8 ай бұрын
This is absolute gold! Really well presented, step by step!! New subscriber 💪 I wonder if you could do an extension of this example where the bot reacts to events that happen on the Discord server like a new user arriving at the server (from an invite link) to do something tricky - check if the email they registered their account on Discord matches the domain that I, the Discord bot owner, will define (it's actually to set a Role for users that belong to my company) 🤔
@pixegami
@pixegami 7 ай бұрын
Thank you! In theory I think it should be possible, we would just have to change the event that triggers the Lambda to be the one where new users join (I'm assuming Discord's API makes it available), but I haven't had a chance to take a closer look into it yet.
@parYTG
@parYTG 11 ай бұрын
I need help with what commands did you use for the command prompt? At 6:38
@Beltramstein
@Beltramstein 9 ай бұрын
Yeah me too. He could answer..
@Beltramstein
@Beltramstein 9 ай бұрын
A friend of mine helped me, change the line 17 on register_commands.py to: for command in commands["commands"]: this should work
@Beltramstein
@Beltramstein 9 ай бұрын
I`m on Windows 11 23H2 OS build 22635.2915, with Python 3.12 and VSC 1.85.1
@saphirsatillo2357
@saphirsatillo2357 11 ай бұрын
Thanks for the video. I have a question though, how do you unregister a command? I'm getting a 405 error when I try to request delete.
@pixegami
@pixegami 11 ай бұрын
I should have put that in the video: discord.com/developers/docs/interactions/application-commands#updating-and-deleting-a-command The endpoint is different, and you'll also need the command ID (which you can get several ways). I got the command ID in the Discord UI directly by right-clicking on the command tooltip after I type it in (e.g. `/hello`).
@sesameydmclips
@sesameydmclips 7 ай бұрын
Thanks for the tutorial! I wanted to try using Lambda instead of hosting on EC2 this time, and this worked well
@pixegami
@pixegami 7 ай бұрын
Awesome! Glad to hear it :)
@gamersgame43
@gamersgame43 4 ай бұрын
Hi just asking is this method better hosting than EC2 method
@bleakaddict
@bleakaddict 3 ай бұрын
Just wanna know if its a serverless hosting
@Rohitnansen
@Rohitnansen 11 ай бұрын
When I attempt to create a bot in discord, it shows as offline instead of online in my server as it is for you. Anyone know the approach to turn it on?
@pixegami
@pixegami 10 ай бұрын
Do you see any error or status messages in the logs?
@sesameydmclips
@sesameydmclips 7 ай бұрын
I found that interesting as well, since Lambda is only called when needed, so mine appears offline too despite no error in the cloudwatch logs. In contrast, when I host a bot locally, the bot appears online.
@mozphat9308
@mozphat9308 8 ай бұрын
It took me way too many hours to FINALLY get commands to work. The registration part is not obvious. Thank you!
@pixegami
@pixegami 7 ай бұрын
Yeah, that took me ages too. Glad it was helpful!
Pydantic Tutorial • Solving Python's Biggest Problem
11:07
pixegami
Рет қаралды 274 М.
How to Run a Python Docker Image on AWS Lambda
13:08
pixegami
Рет қаралды 33 М.
Electric Flying Bird with Hanging Wire Automatic for Ceiling Parrot
00:15
The day of the sea 😂 #shorts by Leisi Crazy
00:22
Leisi Crazy
Рет қаралды 2,1 МЛН
ПРИКОЛЫ НАД БРАТОМ #shorts
00:23
Паша Осадчий
Рет қаралды 6 МЛН
когда не обедаешь в школе // EVA mash
00:57
EVA mash
Рет қаралды 3,6 МЛН
How I deploy serverless containers for free
6:33
Beyond Fireship
Рет қаралды 509 М.
Host Your Discord Bot For Free In 2024!
4:16
Max Codez
Рет қаралды 7 М.
Cool Tools I’ve Been Using Lately
23:11
Theo - t3․gg
Рет қаралды 324 М.
How AWS is Making It Easier To Convert to IaC/CDK
21:32
Be A Better Dev
Рет қаралды 8 М.
How principled coders outperform the competition
11:11
Coderized
Рет қаралды 1,7 МЛН
How to host a Nodejs Discord bot on AWS Lambda (free-tier)
6:54
[2023] - How to host your Discord Bot 24/7 for FREE (Discloud)!
8:01
Deploy FastAPI on AWS Lambda ⚡ Serverless hosting!
22:24
pixegami
Рет қаралды 39 М.
How to Host your Discord Bot 24/7 🕠
5:38
Under Ctrl
Рет қаралды 34 М.
Electric Flying Bird with Hanging Wire Automatic for Ceiling Parrot
00:15