Create a Reddit Bot using Repl.it to host for free! Beginner Friendly.
HTML-код
- Опубликовано: 28 фев 2021
- Repl.it is an amazing tool but can be intimidating. Today in this beginner friendly tutorial I will show you how to create and host a reddit bot on repl.it. You won't need to do any downloads or install any software on your PC. In just 30 minutes you will have a working project running 24/7 in the cloud!
If you don't care about Reddit try the tutorial anyway we show how to use repl.it database as well as create a webserver. This tutorial should be able to help you!
repl.it/@JacobLower4/OfficeBot
github.com/ClarityCoders/Redd...
Want to chat with me and other programmers join our discord!
/ discord
#python #replit #redditbot
Thanks to Poonam Agrawal for creating the ukulele cover featured in this video. You can check out her full cover of the song Titanium here: • Video .
Want to help support the channel?
www.buymeacoffee.com/clarityc... - Наука
REPLIT Changed .env file!!! Easy fix.
1. Click on Lock icon on left hand side of window.
2. Add key-value pairs using this GUI instead. Name them same as I do in video!
3. Code should work the same!
How it is not working
Replit mentions that 'the new UI is slowly rolling out to users' so .env is still in use
I'm I doing this right?
import praw
import os
my_secret = os.environ['client_id']
my_secret = os.environ['client_secret']
my_secret = os.environ['username']
my_secret = os.environ['password']
I guess Im pretty off topic but does anybody know a good website to watch newly released series online?
@Evan Charles I watch on FlixZone. Just search on google for it =)
Literally what I was looking for, very well presented thanks very much!
Glad it helped! Thanks for watching I really appreciate it.
I think I finally found what I was looking for! Thank you!
My man! I hope so let us know if you have any questions.
Wow, this is such an amazing tutorial. Thanks!
Honestly after tough days these comments mean a lot thank you.
@@ClarityCoders It seems RUclips removed my comment so I am just asking this again since I have two questions. How would one monitor multiple subreddit streams and how would one be able to comment a large wall of text, like a guide, with a lot of newlines/empylines. Right now I get the error praw.exceptions.RedditAPIException: NO_TEXT: 'we need something here' on field 'text', when trying to comment larger amounts of text.
I”m new to programming and I love those bot making videos.
I hope you can make more videos on making bots and automation as well as discuss bot ideas where we can make them etc
❤️❤️❤️❤️👍
More will be coming for sure stay tuned!
Ah what a timing, I badly wanted to learn praw, thanks Man :)
Glad I could help! Any questions let me know.
excellent guide, thanks
Good video. Very clear and straightforward. I have a question, I'm planning to use Selenium and a Firefox web driver for a project in Python, does the Replit console installs the driver for me too or I have to add or install it by myself?
Good question I would have to look into that on the selenium side. I believe you can run it headless without the drivers but I could be wrong.
@ClarityCoders can you tell me how to tweak the code so that it responds to all the key phrases posted in the last 12 hours so that I can turn the bot on every 12 hours to do its daily posting? This would be easier for me than having it running 24-7
Any help to make it random responses to phrases? I watched your discord video but for someone not well rounded, I couldnt make a connection.
Would you happen to know how to do formatting on the replies so that I could have paragraph breaks? i tried putting '
' within the reply and the reddit comment the bot makes just includes "
" and not the line break. Thank you!! this video was awesome
What should I write to select several subreddits rather than just one or r/all ?
i updated the csv file but it still makes same comments! any way to fix this
Quick question: How would I have it monitor and reply to posts instead of comments?
Thanks man appreciate the hekp
Any time!
How would I get the bot to ignore itself?
It's picking up the trigger word in the response and stuck in a reply loop with itself
one small issue, for some weird reason the bot will try to reply 3 times, then the rate limit starts working but not before i get rate limited by reddit itself. Not sure how to fix this.
I can't get it to post, not sure where I've gone wrong, copied your files from Github and made some changes to the .env file and also the main script so it can occur on a 1-minute basis rather than daily basis but no idea where it's gone wrong.
Do you get any errors? Can you join our discord and we might be able to help! Can you get it to stream in comments?
is it possible in any way to make a webhook reddit bot?
Can you also make a Reddit auto meme bot so it posts memes to subreddits?
That's a good idea!
Won't the bot stop if i close the browser or close my system?
Hey @claritycoders . I created a reddit bot and it was all working fine and suddently it started showing a default_name error. even though everything seems to fine, How to fix this?
Not totally sure if you jump in discord and send code and error we can help. Make sure not to send your password!
I keep getting an "invalid grant" error. After some googling it looks like that usually means bad credentials, but I've triple checked all of them and they're correct. Some other results suggest it may be a multi-factor authentication problem, but that account has MFA disabled. What else can be done to fix that?
Turns out I needed a better app name, I had one that was too generic and Reddit rejected it.
There's a problem, when i try to create the .env file it says that i can create environment variables from the environment variables sidebar. What should i do?
look at the pinned comment
I have a ques, if i want different replies to the same input (say, if someone says "happy" i want the bot to say 1 of the 5 qoutes i set up randomly) can I create duplicate csv's? (I mean in the excel sheet can i have more than one input to be the same
(E.g.Happy:- don't be happy
Happy:- Happiness 😊)
I really don't want to store my password in plaintext. Is there a better way?
I'm somewhat lost, what do i need to put in the new .env file?
I click on the lock and it wants some key and a value, what should i paste there?
Key is on the left side of the equal sign in my .env file the value is on the right. So for example client_secret for a key and the value should be the value for client_secret. Sorry for confusion they changed after I released the video.
How would I do this but make the Bot log and store points based on interaction??
Great question join our discord and I'm sure someone could help you out.
what do i have to change if i want the repl.it to run once every hour?
Well right now its running constantly streaming in comments. You could have it check last 1000 comments ( praw limit ) try to post then sleep for an hour. Then repeat.
check out a package called 'node-chron'
What happens if there are no comments on the post? How does one post a comment if there are no comments to begin with?
You could write something that comments based on the title of the post? possibilities are endless.
@@ClarityCoders I tried that but no luck, it only loops back to printing the title of the post
Can I do this on vscode?
Of course!
You deserve more and more likes and views? I'm shocked
Thanks means a lot! As long as I get a few views I'll keep making them.
Repl.it disabled .env files, what should I do
REPLIT Changed .env file!!! Easy fix.
1. Click on Lock icon on left hand side of window.
2. Add key-value pairs using this GUI instead. Name them same as I do in video!
3. Code should work the same!
How can I create env file
On replit you would have to check there docs. In general I use virtualenv. Just pip install virtualenv then use virtualenv env
I'm going to come back to this because I don't have time yet lol.
I'll be waiting 😉
@@ClarityCoders I did the code and was like why no comments but I was doing a subreddit that wasn't as popular lol
Actually it might be wrong because for the client secret part it says invalid syntax
I fixed that by rewriting it but now I have module object is not callable error.
Can you make a discord-to-Reddit bot?
Sure. I have one that is the opposite think of what you mean that runs on my discord. It posts popular things from Reddit to our Discord.
@@ClarityCoders Cool
@@ClarityCoders It would be great for growing small subreddits
@@ClarityCoders ummm.. where can I find it? Also.. a discord to reddit would be cool... Jus like redditcord
.env doesn't work
Plz make an updated version
I may make a few more. what would you like to see updated?
@@ClarityCoders we cant use .env files . You should make a new tutorial on how to create a reddit bot using Repl.it
check my comment on it! it's really easy none of the code changes. I will look into it though!
@@ClarityCoders wdym “on it”.... like in the replit ?
@@ZyloGG REPLIT Changed .env file!!! Easy fix.
1. Click on Lock icon on left hand side of window.
2. Add key-value pairs using this GUI instead. Name them same as I do in video!
3. Code should work the same!
my bot goes offline after 1 hr ,even i have hacker plan and always on
Hit up their support it's pretty good that shouldn't happen.
16:27
So uh I think I did something wrong but I'm not sure what
I added 1 key value pair per line of code in your env file and I named the keys random names
I did not change anything else about the code
the problem is that when I try to run it, it presents me with an error message where all I can decipher is "client_id missing"
don't give them random names! the names have to be exactly same as mine like "client_id" the value being your client I'd instead of mine.
@@ClarityCoders ohhhhhhhhhh
u/have_a_nice_day_bot
Good bot.
How do I make him comment more frequently?
does yours work?
7:26 bizim herif koyun kırpan'ı böyle yapmış demek.
Looks like creating env files is now depricated in repl. - Was following your video and the only way I'm able to get this to work is by declaring the auth credentials statically. However, this is not ideal because then it makes my info public.
I've tried doing it using the env vars in repl like this:
import os
import praw
reddit = praw.Reddit(client_id=os.getenv("client_id"),
client_secret=os.getenv("client_secret"),
password=os.getenv("password"),
user_agent="testscript by u/testbot",
username=os.getenv("username"))
print(reddit.user.me())
But I keep getting an error. - Any idea what I'm doing wrong? I'm pretty new to Python and just stuck on this part.
Thanks in advance!
can you show us how to create an upvote bot
So a bot that up votes a certain persons post every time?
@@ClarityCoders yes, more than once though, something that pushes a post to the top of a subreddit
That's going to have issues that is a little to hacky and out of my area a bit. Reddit will detect this manipulation if you use the same IP address.
POV: this bot is not for discord
Nope it's for reddit! I have one for discord though using replit. ruclips.net/video/wjQ9Nin21d8/видео.html
Hey Man just want you to know that repl.it disabled .env file for good
thanks for heads up!
@@ClarityCoders No prob ^_^
I keep getting this error:
Traceback (most recent call last):
File "main.py", line 5, in
reddit = praw.Reddit(
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/praw/reddit.py", line 249, in __init__
raise MissingRequiredAttributeException(
praw.exceptions.MissingRequiredAttributeException: Required configuration setting 'client_id' missing.
This setting can be provided in a praw.ini file, as a keyword argument to the `Reddit` class constructor, or as an environment variable.
If it has something to do with the lock/environment variable, I've seen every response you've made about how to enter this in, and none of them actually explain what to put where and how to format it so it works. Can you please explain this in just a little more detail?
Have the same problem, have you found any solutions yet?
you code is missing the client_id when you call the function can you share that bit of your code? find out discord and post it there.
!gnir eht ni rednetnoc wen a worht dna ,gniht ykaens a od annog m'I ,etanutrofun woH 1ho-Hu !etanutrofnu woH !ho-hU
[::-1]