Openshift lets you host three applications for free.
Personally use it and it works great, and the bots in /r/indianfood and /r/Ark_Atlantis have been running fine on it.
Took a look at it and the code is fairly straight forward. Only a few changes would be needed to get it running on Openshift:
Main.py
to app.py
requirements.txt
with praw
in itI could help you - or whoever else is going to keep the bot alive - with setting it up.
Can't personally do it though, all three of my free application slots are in use.
Try https://ifttt.com. There is a reddit trigger "New post from search" and there is a reddit action "Submit a new link". Maybe that will work out. (Disclaimer: I haven't used these particular channels before)
You might be able to do this via IFTTT
https://ifttt.com/connect/feed/reddit
The advantage being that you won't have to host the bot, which is a hassle for users who are not familiar with programming at all.
I was looking at renting server time to play with, and DigitalOcean had the best deal- $5/month. It's a VPS running Linux, so you would just ssh in, set it up, and forget about it.
There was one in Aruba for $1/month, but it looked sketchy and they never responded to my email.
I don't know if anybody got back to you, but here's what I came up with in ~15 minutes. You'll need python 2.7 and praw installed. If you need help, google can answer, or you can just ask me.
There's no way to scrape every single post from a subreddit, what my script does is scrape a specified number of posts from the current hot posts in a sub. It's not the fastest thing in the world, but it gets the job done. It goes through and checks all submissions from each hour and averages together it's score, and picks the highest average score from an hour, and then goes through and checks the best minute to post from that hour, and gives you the average score from posts that were posted that hour.
You can download the script here.
Let me know if it gives you any trouble.
Example output:
What Subreddit would you like to check: askreddit How many posts would you like to search: 1000 The best time to post is 15:17 on average got a score of 692
this will look for new submissions, takes the title, create a poll and reply to the submission. you will need python, praw and requests.(I assume you know how to run it).
import praw import requests import time
reddit = praw.Reddit() # bot credentials. subreddit = reddit.subreddit('') # specify your subreddit.
payload = {'title': '', 'options': ['Yes', 'No'], 'multi': 'false'}
def main(): while True: print('Starting.\n') start_time = time.time() try: for submission in subreddit.stream.submissions(): if start_time < submission.created_utc: payload['title'] = submission.title print('Creating new poll.') r = requests.post('https://www.strawpoll.me/api/v2/polls', json=payload) print('Replying.\n') submission.reply('https://www.strawpoll.me/{[id]}'.format(r.json())) except Exception as e: print(e) print()
if name == 'main': main()
Do you still need this? If so, would this site suffice?
http://www.flashscore.com/soccer/poland/ekstraklasa/results/
Also, how far back should it scrape the results? The last 10? The last 20?
I might have time this weekend, but I'm not sure. Else it would be done somewhere next week.
This already exists (mostly). Check out [this thread](/r/RequestABot/comments/6lz59v/examples_of_commonly_requested_bots/), specifically the Submission keywords reply script. All you need to do is set SUBREDDIT_NAME
, KEYWORDS
, RESPONSE
, USERNAME
, PASSWORD
, CLIENT_ID
, and CLIENT_SECRET
. The program logic is already written.
I don't think it'd be as touch as /u/Kapow-bitch thinks, but it would cost a little bit.
This is because there's no free Shazam like service to use for the bot. The only one I can find at all is https://audd.io/, which would cost $4.20 per 1000 requests, or half a cent per request.
It's not a big cost but still if it got a lot of use it'd cost a bit.
Other than that it wouldn't be tooo hard IMO, just download the video and then send it to that API.
I could take a crack at it some point in the future, if there was demand, but not any very soon.
I see.
Yeah this is definitely possible, so I'll do this.
Do you have a host/account setup for the bot?
In case you don't know, bots run using a already-created reddit account, and need a computer to always be running the code.
You can make the account username whatever you want, it's Reddit-bot edicate to have bot
somewhere in the username for accounts that are controlled by bots.
> Maybe PokemonGiveawayGloreBot
, it's up to you at the end.
Openshift is a good host for bots, and it's free.
I can make this, although I have just one question: based on what is currently there, do you want only the Western Conference Standings, or do you want the eastern ones there too?
That's about it. I'll probably have it done today or tomorrow.
If you didn't already have a host in mind, Openshift is free. Just takes a little know-how to get setup, but I could help you with that if you need.
http://www.tutorialspoint.com/python/string_len.htm
Without seeing the code you have so I can insert the variables being used, I'll run you through the basics of both your questions.
You'd need to use an IF statement to check if the length of the comment is greater than 200. If it is, then ignore it. Otherwise, perform the action.
Pastebin your code and I'll type up the IF statement you need if the above brief (vague) explanation doesn't help.
As for the every other thing, I would create a variable..let's call it "doit" and set it to 1 initially. Every time a comment is found, check if the doit variable is set to 1. If it is, have the bot reply and then set doit to 0. The next time a comment is found, it'll check that the doit variable is 0, NOT post the reply, and then set the variable to 1.
I'm not familiar with SQL very much at all, and I've only used the sqlite3 library in Python, which works with this. I'm not sure whether it is compatible with other SQL databases or not.
Ok, I created the bot, here it is https://github.com/achyutreddy24/RedditBots/tree/master/ConLangBot
Download the three files, rename the (renametoconfig.py) file to config.py and add your own information in it.
At the top of main.py, it says /u/fusiongaming surrounded by other symbols, just change that your bots name, all lowercase.
Download python 3
It should come with pip but if if doesn't download that too
Open command prompt, run
pip install praw
then navigate to where you saved the two files with command prompt, use cd or look up how to if you don't know
Then run
python main.py
now you need to leave it running and your bot is working. If you don't want to keep your computer on all the time, you can host it somewhere else but they usually cost money.
The bot will create a third file called data.db
This is what stores all the comments the bot has replied to and all the small questions threads it has found. If you want to view it, download sqlite3browser http://sqlitebrowser.org/ and open it.
If you run into any problems let me know and I'll try to fix them.
I decided not to keep the words in the database and instead refind them every time. Also it only searched until it find the first post with the word, I'll change this later so it will find all of them if you need.
If you're absolutely sure it's the final line, a simple script like this should work. Beware that even a whitespace at the end will break things.
If you want a more complicated check to find the last line with text, try this.
No problem. I was in the same situation as you, all my bots were one-off. Once I got started with a bot that needed to run constantly, I started realising how much extra stuff needs to be coded to ensure it continues running, and alerts me if it stops. It took me a long time to figure out all that event log shit so I'll be happy if it can help someone else out.
Also NP++ is pretty great, but I highly highly recommend PyCharm Community Edition (it's completely free) as an IDE, it is absolutely amazing. I could not live without it.
Aha, I've finally managed to reproduce the problem for myself. I believe that your program does not have read/write access to the folder it is in.
Try moving the file to a place like C:\flairbot\ and see if it works there. If you need to, edit the permissions of the folder; when I go to the Security tab of the Properties window, I have "Full Control" checked for every listed user.
This might go faster if we do the live-chat over on collabedit. I didn't expect the little things to build up like this
Automate. It's a little weird to get used to but it makes sense once you use it enough. I believe they have functions for that so just make a loop. Delay --> Unlock --> Delay --> lock. Then loop it.
I'd suggest using a dictionary that your bot stores in memory and puts into a file when it closes/crashes. See https://stackoverflow.com/questions/11821322/elegant-way-to-store-dictionary-permanently-with-python for options.
If you want code help, feel free to ask - it might also be easier to help if you share your current code, whatever
The account you linked is using a service called “If This Then That”. You could use this to avoid applying for twitter developer access, and avoid running a bot yourself. The flow for posting reddit -> twitter should be free on IFTTT iirc.
This is very doable using something called IFTTT. Here is the specific recipe: https://ifttt.com/applets/eechFkJQ-post-your-instagram-photos-to-a-facebook-page?term=Facebook%2520post
If you need help, just PM me.
Im not sure if theres a bot for it but you could definitely do it with ifttt. Have the trigger be when a new public video is posted from subscriptions and then the action be to make a reddit post. Go to https://ifttt.com/discover and it should be pretty self explanatory from there. Its a totally free service, all youd have to do is sign up
You can do this with ifttt. See the applet here and install the IFTTT app to link it to a push notification on your phone.
I'm not sure how often ifttt checks though, it could either be within seconds or take a few minutes, you'll have to experiment to find out.
Take a look at what this recipe does and try to figure google sheets into there. I don't have an account to test with but this should be an adequate start: https://ifttt.com/applets/315468p-if-new-tweet-by-specific-user-then-tweet-the-text-automatically-to-your-twitter-account?show_survey=true
I wired it up with r/mildlyinteresting to test out... and it doesn't seem to work
here's it https://ifttt.com/applets/77702132d-new-image-posts-from-subreddit-to-twitter
Edit: I'm dead tired and going to sleep, but would greatly appreciate any advise on this. I gave it permissions to the twitter account and to my alt reddit account. Maybe it matters whether I'm logged in or not?
Not sure if this is what you want, but there is a ITTT recipe that will watch for saved entries and post them to a google spreadsheet on your google drive. I think there are other ways for it to save, might be worth looking into them. link-> https://ifttt.com/applets/34073517d-when-a-reddit-post-is-saved-enter-a-row-into-a-google-drive-sheet-with-its-info
Does IFTTT work for channels I don't own? I did some more searching and found a prebuilt one as well, but it seems to only work for my own channel, not the one in question. I also found a tutorial on how to do this yourself, but when I enter the feed url it says "Feed is not reachable at this time".
That is what the bot should do yes and I would like the bot specifically for /r/Naruto which I have full permission for. The posts in the new queue are not going to be flaired right away so it should be able to check posts periodically in order to cover every post.
Here are the exceptions: title: by, author, artist, source, OC, credit domain: deviantart.com, pixiv.net, artstation.com
Here's the full message I'd like it to say:
Hi, if you have you have already given credit to the artist of your fanart submission, please ignore this comment and keep up the good work!
If not, please try to find the original artist using both of the following tools:
Please always try to credit the original artist and link back to them either in the title and link of your post or in the comments. Thank you!
I am a bot, and this action was performed automatically. Please contact the moderators if you have any questions or concerns.
I think you could just use CookTimer for this. It's a free countdown stopwatch that beeps when it hits zero and you can set it to a custom time.
(You can create a shortcut and put the icon next to the Skype icon, or in a visible place, and start it manually. Or maybe a bot could monitor your PCs running programs and start CookTimer at a certain custom set time every time Skype starts..)
http://download.cnet.com/Cook-Timer/3000-2124_4-10696217.html
If there is an RSS feed you can use IFTTT to create a task that would post/update changes to the feed. I used it to search for ARG Trailheads (https://www.reddit.com/user/SCP_048)
If you want all images from now on, you can use an IFTTT recipe. Trigger: Reddit; Action channel: Dropbox; Action: Add file from URL
This will save each image to a folder in your Dropbox account.
Nothing to do with css, that controls the style and look of your subreddit
If you are the owner of the channel use If This Then That
If you don't own the channel use Channel Bot
Not much that I can think of particularly.
It should always post with the title and the end date in square brackets [ ]
So this project - https://www.kickstarter.com/projects/2134561303/baffledazzle
Would be posted using the title "Baffledazzle [Ends Mon, May 5 2014 1:00 AM BST]"
I guess being able to reuse it and change category and location to use on crowdfundedvideogames or crowdfundedlondon subreddits (for example) would be an idea, but not necessary.
Future development for posting comment updates when it achieves 30/60/100% of funding goal might be an idea, but again not necessary.
There's some chat in here about using the search function and a ruby script as well as a non-public API - http://stackoverflow.com/questions/12907133/does-kickstarter-have-a-public-api
So you're saying it worked? :D
Your Pi should be able to handle it, I think you only need to change this
logfile = ".\art_flair.log"
to this
logfile = "./art_flair.log"
If you end up using your Pi there may be errors (due to differences in Windows and Linux systems). Let me know if that happens.
If you can't find your Pi, you can try an EC2 instance. Just make sure you set up a free-tier eligible instance and you should be good for 12 months. Hopefully you have a bit of experience in this area, but if you don't a bit of googling should sort you out. Here's Amazon's official documentation on setting up a Windows server.
I'll just show my entire code. I think the problem isn't that it's printing an empty list, it's that it's not running the finding comments and replying to comments part. https://hastebin.com/neqayonaso.py
It's a really simple bot.
Here it is. There's already the necessary file (comments_replied_to.txt), so the first part I guess isn't super necessary.
Also, I just used the 2to3 tool on my code.
Yeah you don't recall correctly at all. If you are --Nylon, then I posted on this same subreddit a while ago asking for someone to make this same bot. You came back to me a couple of days later with a buggy bot that wouldn't load up, and after about 2 hours of bug fixing together on Discord, we got it working. I tested it out on my test sub where I discovered further bugs with it. I messaged you on Discord about them and you told me something along the lines of "no problem, I'll be back soon". You never came back, and you ignored my messages on Reddit.
I know for a fact I wouldn't have been able to make it myself because I don't even know how to use PRAW. I just spent an hour and a half trying to get a bot to make comments on new posts, and couldn't even get that going.
I know you are not obligated at all to help me further, but it was very annoying how you said you would help me, but then repeatedly ignored me, and now you are saying I "constantly bugged you". I was asking you for help, and never once forced you to do anything. If you did not want to work on the bot further, or had other things going on in your life that stopped you from working on it, then you could have at least had the decency to tell me that, rather than completely ignoring me, deleting your account, and now trying to claim something that is completely false.
Also, I still have the bot you made me, so if you want to go and test the bot for yourself, then feel free. It works, somewhat, but there are multiple bugs that make it incomplete and unusable on a proper subreddit.
Here is your code - https://hastebin.com/arugeratac.py
You definately have to be good at coding, computers and understand what is an api and how does it work. What are json objects and why do we need them?
Take a class on web development first. Udemy.com is a great resource for starting out.
​
Reddit is built on python, so if all you want to do is make reddit bots, learn python. Although, you can use any language to interact with the API, python is probably the easiest language to get with reddit, since PRAW exists.
​
I personally write my reddit bots in JavaScript, but that's just because I know how to use that language, not python.
Just a word of warning, this repository contains compiled code in the form of DLL's. One seems to be to be a JSON parser, while the other seems to be a wrapper for the Reddit API. They are very probably fine, but seeing as they are compiled, there is no way to easily verify that they are.
If you want to be absolutely sure that there is nothing wrong in these DLL's, get them from the source, here and here. You will have to compile the Reddit API wrapper yourself, which is the same process as you'll need to do for the rest of this project. You'll have to open the project file (.sln) in Visual Studio and compile it. The output will be somewhere in a debug, release or bin folder.
I could do this if /u\/slark_picker doesn't want to.
> maybe make it sound cooler.
Would be quite easy to make the accept-phrase(s) - along with all the actual messages - configurable via a simple config file.
> requires a database or something.
It would be easiest to do with a database.
Gotta keep track of the VUL strikes, in-progress requests, and a maybe more.
Either way, if you don't have a host lined up for the bot - I'd guess you do as you already have made the account - Openshift works with bots and is free.
Neat subreddit concept by the way, basically /r/requestabot for .ipa
s.
I got a basic one working on my subreddit, /r/Rascal_Two
I got it changing the image every 60 seconds as demonstration.
It's using a old random-comic fetching script I had from before, so I'm going to need to know where are the daily images are going to be coming from.
Anyplace will work, I just need to know where. For example, what you see working on my subreddit is just a random comic fetcher downloading a comic image and uploading it to the subreddit stylesheet as daily.jpg
.
You're going to have to host it yourself.
Don't worry though, Openshift offers free hosting for three apps. If you already have a host in mind, well good, otherwise I can help you with Openshift if you can't figure it out yourself.
Not really in the spirit of botiquette so you probably won't get much attention here, but to answer your question about capitalization: you can choose whether capitalization matters or not.
In Python there is a string function .lower() which translates a string to its lowercase form. If you wanted to check for urbex without regard to capitalization, you would do something like this:
post_title = 'any good places to UrBex in chicago?' if 'urbex' in post_title.lower(): print 'hello world'
The post_title.lower() part forces the check to occur with the lowercase version of the title, so regardless of the original capitalization, the if statement will trigger when "urbex" shows up.
I want it to be constantly running.
I’d preferably do this for free. Heroku seems like a good hosting service, but I haven’t used it personally.
^By ^the ^way, ^I ^want ^the ^bot ^to ^repost ^the ^top ^post ^of ^a ^subreddit ^every ^24 ^hours, ^whilst ^being ^exact ^(posting ^the ^same ^time ^every ^day).
Yeah, for sure. Please send me the full source code as a gist, either by PM or comment reply.
I didn't make the bot initially to check for bold Es because that wasn't what you requested in the initial post. I can make it check for bolded Es and beat the workarounds.
Just for clarification, is Test a valid use, because the E is bold, or should the bot call that out?
> When you say "unique" what does that mean?
Whatever attribute you want to be unique does not exactly match another post. It could be anything -- URL, self text, or combination of two or more (author, self text, etc.)... or all of it.
>If OP changes the title but the link is the same does that still count as unique?
Up to you.
> Where is the remote database located?
A cloud database like MongoDB is pretty easily maintained and has a free tier. https://www.mongodb.com/
I'm interested as I really like working on complicated systems; however I do have questions:
> * Remove new post if the user hasn't left feedback for two different people(2 Comments with at least 50 characters) prior
So there's really no way to look this up through Reddit's API. That's not to say it can't be done--the most obvious suggestion is to implement some sort of database to store the number of accepted posts. I use a MongoDB database for some of my bots since it's free and easy to interact with. Something to be aware of. It would be great for doing data analytics on your best users down the line if you ever wanted to.
> * Exclude a user's comment from being rewarded with a point towards posting if they're comment contains profanity or is spammy
Profanity filters are definitely doable, however a bot would have a REALLY hard time determining what's spam and what's not. You need to have a really concrete definition of what spam looks like on your sub.
> * Remove Playlist/Album * Allow user to maintain a balance and check their balance by DMing
Need some more context on what this would actually entail.
Also worth noting that a bot like this isn't exactly trivial and would take at least 5 to 10 hours of coding to get up and running most likely and freelance development work can range anywhere between $15 to $50 per hour. Factor that into what you consider the most important features to be and consider scaling back. You would also need to consider any bot hosting options.
For what it's worth I'm the dev behind /u/gravelcyclingbot on /r/gravelcycling which does a lot of the complicated features I'm describing.
You should put the bot files into the same folder that you were in when you did the Heroku create command. If you had a folder at C:\heroku\bot, you would do
C:> cd C:\heroku\bot C:\heroku\bot> heroku create
That should create something, probably a .git file, inside of the folder. Any other files you put into this folder will become part of the repository
Here's Git. Git is a Version Control System, which means you can create checkpoints as you're writing a program, so you can revert to a previous checkpoint if something terrible happens. That really won't be relevant to working with this bot, but it helps distinguish Git as a system from GitHub as a website.
I think it's using https://sendbird.com for the chat thing so tapping into that is pretty much a no go.
wss://sendbirdproxy-06490ff42851cbcc5.chat.redditmedia.com
Selenium would work I guess.
No, once the time's up the post either stays or goes. Comments added later won't revive it. This could be written in, but let's get the regular one working first.
I'm heading down for dinner now, but why don't you join the collab for live chat. We can get this working much faster that way.
If you leave the bot running, and make a new post, does the bot immediately delete it or does it scan it at least once?
You sure you put DELAY
in seconds?
If you want to, we can make this go a little faster with CollabEdit. You might prefer to remove your password from the script before joining.
I know this is a bit late, and you already have a solution, but I'm the kind of guy that likes options, so here's another option for you. IFTTT Which is a website that looks for triggers you get, and outputs in a method you choose. You can see the variety of different uses on the site, but for your's it would be a simple watch Reddit for any post matching $THIS
and then it can email you, or text you, or pop-up a notification on your desktop with Push Bullet... or water your plants, or tweet, or turn on a light in your house, or update dropbox...
The only downside is that it can take up to 15 minutes after a trigger for it to activate, so if this is really time sensitive, it's not for you.