No video

How To Host A Discord.py Bot On A VPS 24/7

  Рет қаралды 42,260

DevGuyAhnaf

DevGuyAhnaf

3 жыл бұрын

You have a bot written in Python & Discord.py, but you don't know how to host it? Well then, this video is for you.
In this video, I show you how you can host your Discord.py bot on any VPS running Ubuntu or Debian-based operating systems. I show you how you can SSH into it, transfer your bot's code to the VPS and how to keep it alive 24/7.
Note: You need to have a VPS already and know it's login credentials (e.g username, password, IP, etc).
Download Links
=============
PUTTY: www.putty.org/
FileZilla: filezilla-proj...
Socials
======
Discord Server: / discord
Website: ahnafzamil.com
If you enjoy my videos or find them helpful, please subscribe to the channel. It really helps me out a lot, and inspires me to make more content. Also leave a nice comment if you had a good day :)

Пікірлер: 88
@savyartist
@savyartist Жыл бұрын
I tried so many other tutorials, videos and written guide and none had properly worked until yours. And your happened to be the simplest way. Thank you Ahnaf!
@billiscool7647
@billiscool7647 2 жыл бұрын
Thank you so much! Couldn't figure out how to get a python script running on pm2, but thankfully I found this lifesaver!!!
@Ramix09
@Ramix09 2 жыл бұрын
Came looking for info about the SSH session, thanks for making this video!
@neon-cyber-monkey3
@neon-cyber-monkey3 Жыл бұрын
Thanks Ahnaf - Couldn't have done it without this video :)
@Carhill
@Carhill Жыл бұрын
I have been using Ubuntu for almost 3 months. I am very comfortable in DOS cli, used it since I was a kid in 90s. I have been using the terminal since day dot on Ubuntu. 6:23 - I'm sorry... it has.. auto-complete?! ARE YOU KIDDING ME?! Amazing video.
@devguyahnaf
@devguyahnaf Жыл бұрын
Lmao, thanks :D
@ItsQuirines
@ItsQuirines 3 жыл бұрын
Thank you for the very clear explanation! Very helpful!
@osnium
@osnium Жыл бұрын
Hella helpful, working around tmux limitations with this thank you!
@ydupc
@ydupc 3 ай бұрын
6:55 ls -ia does the same thing, you don't need ls -lart (ls -ia is far quicker too)
@iraqiroyale4483
@iraqiroyale4483 2 жыл бұрын
Thank you so much for such a great Explanation ❤
@boatyjra6126
@boatyjra6126 2 жыл бұрын
What a good tutorial, easy to follow and make it look easy for me!
@styrofoamcu
@styrofoamcu 7 ай бұрын
Does this work with any other VPS except Contabo?
@ydupc
@ydupc 3 ай бұрын
Also since you are root, you do not need to do sudo every time you enter a command you wish to run with elevated privileges
@abdenour3393
@abdenour3393 2 жыл бұрын
When i try to instal npm using : sudo apt install npm It says : E: Unable to correct problems , you have held broken packages.
@Fahad-sf6zf
@Fahad-sf6zf 2 жыл бұрын
Good explanation ,I had a big doubt about how it would work if I closed vps, cleared 🥰
@devguyahnaf
@devguyahnaf 2 жыл бұрын
Glad it helped
@marcusflorin7713
@marcusflorin7713 11 ай бұрын
you are a beautiful human, bless you, for you have saved me
@ChronicDiscord
@ChronicDiscord 7 ай бұрын
when i try put it as my folder it just says cd too many arguments
@emojikriszcapy
@emojikriszcapy 4 ай бұрын
Then, if i turn off my computer it's not working more?
@tsuyoiakio
@tsuyoiakio Жыл бұрын
Thank you.. this tutorial has helped me greatly!
@surmads2595
@surmads2595 6 ай бұрын
Great explanation love this video!
@poprostuizi
@poprostuizi 2 жыл бұрын
AND THAT IS WHAT I WANTED TO SEE !!
@pavlovmars9480
@pavlovmars9480 2 жыл бұрын
My bot still goes to "sleep" even after following the part to keep it running. The server says it's still running but on discord it shows it offline after about 1 minute
@richardlewis9272
@richardlewis9272 Жыл бұрын
Great video. Will you ever make a tutorial on this using docker?
@devguyahnaf
@devguyahnaf Жыл бұрын
Probably, not sure. It's trivial though
@vickyprayudha_
@vickyprayudha_ 2 ай бұрын
@@devguyahnaf not for me :D lol this video 3 years ago :( haha
@devguyahnaf
@devguyahnaf 2 ай бұрын
@@vickyprayudha_ Hey, I'm still around though. Just going through real life which is why no videos
@TT-fv3mk
@TT-fv3mk 2 жыл бұрын
FOR anyone who already has the files all in the server like me and already to go and want to start the bot withouht needing to keep the putty session on, skip to 9:15
@FInnnCh
@FInnnCh 7 ай бұрын
thank you bro🍻
@gunman684
@gunman684 Жыл бұрын
Hey mate, was wondering will all this work for my discord music bot? I'm about to rent out a vps and found this vid.
@TGASASSY
@TGASASSY 5 ай бұрын
Thanks! When I update my bot, do I stop the bot or can I just overwrite with another main code file?
@devguyahnaf
@devguyahnaf 5 ай бұрын
You have to stop it, then overwrite and run it again
@v3cto434
@v3cto434 Жыл бұрын
Useful bro❤
@GuiMVII
@GuiMVII 2 жыл бұрын
Great tutorial!
@FlyingFisherado34
@FlyingFisherado34 Жыл бұрын
when turning on putty again, how do I get to the screen that shows the memory used by the bot and its online status?
@devguyahnaf
@devguyahnaf Жыл бұрын
You run pm2 status command
@TheCodeHunter
@TheCodeHunter 3 жыл бұрын
thx I nob wiht vps so tis did big help tank you
@devguyahnaf
@devguyahnaf 3 жыл бұрын
Thank you, I understood what you meant 100%
@timo_b3
@timo_b3 2 жыл бұрын
awesome video, i just bought a vps so this helps a lot. is there no need for a ssh key?
@devguyahnaf
@devguyahnaf 2 жыл бұрын
Depends on your hosting service. Some VPS services use SSH keys, some use plain passwords. In terms of security, I would recommend SSH keys because even if someone knows your password, they can't log in without having the SSH key file. My VPS service used plain passwords, but I set up my own SSH keys so that others cannot log into my VPS
@timo_b3
@timo_b3 2 жыл бұрын
@@devguyahnaf ah alright thanks! is there a quick and easy way to set up my own ssh keys?
@devguyahnaf
@devguyahnaf 2 жыл бұрын
@@timo_b3 Yeah. DigitalOcean has great tutorials for these kinds of stuff. Check this one out: www.digitalocean.com/community/tutorials/how-to-create-ssh-keys-with-putty-to-connect-to-a-vps
@Peter-xo6hx
@Peter-xo6hx Жыл бұрын
@@timo_b3 you can use openssh and do ssh keygen
@odepleted
@odepleted Жыл бұрын
to keep it running 24/7 you can just open a new screen with 'screen', and then run your bot
@devguyahnaf
@devguyahnaf Жыл бұрын
Yean you can use screen, but I personally use PM2 or Docker
@partygoer257
@partygoer257 Жыл бұрын
Whenever I put my password in, it says that it is incorrect although I made sure it's the right password.
@bilalakbar9484
@bilalakbar9484 9 ай бұрын
same
@TheUnofficials
@TheUnofficials 3 жыл бұрын
My bot starts with command python -m bot, how to make it run in pm2?
@devguyahnaf
@devguyahnaf 2 жыл бұрын
-m bot is basically running the __main__.py file in the bot folder. So you could just do pm2 run bot/__main__.py --interpreter=python3
@thehangedman6327
@thehangedman6327 Жыл бұрын
ty so much!
@debadritoduttaedits
@debadritoduttaedits Жыл бұрын
thanks man
@redsunset7945
@redsunset7945 3 жыл бұрын
hey, i have a problem, sudo apt isn't recognized as a command, any ideas? thx and i subscribed, nice vid!
@devguyahnaf
@devguyahnaf 3 жыл бұрын
sudo apt is for the Linux VPS. Isn't your VPS running Ubuntu Linux or something? sudo should be a command that's on all linux distros. But apt is only on Ubuntu or Debian. If apt is the one not working, just use the package manager for the distro that you are using
@emantbr5866
@emantbr5866 Жыл бұрын
Good tutorial, is it possible to run multiple bots with pm2?
@devguyahnaf
@devguyahnaf Жыл бұрын
Of course. PM2 is just a process manager, it will manage all the processes you throw at it
@Peter-xo6hx
@Peter-xo6hx Жыл бұрын
will this work on a Raspberry pi 4 running Ubuntu server 22.04? And will it continue after i close the ssh connection?
@devguyahnaf
@devguyahnaf Жыл бұрын
If you use PM2, it should keep it running in the background. Also, an RPI 4 has enough resources to run a bot, only on a single or a few shards though
@pollo7889
@pollo7889 Жыл бұрын
@@devguyahnaf is a RPI 4 8GB good?
@Peter-xo6hx
@Peter-xo6hx Жыл бұрын
@@pollo7889 yeah, i'm using it and it runs really well
@pollo7889
@pollo7889 Жыл бұрын
@@Peter-xo6hx im using a Hetzner server 4GB ( AMD Epyc 3vCores) u think thats good?
@Peter-xo6hx
@Peter-xo6hx Жыл бұрын
@@pollo7889 if it's an epyc then yea, that is meant for servers, but the ram is a small amount so i suggest only using it in 1-3 servers
@chibuikeogodo5749
@chibuikeogodo5749 Жыл бұрын
Hi, please those this tutorial also apply to selenium bot?
@devguyahnaf
@devguyahnaf Жыл бұрын
Pretty sure yes. In the end, it's just running a python script 24/7 on a VPS
@b00walk3r
@b00walk3r 2 жыл бұрын
thank you bro
@tank2469
@tank2469 2 жыл бұрын
Thank you so much
@hamidniaziniazi3742
@hamidniaziniazi3742 Жыл бұрын
lets learn this with Docker
@Spider2B
@Spider2B 2 жыл бұрын
TY TY TY
@benzyytskripts1978
@benzyytskripts1978 2 жыл бұрын
Btw it also works with screen
@devguyahnaf
@devguyahnaf 2 жыл бұрын
Yes, I know. But Pm2 is easier to manage, so I used it
@benzyytskripts1978
@benzyytskripts1978 2 жыл бұрын
@@devguyahnaf Oki
@OfficialChrisBreezy
@OfficialChrisBreezy 3 жыл бұрын
Is it free does it work for node.js?
@devguyahnaf
@devguyahnaf 3 жыл бұрын
A VPS costs money. Getting the VPS is upto you, I just show you how to set the bot up AFTER you get your VPS
@ellienyan
@ellienyan Жыл бұрын
oracle cloud has always free resources
@sanke2205
@sanke2205 2 жыл бұрын
But a js bot?
@devguyahnaf
@devguyahnaf 2 жыл бұрын
The same way. Instead of using python to run the bot, you use nodejs to run it. You can keep it running with pm2
@Peter-xo6hx
@Peter-xo6hx Жыл бұрын
@@devguyahnaf also worked with hikari tysm, i watched like 5 tutorials and this is the only one that worked
@devguyahnaf
@devguyahnaf Жыл бұрын
@@Peter-xo6hx Ah yes, Hikari. Love that library ngl, it's devs are people I've known for a long time (who manage it's awesome community) and the lib is WAYY better than Dpy in my opinion. Sadly I ain't into bot dev anymore...
@Benjiss
@Benjiss Жыл бұрын
sudo prefix in root mode ?? haha
@devguyahnaf
@devguyahnaf Жыл бұрын
it is called braindead mode
@unknowngamer1936
@unknowngamer1936 3 жыл бұрын
What is vps 😅
@goatedthagawd
@goatedthagawd 3 жыл бұрын
virtual private server
@thesilentfox7194
@thesilentfox7194 Жыл бұрын
ur amazing , thanks
@devguyahnaf
@devguyahnaf Жыл бұрын
Happy to help!
I tried Discord Bot Makers...
14:19
FaceDev
Рет қаралды 117 М.
Raspberry Pi versus AWS // How to host your website on the RPi4
8:39
Harley Quinn's revenge plan!!!#Harley Quinn #joker
00:59
Harley Quinn with the Joker
Рет қаралды 7 МЛН
If Barbie came to life! 💝
00:37
Meow-some! Reacts
Рет қаралды 58 МЛН
OMG what happened??😳 filaretiki family✨ #social
01:00
Filaretiki
Рет қаралды 11 МЛН
IQ Level: 10000
00:10
Younes Zarou
Рет қаралды 13 МЛН
What happens if you connect Windows XP to the Internet in 2024?
20:35
I Built a Transparent Boomerang (it's lethal)
13:10
Mike Shake
Рет қаралды 3,6 МЛН
When a CIA Hacker Goes Rogue
23:09
TyFrom99
Рет қаралды 1,9 МЛН
Solving a REAL investigation using OSINT
19:03
Gary Ruddell
Рет қаралды 156 М.
How to Host a Discord Bot 24/7 on Digital Ocean ($100 in free credit)
11:34
Using My OLD HACKS!
14:29
ebola man
Рет қаралды 316 М.
If I had to host on a single VPS, this is how I'd do it
9:35
Web Dev Cody
Рет қаралды 16 М.
Minecraft Cheaters trolled by fake cheat software
12:20
ScriptKid
Рет қаралды 2,9 МЛН
Harley Quinn's revenge plan!!!#Harley Quinn #joker
00:59
Harley Quinn with the Joker
Рет қаралды 7 МЛН