![make a reddit video posting bot make a reddit video posting bot](https://sm.mashable.com/t/mashable_in/fun/t/this-cleve/this-clever-bot-turns-reddit-arguments-into-video-game-scene_fmps.h720.jpg)
Here, you will need to add the following config variables:.Select the Settings Tab and click on the Reveal Config Vars Option.Now you will need to add the environment variables.
Make a reddit video posting bot update#
Auto Deploy starts deploying your script as soon as it detects an update in your GitHub.Now search for your GitHub Repository and enable auto deploy.Go to the Deploy Tab, and select GitHub as the deployment method.Go to the Heroku Dashboard and create a new account.(Link to a sample repository is given at the end of this article.)
Make a reddit video posting bot code#
![make a reddit video posting bot make a reddit video posting bot](https://res.cloudinary.com/practicaldev/image/fetch/s--3fZMsvr7--/c_imagga_scale,f_auto,fl_progressive,h_900,q_auto,w_1600/https://thepracticaldev.s3.amazonaws.com/i/9qakp1cel5yo6hlev9xb.png)
This is achieved by pausing the script for 600 seconds using the sleep() function. We have also set the bot to send only one message every 10 minutes, so that it does not spam. Finally, it sends out the message by using the bot.sendPhoto() API call, which takes in the channel name, photo URL, and caption as parameters. not yet been posted to the channel), it formats the message by using markup. If the script finds a new post that has not been written to the prev_submissions.id file (i.e. Here, the subreddit.hot() returns all the Hot Posts in the Subreddit. exception( "Error fetching new submissions, restarting in 10 secs")
![make a reddit video posting bot make a reddit video posting bot](https://techcrunch.com/wp-content/uploads/2015/11/reddit-suspension.png)
To access posts from Reddit, we’ll be using the Reddit API and the Python library PRAW (The Python Reddit API Wrapper). Add the bot that you created into the channel with administrative permissions.Give the channel a name of your choice.Click on the Hamburger Menu on the left and click on New Channel.Create a Telegram ChannelĬreating a channel on Telegram is quite simple. Store it securely, as we’ll need it soon. There! You have successfully created the bot! The API Token and the bot link are given. Now, click on this link and open up BotFather.Ĭreate a new bot by entering the command, \newbotĮnter a display name for the bot and hit enter. Bot Management is done by a bot on Telegram called BotFather. Our second step will be to create a new bot on Telegram and get API keys for the bot. In the below example, we will be auto-posting from the r/dogpictures subreddit. This was a way for me to get better at Python, while also saving time every day! Like a true programmer, I decided to create a bot in Python that would automatically post new posts from Subreddits to a Telegram Channel. I love scrolling through dog photos on Reddit, and there was one point in time where I felt that I spent too much time in Reddit. You can use it as a reference or star it, or fork it and submit a PR! Table of Contents In this article, we’ll take a look at the Telegram Bot API and dive into building a powerful bot that can auto-post from a subreddit.Īll the code for the following tutorial is available in my GitHub Repository. Telegram APIs and TDLib - Build your own customized Telegram clients.Bot APIs - Create powerful bots that run on Telegram.Their developer offerings can be classified into two types: Telegram is also extremely developer-friendly, offering APIs that are totally free. Seems perfect, doesn’t it? The possibilities don’t end there! The entire code is open-sourced, allowing you to build your own version of telegram! It’s extremely fast, secure, cloud-based, and works seamlessly across all devices. Telegram is a popular, modern cross-platform app that is used extensively for messaging.