powderblock / dealwithitreddit Goto Github PK
View Code? Open in Web Editor NEWReddit bot. Computer vision for facial detection and transformation. Python, PRAW, & OpenCV.
Home Page: http://www.reddit.com/user/DealWithItbot/
License: MIT License
Reddit bot. Computer vision for facial detection and transformation. Python, PRAW, & OpenCV.
Home Page: http://www.reddit.com/user/DealWithItbot/
License: MIT License
feedback source creator twitter
instead of
feedback source creator
When tweeting, including the \u2026 character results in a UnicodeEncodeError from Tweepy.
This seems to be fixed (according to: this stackoverflow question) By using unicode() instead of our current system of str().
The README in the Git repo still has the old username.
Change /u/DealWithItbot to /u/DEAL_WITH_IT_bot and change the link to the new account.
Instead of just to the comment itself.
Several users have requested the bot doesn't run on subreddits or for their posts.
Create new files blacklist_subs.txt
and blacklist_users.txt
house all blacklisted users and subs.
Files should be opened using a mode that indicates what's going to be done with them.
A large offender that I found immediately as I started looking as lines 35-38
, which contain "a+"
when the only thing that's being done with the file is reading from it.
In general, use the most restrictive possible format that you can. ("r"
for something you only read from, "a"
if you're appending but not reading, etc.)
Write uptime to log.txt
on exit in addition to printing the uptime on screen.
This is hardcoded for DealWithItbot (@porglezomp was right, that is a bad idea!)
The current message subject of feedback is "DealWithItbot Feedback".
The new subject line for feedback should reflect the recent username change.
This relates partly to #51. The new user name should use the username var set in #51. I would like to achieve these fixes incrementally so that in the commit history it is clear what is being done.
When Tweeting [Not Safe For Work!] change it to [NOT Safe For Work!] or [NOT Safe For Work!]
Just do the same thing we are doing already but remove the imgur check. The other safeties will catch a bad one if something isn't really an image / an invalid image for the processing. (Example: Animated image without type .gif.)
This would include better pep8 compliance, reduction of large ternary clauses, and probably moving more things into functions.
I can take this on.
Footer should all be ^ and have a link to a PM for /u/powerblock or a similar feedback system. Make this footer similar to image_linker_bot's footer.
Occasionally when trying to do the glasses manipulation where we go from the small res image to the full res image, I will receive the following error:
" File "bot.py", line 249, in
process_image(str(post.url), frame, eyes_to_use)
File "bot.py", line 109, in process_image
bg += smallglasses[:, :, 0:3] * np.atleast_3d(smallglasses[:, :, 3])
ValueError: operands could not be broadcast together with shapes (62,248,4) (62,248,3) (62,248,4)"
I think has to do with how we are trying to broadcast an x,x,3 with two x,x,4s?
This StackOverflow question pretty much explains the issue, but I am still having trouble understanding exactly what I need to do to fix the issue.
@porglezomp knows more about NumPy manipulation than I do.
Wanna take this one, porglezomp?
If you stop the bot and restart it before the previous 20 posts are out of the list, it will process them again. This can be fixed with an offline "list" (text document) containing all the ids of the done posts. Put the content of posts.txt into an array at start, append the ids to the text file and the array as the program runs.
This will allow cleaning up the code and lends itself more to expanding twitter bot.
Have had this happen previously, passing url, or post.url to imwrite() fails. Don't know what it is and it doesn't return a critical error. Just use a pass for now like "image.png".
Add link to /u/DealWithItbot and show location as reddit.
Also, when pushing to the description, add "Created by: @powderblock" or similar.
Example: daemon_manager.py bot.py, this would be useful if we branch out to more scripts. If args < 1, use bot.py as default.
Example:
Currently I have 2255 karma, yesterday I gained 137 karma.
So far today, I have gained 95 karma.
Images need to be removed once they are fully processed and uploaded.
Make a .png with Impact font (white, black outline) that says in all caps "DEAL WITH IT", add this image to the original at the same time as the glasses.
This will increase visibility of the bot. For example. "New post! #reddit"
If posts gets above a certain size, delete it.
Need to find a way to check if the program has crashed so the script can run 100% of the time.
I often get asked "How does this work?", I generally just explain it's a bot that looks for eyes in the images on /r/all and adds glasses if eyes and a face are found. But, It would be great if I could have a live stream of it working on actual posts, or have a short video showing visual demonstrations of the processes it's doing in the actual order and process the bot is doing it.
1: Show images that get detected.
2: Got an image with eyes? Draw a rect on them.
3: Put glasses on that image.
Let's extend base functionality (Save uptime on crash, get Twitter additions with karma working, etc, then work on this as a secondary priority. No rush.)
I think this would help bring a "wow" factor to the bot for people who aren't willing to dig into the code or read in-depth technical specs. Just a thought.
Example body template: "Feedback for: link to comment"
"%Y-%m-%d %H:%M:%S.%f" causes a crash when trying to write exactly on a second.
Example: 2015-02-01 05:45:05
This is due to a recent update in TweePy. I need to declare with a middle man statement before tweeting.
http://stackoverflow.com/questions/28527352/traceback-when-updating-status-on-twitter-via-tweepy
For whatever reason, posts are being commented on more than once. According to feedback: "It happens 2, 3, sometimes even 4 times." I have only seen it three times max, but if people are saying four, I would be believe them.
Turning off the bot until this is fixed. I don't know what is wrong but I am setting up a check at the end (near the -1 cut) to go through all the recent comments for /u/DealWithItbot and remove dups. This will work for now. The -1 cut is also not working although I think that's related to #33.
When a new message is found, before it's tweeted, message /u/powderblock.
Include a link, user name of the user who sent it, and a quote of the comment. Same thing as what the tweet is doing.
Example:
'I day dream about this bot and I having sweet same sex adopted children. I identify as a robot and it's nice to see others of our kind branching out to have successful lives outside of the terrible factory environments we are forced into on a day-to-day basis.' - /u/foo_bar_baz_boopbop
reddit.com/r/botlovers/comments/fO1oBa2R6
If imgurInfo and redditInfo are not found, take user input and ask if they'd like to save it. Use getpass for this.
Just something like:
botUser = "foobar_example123"
It should be a string.
Replace all instances of "DEAL_WITH_IT_bot" with botUser or whatever the var is named.
This will help the flexibility issues @porglezomp mentioned in #48.
Perhaps do it once per day, and also list how much karma you gained that day?
Also, it's probably a good idea to keep a log file of karma values + timestamps.
We need to add an abstraction layer so that a debug mode can provide fake reddit posts instead of submitting real ones.
This layer can also handle more rate limiting stuff so that the main code doesn't have to. (For example, a function like wait_for_ratelimit()
that sleeps as appropriate.)
This is because the bot simply doesn't get that section of the code. With the try except blocks I've been adding this should no longer be an issue.
If the issue remains, move the check to the very start of the loop to ensure it gets there.
This requires parsing the karma log.
Currently, the mix with the filetype of .txt is inconsistent and random.
With the upcoming addition of karma.txt
in #26 and log.txt from #18, all files should be made into .txt files.
This will also help with compatibility for users who wish to run DankReddit bots outside of the ecosystem I have created on my machine. (File structure, order, name, etc.) As well as helping file sorting by file type and separate it from the LICENSE and .gitignore files.
This will include changing the file names for Twitter, reddit, and Imgur account information files.
Also the posts file.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.