Create a Reddit Bot using Repl.it to host for free! Beginner Friendly.

Sdílet
Vložit
  • čas přidán 28. 02. 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...
  • Věda a technologie

Komentáře • 122

  • @ClarityCoders
    @ClarityCoders  Před 3 lety +21

    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!

    • @COSMEREAUDIO
      @COSMEREAUDIO Před 3 lety

      How it is not working

    • @MrRx29g
      @MrRx29g Před 3 lety

      Replit mentions that 'the new UI is slowly rolling out to users' so .env is still in use

    • @mrgoats
      @mrgoats Před 3 lety

      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']

    • @evancharles1182
      @evancharles1182 Před 3 lety

      I guess Im pretty off topic but does anybody know a good website to watch newly released series online?

    • @remingtonstetson905
      @remingtonstetson905 Před 3 lety

      @Evan Charles I watch on FlixZone. Just search on google for it =)

  • @Jjmmll
    @Jjmmll Před 3 lety +13

    Literally what I was looking for, very well presented thanks very much!

    • @ClarityCoders
      @ClarityCoders  Před 3 lety +2

      Glad it helped! Thanks for watching I really appreciate it.

  • @joshuarmost
    @joshuarmost Před 2 lety +3

    I think I finally found what I was looking for! Thank you!

    • @ClarityCoders
      @ClarityCoders  Před 2 lety +2

      My man! I hope so let us know if you have any questions.

  • @NonDomForever
    @NonDomForever Před 3 lety +6

    Wow, this is such an amazing tutorial. Thanks!

    • @ClarityCoders
      @ClarityCoders  Před 3 lety +2

      Honestly after tough days these comments mean a lot thank you.

    • @NonDomForever
      @NonDomForever Před 3 lety

      @@ClarityCoders It seems CZcams 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.

  • @zakyvids6566
    @zakyvids6566 Před 3 lety +3

    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
    ❤️❤️❤️❤️👍

  • @imherovirat
    @imherovirat Před 3 lety +6

    Ah what a timing, I badly wanted to learn praw, thanks Man :)

    • @ClarityCoders
      @ClarityCoders  Před 3 lety +2

      Glad I could help! Any questions let me know.

  • @lizard_ow7145
    @lizard_ow7145 Před rokem +1

    excellent guide, thanks

  • @eduardomartinez6521
    @eduardomartinez6521 Před 3 lety +4

    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?

    • @ClarityCoders
      @ClarityCoders  Před 3 lety +2

      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.

  • @abrahaml1841
    @abrahaml1841 Před 3 lety +1

    Thanks man appreciate the hekp

  • @mrgoats
    @mrgoats Před 3 lety +1

    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.

  • @TooFarGabe
    @TooFarGabe Před 2 lety +1

    @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

  • @thepetersong
    @thepetersong Před 2 lety +1

    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

  • @xyz7572
    @xyz7572 Před rokem +1

    What should I write to select several subreddits rather than just one or r/all ?

  • @engineerbot
    @engineerbot Před 2 lety

    Quick question: How would I have it monitor and reply to posts instead of comments?

  • @atronoskronios6815
    @atronoskronios6815 Před 3 lety +1

    i updated the csv file but it still makes same comments! any way to fix this

  • @HackerFlavio
    @HackerFlavio Před rokem

    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.

  • @reeceytaylor
    @reeceytaylor Před 2 lety

    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

  • @laraibsidd127
    @laraibsidd127 Před 2 lety

    Won't the bot stop if i close the browser or close my system?

  • @thefitgentleman3541
    @thefitgentleman3541 Před 3 lety +2

    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.

    • @ClarityCoders
      @ClarityCoders  Před 3 lety +1

      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?

  • @nushankodikara
    @nushankodikara Před 3 lety +2

    You deserve more and more likes and views? I'm shocked

    • @ClarityCoders
      @ClarityCoders  Před 3 lety +1

      Thanks means a lot! As long as I get a few views I'll keep making them.

  • @imjustdade3917
    @imjustdade3917 Před 2 lety

    is it possible in any way to make a webhook reddit bot?

  • @623-x7b
    @623-x7b Před 2 lety

    I really don't want to store my password in plaintext. Is there a better way?

  • @cempo8163
    @cempo8163 Před 3 lety +1

    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?

  • @r2kstories38
    @r2kstories38 Před 2 lety +1

    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?

    • @ClarityCoders
      @ClarityCoders  Před 2 lety +1

      Not totally sure if you jump in discord and send code and error we can help. Make sure not to send your password!

  • @nevkero4281
    @nevkero4281 Před 3 lety +7

    Can you also make a Reddit auto meme bot so it posts memes to subreddits?

  • @unbenanntbekannt7569
    @unbenanntbekannt7569 Před 2 lety

    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?

    • @ClarityCoders
      @ClarityCoders  Před 2 lety +2

      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.

  • @Sam-vf5uc
    @Sam-vf5uc Před rokem +1

    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?

    • @Sam-vf5uc
      @Sam-vf5uc Před rokem

      Turns out I needed a better app name, I had one that was too generic and Reddit rejected it.

  • @notayush771
    @notayush771 Před rokem

    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 😊)

  • @enriquerenteria6089
    @enriquerenteria6089 Před 2 lety +2

    Can I do this on vscode?

  • @jacobweaver8505
    @jacobweaver8505 Před rokem

    How would I do this but make the Bot log and store points based on interaction??

    • @ClarityCoders
      @ClarityCoders  Před rokem

      Great question join our discord and I'm sure someone could help you out.

  • @Legoyeti6376
    @Legoyeti6376 Před měsícem

    Reddit prefs apps don’t work

  • @Nizart
    @Nizart Před 3 lety +1

    what do i have to change if i want the repl.it to run once every hour?

    • @ClarityCoders
      @ClarityCoders  Před 3 lety +1

      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.

    • @rewindcat7927
      @rewindcat7927 Před 2 lety +1

      check out a package called 'node-chron'

  • @necrobrqte5260
    @necrobrqte5260 Před 3 lety +1

    How can I create env file

    • @ClarityCoders
      @ClarityCoders  Před 3 lety

      On replit you would have to check there docs. In general I use virtualenv. Just pip install virtualenv then use virtualenv env

  • @gellertgrindelwald4374

    Repl.it disabled .env files, what should I do

    • @ClarityCoders
      @ClarityCoders  Před 3 lety +1

      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!

  • @QQ-gi3do
    @QQ-gi3do Před 3 lety +1

    What happens if there are no comments on the post? How does one post a comment if there are no comments to begin with?

    • @ClarityCoders
      @ClarityCoders  Před 3 lety

      You could write something that comments based on the title of the post? possibilities are endless.

    • @QQ-gi3do
      @QQ-gi3do Před 3 lety

      @@ClarityCoders I tried that but no luck, it only loops back to printing the title of the post

  • @thegovtdoesntcareaboutyou

    .env doesn't work

  • @ju-yuanchueh8444
    @ju-yuanchueh8444 Před 2 lety

    I'm going to come back to this because I don't have time yet lol.

    • @ClarityCoders
      @ClarityCoders  Před 2 lety +1

      I'll be waiting 😉

    • @ju-yuanchueh8444
      @ju-yuanchueh8444 Před 2 lety

      @@ClarityCoders I did the code and was like why no comments but I was doing a subreddit that wasn't as popular lol

    • @ju-yuanchueh8444
      @ju-yuanchueh8444 Před 2 lety

      Actually it might be wrong because for the client secret part it says invalid syntax

    • @ju-yuanchueh8444
      @ju-yuanchueh8444 Před 2 lety

      I fixed that by rewriting it but now I have module object is not callable error.

  • @nevkero4281
    @nevkero4281 Před 3 lety +2

    Can you make a discord-to-Reddit bot?

    • @ClarityCoders
      @ClarityCoders  Před 3 lety

      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.

    • @nevkero4281
      @nevkero4281 Před 3 lety

      @@ClarityCoders Cool

    • @nevkero4281
      @nevkero4281 Před 3 lety

      @@ClarityCoders It would be great for growing small subreddits

    • @diablolaggo870
      @diablolaggo870 Před 3 lety

      @@ClarityCoders ummm.. where can I find it? Also.. a discord to reddit would be cool... Jus like redditcord

  • @neilMachado-rq8hz
    @neilMachado-rq8hz Před 3 lety

    my bot goes offline after 1 hr ,even i have hacker plan and always on

    • @ClarityCoders
      @ClarityCoders  Před 3 lety

      Hit up their support it's pretty good that shouldn't happen.

  • @ZyloGG
    @ZyloGG Před 3 lety +1

    Plz make an updated version

    • @ClarityCoders
      @ClarityCoders  Před 3 lety +2

      I may make a few more. what would you like to see updated?

    • @ZyloGG
      @ZyloGG Před 3 lety

      @@ClarityCoders we cant use .env files . You should make a new tutorial on how to create a reddit bot using Repl.it

    • @ClarityCoders
      @ClarityCoders  Před 3 lety +2

      check my comment on it! it's really easy none of the code changes. I will look into it though!

    • @ZyloGG
      @ZyloGG Před 3 lety

      @@ClarityCoders wdym “on it”.... like in the replit ?

    • @ClarityCoders
      @ClarityCoders  Před 3 lety +2

      @@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!

  • @lilystic9623
    @lilystic9623 Před 2 lety

    16:27

  • @aguythatexists8318
    @aguythatexists8318 Před 3 lety

    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"

    • @ClarityCoders
      @ClarityCoders  Před 3 lety

      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.

    • @aguythatexists8318
      @aguythatexists8318 Před 3 lety

      @@ClarityCoders ohhhhhhhhhh

  • @torpid
    @torpid Před 3 lety +1

    u/have_a_nice_day_bot

  • @user-nn6ez3zk8o
    @user-nn6ez3zk8o Před 11 měsíci

    How do I make him comment more frequently?

  • @anorintarsus
    @anorintarsus Před 2 lety

    7:26 bizim herif koyun kırpan'ı böyle yapmış demek.

  • @blackheartkiss1441
    @blackheartkiss1441 Před 3 lety

    can you show us how to create an upvote bot

    • @ClarityCoders
      @ClarityCoders  Před 3 lety

      So a bot that up votes a certain persons post every time?

    • @blackheartkiss1441
      @blackheartkiss1441 Před 3 lety

      @@ClarityCoders yes, more than once though, something that pushes a post to the top of a subreddit

    • @ClarityCoders
      @ClarityCoders  Před 3 lety

      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.

  • @miketrayven6060
    @miketrayven6060 Před 3 lety +1

    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!

  • @necrobrqte5260
    @necrobrqte5260 Před 3 lety

    POV: this bot is not for discord

    • @ClarityCoders
      @ClarityCoders  Před 3 lety

      Nope it's for reddit! I have one for discord though using replit. czcams.com/video/wjQ9Nin21d8/video.html

  • @jerukpurut369
    @jerukpurut369 Před 3 lety +2

    Hey Man just want you to know that repl.it disabled .env file for good

  • @codyswanson
    @codyswanson Před 3 lety

    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?

    • @nuclearcrypto
      @nuclearcrypto Před 2 lety

      Have the same problem, have you found any solutions yet?

    • @ClarityCoders
      @ClarityCoders  Před 2 lety

      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.

  • @M5J72XrtvEa24XteAIdNGA

    !gnir eht ni rednetnoc wen a worht dna ,gniht ykaens a od annog m'I ,etanutrofun woH 1ho-Hu !etanutrofnu woH !ho-hU